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
29
29
/// <remarks>This method does not perform any other chain validation like revocation checks, timestamping, etc.</remarks>
30
30
internal static unsafe int HasMicrosoftTrustedRoot ( string path )
31
31
{
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
+
32
38
// 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
34
40
using X509Certificate2 certificate = new ( path ) ;
35
41
#pragma warning restore SYSLIB0057
36
42
You can’t perform that action at this time.
0 commit comments