Exemplo n.º 1
0
        public void ShouldSignExeWithECDsaSigningCertificates_Sha256FileDigest(string certificate)
        {
            var signingCert = new X509Certificate2(certificate, "test", X509KeyStorageFlags.EphemeralKeySet);
            var signer      = new AuthenticodeKeyVaultSigner(signingCert.GetECDsaPrivateKey(), signingCert, HashAlgorithmName.SHA256, TimeStampConfiguration.None);
            var fileToSign  = GetFileToSign();
            var result      = signer.SignFile(fileToSign, null, null, null);

            Assert.Equal(0, result);
        }
Exemplo n.º 2
0
        public void ShouldSignExeWithRSASigningCertificates_Sha256FileDigest_WithTimestamps(string certificate)
        {
            var signingCert     = new X509Certificate2(certificate, "test", X509KeyStorageFlags.EphemeralKeySet);
            var timestampConfig = new TimeStampConfiguration("http://timestamp.digicert.com", HashAlgorithmName.SHA256, TimeStampType.RFC3161);
            var signer          = new AuthenticodeKeyVaultSigner(signingCert.GetRSAPrivateKey(), signingCert, HashAlgorithmName.SHA256, timestampConfig);
            var fileToSign      = GetFileToSign();
            var result          = signer.SignFile(fileToSign, null, null, null);

            Assert.Equal(0, result);
        }