-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement detached signature factory, tests and helper extension methods. #47
Conversation
…ods for validaiton of detached signature objects
Signed-off-by: JeromySt <thelotrs@hotmail.com>
@microsoft-github-policy-service agree company="Microsoft" |
Signed-off-by: JeromySt <thelotrs@hotmail.com>
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Outdated
Show resolved
Hide resolved
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Outdated
Show resolved
Hide resolved
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Outdated
Show resolved
Hide resolved
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Outdated
Show resolved
Hide resolved
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
…icrosoft/CoseSignTool into user/jstatia/detachedsignature
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Outdated
Show resolved
Hide resolved
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Outdated
Show resolved
Hide resolved
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Fixed
Show fixed
Hide fixed
CoseSignTool/CoseSign1.Tests/CoseSign1MessageDetachedSignatureExtensionsTests.cs
Fixed
Show fixed
Hide fixed
CoseSignTool/CoseSign1/Extensions/CoseSign1MessageDetachedSignatureExtensions.cs
Fixed
Show fixed
Hide fixed
CoseSignTool/CoseSign1.Tests/CoseSign1MessageDetachedSignatureExtensionsTests.cs
Fixed
Show fixed
Hide fixed
CoseSignTool/CoseSign1.Tests/CoseSign1MessageDetachedSignatureExtensionsTests.cs
Fixed
Show fixed
Hide fixed
CoseSignTool/CoseSign1.Tests/CoseSign1MessageDetachedSignatureExtensionsTests.cs
Fixed
Show fixed
Hide fixed
CoseSignTool/CoseSign1.Tests/CoseSign1MessageDetachedSignatureExtensionsTests.cs
Fixed
Show fixed
Hide fixed
CoseSignTool/CoseSign1.Tests/CoseSign1MessageDetachedSignatureExtensionsTests.cs
Fixed
Show fixed
Hide fixed
/// <returns>True if the detached signature in the CoseSign1Message matches the signature of the artifact bytes; False otherwise.</returns> | ||
private static bool SignatureMatchesInternal(this CoseSign1Message? @this, ReadOnlyMemory<byte>? artifactBytes = null, Stream? artifactStream = null) | ||
{ | ||
if (!@this.TryGetHashAlgorithm(out HashAlgorithm? hasher)) |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null
|
||
// test null object case | ||
detachedSignature = null; | ||
CoseSign1MessageDetachedSignatureExtensions.SignatureMatches(detachedSignature, stream2).Should().BeFalse(); |
Check failure
Code scanning / CodeQL
Dereferenced variable is always null
|
||
// test null object case | ||
detachedSignature = null; | ||
CoseSign1MessageDetachedSignatureExtensions.SignatureMatches(detachedSignature, randomBytes).Should().BeFalse(); |
Check failure
Code scanning / CodeQL
Dereferenced variable is always null
|
||
// test null object case | ||
detachedSignature = null; | ||
CoseSign1MessageDetachedSignatureExtensions.TryGetHashAlgorithm(detachedSignature, out hashAlgorithm).Should().BeFalse(); |
Check failure
Code scanning / CodeQL
Dereferenced variable is always null
{ | ||
hasher = null; | ||
|
||
if (!TryGetDetachedSignatureAlgorithm(@this, out HashAlgorithmName algorithmName)) |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null
Implements the detached signature factory work in CoseSign1 to facilitate a detached signature embedded CoseSign1 object for use in various *BOM scenarios to be used with Azure CTS.