public Signature(AuthenticodeInfo authenticodeInfo) { if (authenticodeInfo != null) { IsAuthenticodeValid = authenticodeInfo.IsAuthenticodeValid; SignedHash = authenticodeInfo.SignedHash; SignerSerialNumber = authenticodeInfo.SignerSerialNumber; SigningCertificate = new SerializableCertificate(authenticodeInfo.SigningCertificate); } }
public Signature(AuthenticodeInfo authenticodeInfo) { if (authenticodeInfo != null) { IsAuthenticodeValid = authenticodeInfo.IsAuthenticodeValid; SignedHash = Convert.ToBase64String(authenticodeInfo.SignedHash); SignerSerialNumber = authenticodeInfo.SignerSerialNumber; SigningCertificate = new SerializableCertificate(authenticodeInfo.SigningCertificate); } else { IsAuthenticodeValid = false; } }
public static Signature?GetSignatureStatus(string Path) { if (!NeedsSignature(Path)) { return(null); } try { var peHeader = new PeNet.PeFile(Path); var authenticodeInfo = new AuthenticodeInfo(peHeader); var sig = new Signature(authenticodeInfo); return(sig); } catch (Exception) { } return(null); }
public Signature(AuthenticodeInfo authenticodeInfo) { if (authenticodeInfo != null) { IsAuthenticodeValid = authenticodeInfo.IsAuthenticodeValid; if (authenticodeInfo.SignedHash is byte[] hash) { SignedHash = Convert.ToBase64String(hash); } SignerSerialNumber = authenticodeInfo.SignerSerialNumber; if (authenticodeInfo.SigningCertificate is X509Certificate2 cert) { SigningCertificate = new SerializableCertificate(cert); } } else { IsAuthenticodeValid = false; } }