Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Signing verification utilities
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Seal
Building blocks
Signing verification utilities
Commits
954f7eec
Commit
954f7eec
authored
4 years ago
by
Gospodin Bodurov
Browse files
Options
Downloads
Patches
Plain Diff
Add support for hashing
parent
ad870c64
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!44
Implement a new signature/verification algorithm with severity level
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
__tests__/SigningService.test.ts
+1
-0
1 addition, 0 deletions
__tests__/SigningService.test.ts
src/services/SigningService/SigningService.ts
+27
-21
27 additions, 21 deletions
src/services/SigningService/SigningService.ts
with
28 additions
and
21 deletions
__tests__/SigningService.test.ts
+
1
−
0
View file @
954f7eec
...
...
@@ -164,6 +164,7 @@ describe("SigningService tests", () => {
attachmentsToVerify
.
push
(
attachmentData
);
attachmentsToVerify
.
push
(
attachmentData1
);
attachmentsToVerify
.
push
(
attachmentData2
);
attachmentsToVerify
.
push
(
attachmentHash
);
var
result
=
await
signingService
.
verifyAttachments
(
publicKeyPEM
,
attachmentsToVerify
,
signatures
);
console
.
log
(
result
);
...
...
This diff is collapsed.
Click to expand it.
src/services/SigningService/SigningService.ts
+
27
−
21
View file @
954f7eec
...
...
@@ -350,30 +350,36 @@ class SigningService {
if
(
filenameHash
in
signatures
)
{
var
attachmentSignatures
=
signatures
[
filenameHash
];
var
hashingAlgorithms
=
{};
for
(
var
j
=
0
;
j
<
attachmentSignatures
.
length
;
j
++
)
{
var
signature
=
attachmentSignatures
[
j
];
hashingAlgorithms
[
signature
.
hashingAlgorithm
]
=
true
;
}
var
attachmentVersionsHashed
=
[];
var
attachmentVersions
=
[];
for
(
var
hashingAlgorithm
in
hashingAlgorithms
){
if
(
hashingAlgorithms
.
hasOwnProperty
(
hashingAlgorithm
))
{
var
attachmentVersion
=
{
filename
:
filename
,
content
:
attachment
.
content
,
type
:
"
raw
"
,
hashingAlgorithm
:
hashingAlgorithm
};
attachmentVersions
.
push
(
attachmentVersion
);
}
}
if
(
attachment
.
type
==
"
raw
"
)
{
var
hashingAlgorithms
=
{};
var
attachmentVersionsHashed
=
await
this
.
hashAttachments
(
attachmentVersions
,
true
);
for
(
var
j
=
0
;
j
<
attachmentSignatures
.
length
;
j
++
)
{
var
signature
=
attachmentSignatures
[
j
];
hashingAlgorithms
[
signature
.
hashingAlgorithm
]
=
true
;
}
var
attachmentVersions
=
[];
for
(
var
hashingAlgorithm
in
hashingAlgorithms
){
if
(
hashingAlgorithms
.
hasOwnProperty
(
hashingAlgorithm
))
{
var
attachmentVersion
=
{
filename
:
filename
,
content
:
attachment
.
content
,
type
:
"
raw
"
,
hashingAlgorithm
:
hashingAlgorithm
};
attachmentVersions
.
push
(
attachmentVersion
);
}
}
attachmentVersionsHashed
=
await
this
.
hashAttachments
(
attachmentVersions
,
true
);
}
else
{
attachmentVersionsHashed
.
push
(
attachment
);
}
var
valid
=
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment