diff options
Diffstat (limited to 'crypto/test/src')
-rw-r--r-- | crypto/test/src/test/TestUtilities.cs | 142 | ||||
-rw-r--r-- | crypto/test/src/test/X509CertificatePairTest.cs | 26 |
2 files changed, 0 insertions, 168 deletions
diff --git a/crypto/test/src/test/TestUtilities.cs b/crypto/test/src/test/TestUtilities.cs index 5835784e9..be983637c 100644 --- a/crypto/test/src/test/TestUtilities.cs +++ b/crypto/test/src/test/TestUtilities.cs @@ -109,147 +109,5 @@ namespace Org.BouncyCastle.Tests return crlGen.Generate(new Asn1SignatureFactory("SHA256WithRSAEncryption", caKey, null)); } - - public static X509Certificate CreateExceptionCertificate( - bool exceptionOnEncode) - { - return new ExceptionCertificate(exceptionOnEncode); - } - - private class ExceptionCertificate - : X509Certificate - { - private bool _exceptionOnEncode; - - public ExceptionCertificate( - bool exceptionOnEncode) - { - _exceptionOnEncode = exceptionOnEncode; - } - - public override void CheckValidity() - { - throw new CertificateNotYetValidException(); - } - - public override void CheckValidity( - DateTime date) - { - throw new CertificateExpiredException(); - } - - public override int Version - { - get { return 0; } - } - - public override BigInteger SerialNumber - { - get { return null; } - } - - public override X509Name IssuerDN - { - get { return null; } - } - - public override X509Name SubjectDN - { - get { return null; } - } - - public override DateTime NotBefore - { - get { return DateTime.MaxValue; } - } - - public override DateTime NotAfter - { - get { return DateTime.MinValue; } - } - - public override byte[] GetTbsCertificate() - { - throw new CertificateEncodingException(); - } - - public override byte[] GetSignature() - { - return new byte[0]; - } - - public override string SigAlgName - { - get { return null; } - } - - public override string SigAlgOid - { - get { return null; } - } - - public override byte[] GetSigAlgParams() - { - return new byte[0]; - } - - public override DerBitString IssuerUniqueID - { - get { return null; } - } - - public override DerBitString SubjectUniqueID - { - get { return null; } - } - - public override bool[] GetKeyUsage() - { - return new bool[0]; - } - - public override int GetBasicConstraints() - { - return 0; - } - - public override byte[] GetEncoded() - { - if (_exceptionOnEncode) - throw new CertificateEncodingException(); - - return new byte[0]; - } - - public override void Verify(AsymmetricKeyParameter key) - { - throw new CertificateException(); - } - - public override string ToString() - { - return null; - } - - public override AsymmetricKeyParameter GetPublicKey() - { - return null; - } - - public override ISet<string> GetCriticalExtensionOids() - { - return null; - } - - public override ISet<string> GetNonCriticalExtensionOids() - { - return null; - } - - public override Asn1OctetString GetExtensionValue(DerObjectIdentifier oid) - { - return null; - } - } } } diff --git a/crypto/test/src/test/X509CertificatePairTest.cs b/crypto/test/src/test/X509CertificatePairTest.cs index ac6966150..71a0887f3 100644 --- a/crypto/test/src/test/X509CertificatePairTest.cs +++ b/crypto/test/src/test/X509CertificatePairTest.cs @@ -99,32 +99,6 @@ namespace Org.BouncyCastle.Tests { Fail("encoding check"); } - - pair4 = new X509CertificatePair(rootCert, TestUtilities.CreateExceptionCertificate(false)); - - try - { - pair4.GetEncoded(); - - Fail("no exception on bad GetEncoded()"); - } - catch (CertificateEncodingException) - { - // expected - } - - pair4 = new X509CertificatePair(rootCert, TestUtilities.CreateExceptionCertificate(true)); - - try - { - pair4.GetEncoded(); - - Fail("no exception on exception GetEncoded()"); - } - catch (CertificateEncodingException) - { - // expected - } } public override string Name |