Skip to content

Commit

Permalink
Change mechanism to retreive the certificate from assembly (#10301) (#…
Browse files Browse the repository at this point in the history
…10303)

(cherry picked from commit 767577c)
  • Loading branch information
saintentropy authored and QilongTang committed Jan 16, 2020
1 parent d14a322 commit 88eff57
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/DynamoUtilities/CertificateVerification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -37,7 +38,17 @@ public static bool CheckAssemblyForValidCertificate(string assemblyPath)
}

//Verify the node library has a verified signed certificate
var cert = asm.Modules.FirstOrDefault()?.GetSignerCertificate();
X509Certificate cert;
try
{
cert = X509Certificate.CreateFromSignedFile(assemblyPath);
}
catch
{
throw new Exception(String.Format(
"A dll file found at {0} did not have a certificate attached.", assemblyPath));
}

if (cert != null)
{
var cert2 = new System.Security.Cryptography.X509Certificates.X509Certificate2(cert);
Expand Down

0 comments on commit 88eff57

Please sign in to comment.