-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
6732: Default to sha2 digest for clickonce manifest #6882
Conversation
…signing algorithm is sha256/384/512
@@ -572,7 +572,11 @@ public static void SignFile(string certPath, SecureString certPassword, Uri time | |||
private static bool UseSha256Algorithm(X509Certificate2 cert) | |||
{ | |||
Oid oid = cert.SignatureAlgorithm; | |||
return string.Equals(oid.FriendlyName, "sha256RSA", StringComparison.OrdinalIgnoreCase); | |||
// Issue 6732: Clickonce does support sha384/sha512 hash so we default to sha256 |
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.
// Issue 6732: Clickonce does support sha384/sha512 hash so we default to sha256 | |
// Issue 6732: Clickonce does not support sha384/sha512 hash so we default to sha256 |
?
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.
I'm not sure this question makes sense but: Is it possible for a cert to have sha384/sha512 and not have 256?
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.
We use the signature algorithm of the cert to decide what file digest algorithm to use for the clickonce manifest files. So for certs with sha1 signature, we choose sha1 file digest algorithm for clickonce manfest. With this change, we will use sha256 file digest algorithm for clickonce manifest if the signature algorithm in the cert is sha256 or sha384 or sha512.
The cert's signature algorithm is the algorithm used to create the signature of the cert and can be only 1 value like sha1/sha256/sha384/sha512.
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.
Ah, so it's an independent signature/algorithm but it makes sense to use the strongest possible one based on the signal of the cert provided?
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.
Correct.
- Updated the Microsoft.Build.Tasks.Core nuget package to version 17.0.0 so that it includes this fix dotnet/msbuild#6882
- Updated the Microsoft.Build.Tasks.Core nuget package to version 17.0.0 so that it includes this fix dotnet/msbuild#6882
Default to sha2 digest instead of sha1 for clickonce manifest signing when certificate signing algorithm is sha256/384/512
Fixes #6732
Context
When using a certificate signed with sha384/sha512 as signature algorithm, ClickOnce defaults to the sha1 algorithm for it's digest hash.
Changes Made
UseSha256Algorithm decides if we sign with sha1 or sha256 hash. The function has been updated to use sha256 hash when signature algorithm of the signing cert has sha256/sha384/sha512 signature algorithm.
Testing
CTI has tested signing scenario for forms and wpf apps for all 4 hash types.
Notes