private void TbsV1CertGenerate() { V1TbsCertificateGenerator gen = new V1TbsCertificateGenerator(); DateTime startDate = MakeUtcDateTime(1970, 1, 1, 0, 0, 1); DateTime endDate = MakeUtcDateTime(1970, 1, 1, 0, 0, 12); gen.SetSerialNumber(new DerInteger(1)); gen.SetStartDate(new Time(startDate)); gen.SetEndDate(new Time(endDate)); gen.SetIssuer(new X509Name("CN=AU,O=Bouncy Castle")); gen.SetSubject(new X509Name("CN=AU,O=Bouncy Castle,OU=Test 1")); gen.SetSignature(new AlgorithmIdentifier(PkcsObjectIdentifiers.MD5WithRsaEncryption, DerNull.Instance)); SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PkcsObjectIdentifiers.RsaEncryption, DerNull.Instance), new RsaPublicKeyStructure(BigInteger.One, BigInteger.Two)); gen.SetSubjectPublicKeyInfo(info); TbsCertificateStructure tbs = gen.GenerateTbsCertificate(); if (!Arrays.AreEqual(tbs.GetEncoded(), v1Cert)) { Fail("failed v1 cert generation"); } // // read back test // Asn1InputStream aIn = new Asn1InputStream(v1Cert); Asn1Object o = aIn.ReadObject(); if (!Arrays.AreEqual(o.GetEncoded(), v1Cert)) { Fail("failed v1 cert read back test"); } }
/// <summary> /// Reset the generator. /// </summary> public void Reset() { tbsGen = new V1TbsCertificateGenerator(); }
/// <summary> /// Default Constructor. /// </summary> public X509V1CertificateGenerator() { tbsGen = new V1TbsCertificateGenerator(); }
/// <summary> /// Default Constructor. /// </summary> public V1CertGen() { tbsGen = new V1TbsCertificateGenerator(); }