diff options
author | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 14:25:40 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 14:25:40 +0700 |
commit | d2c5b877bf9dad0ef9b393af2c17a6445780f0c4 (patch) | |
tree | b95ffdebbb8dcfc175530d9281baa1b77b035e9b /crypto/test/src/x509 | |
parent | ObsoleteAttribute cleanup (diff) | |
download | BouncyCastle.NET-ed25519-d2c5b877bf9dad0ef9b393af2c17a6445780f0c4.tar.xz |
ObsoleteAttribute cleanup
Diffstat (limited to 'crypto/test/src/x509')
-rw-r--r-- | crypto/test/src/x509/test/TestCertificateGen.cs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/crypto/test/src/x509/test/TestCertificateGen.cs b/crypto/test/src/x509/test/TestCertificateGen.cs index 491f6d312..33ddc26c0 100644 --- a/crypto/test/src/x509/test/TestCertificateGen.cs +++ b/crypto/test/src/x509/test/TestCertificateGen.cs @@ -1,12 +1,12 @@ using System; using System.Collections; -using System.Text; using NUnit.Framework; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Asn1.X9; using Org.BouncyCastle.Crypto.Digests; +using Org.BouncyCastle.Crypto.Operators; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Signers; using Org.BouncyCastle.Math; @@ -104,12 +104,11 @@ namespace Org.BouncyCastle.X509.Tests certGen.SetNotAfter(DateTime.UtcNow.AddDays(1)); certGen.SetSubjectDN(new X509Name(ord, attrs)); certGen.SetPublicKey(rsaPublic); - certGen.SetSignatureAlgorithm("MD5WithRSAEncryption"); - X509Certificate cert = certGen.Generate(rsaPrivate); + X509Certificate cert = certGen.Generate(new Asn1SignatureFactory("MD5WithRSAEncryption", rsaPrivate, null)); -// Assert.IsTrue((cert.IsValidNow && cert.Verify(rsaPublic)),"Certificate failed to be valid (RSA)"); - cert.CheckValidity(); + //Assert.IsTrue((cert.IsValidNow && cert.Verify(rsaPublic)),"Certificate failed to be valid (RSA)"); + cert.CheckValidity(); cert.Verify(rsaPublic); //Console.WriteLine(ASN1Dump.DumpAsString(cert.ToAsn1Object())); @@ -181,12 +180,11 @@ namespace Org.BouncyCastle.X509.Tests certGen.SetNotAfter(DateTime.UtcNow.AddDays(1)); certGen.SetSubjectDN(new X509Name(ord, attrs)); certGen.SetPublicKey(dsaPub); - certGen.SetSignatureAlgorithm("SHA1WITHDSA"); - X509Certificate cert = certGen.Generate(dsaPriv); + X509Certificate cert = certGen.Generate(new Asn1SignatureFactory("SHA1WITHDSA", dsaPriv, null)); -// Assert.IsTrue((cert.IsValidNow && cert.Verify(dsaPub)), "Certificate failed to be valid (DSA Test)"); - cert.CheckValidity(); + //Assert.IsTrue((cert.IsValidNow && cert.Verify(dsaPub)), "Certificate failed to be valid (DSA Test)"); + cert.CheckValidity(); cert.Verify(dsaPub); //ISet dummySet = cert.GetNonCriticalExtensionOids(); @@ -262,14 +260,13 @@ namespace Org.BouncyCastle.X509.Tests certGen.SetNotAfter(DateTime.UtcNow.AddDays(1)); certGen.SetSubjectDN(new X509Name(ord, attrs)); certGen.SetPublicKey(ecPub); - certGen.SetSignatureAlgorithm("SHA1WITHECDSA"); certGen.AddExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(false)); - X509Certificate cert = certGen.Generate(ecPriv); + X509Certificate cert = certGen.Generate(new Asn1SignatureFactory("SHA1WITHECDSA", ecPriv, null)); -// Assert.IsTrue((cert.IsValidNow && cert.Verify(ecPub)), "Certificate failed to be valid (ECDSA)"); - cert.CheckValidity(); + //Assert.IsTrue((cert.IsValidNow && cert.Verify(ecPub)), "Certificate failed to be valid (ECDSA)"); + cert.CheckValidity(); cert.Verify(ecPub); ISet extOidSet = cert.GetCriticalExtensionOids(); |