File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/Cli/dotnet/Installer/Windows/Security Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,14 @@ internal static class Signature
2929 /// <remarks>This method does not perform any other chain validation like revocation checks, timestamping, etc.</remarks>
3030 internal static unsafe int HasMicrosoftTrustedRoot ( string path )
3131 {
32+ var certContentType = X509Certificate2 . GetCertContentType ( path ) ;
33+ if ( certContentType != X509ContentType . Authenticode )
34+ {
35+ throw new CryptographicException ( $ "Unexpected certificate content type, got '{ certContentType } ' instead of Authenticode.") ;
36+ }
37+
3238 // Create an X509Certificate2 instance so we can access the certificate context and create a chain context.
33- #pragma warning disable SYSLIB0057 // can't use X509CertificateLoader here since it tries to parse the file as a certificate
39+ #pragma warning disable SYSLIB0057 // we need Authenticode support which isn't available from X509CertificateLoader
3440 using X509Certificate2 certificate = new ( path ) ;
3541#pragma warning restore SYSLIB0057
3642
You can’t perform that action at this time.
0 commit comments