Planet Quantum News Up
 Contents   News   View 

Jan 26, 2014 - Self-Signed Certificate Previous Next

Hello from PLANETQUANTUM.COM . :-)

Below, we use Quantum and the .NET BouncyCastle security library to create a self-signed certificate. Our generated certificate is shown in Microsoft Certificate Wizard at the end.



C:\Temp>qconsole
>RsaKeyPairGenerator
Org.BouncyCastle.Crypto.Generators.RsaKeyPairGenerator
>(Setq keyGenerator (New RsaKeyPairGenerator))
Org.BouncyCastle.Crypto.Generators.RsaKeyPairGenerator
>(Setq keyParameters (New RsaKeyGenerationParameters (BigInteger.ValueOf 0x101) (New SecureRandom) 2048 30))
Org.BouncyCastle.Crypto.Parameters.RsaKeyGenerationParameters
>(keyGenerator.Init keyParameters)
NULL
>(Setq keyPair (keyGenerator.GenerateKeyPair))
Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair
>(Setq issuer (New X509Name "CN=Planet Quantum"))
CN=Planet Quantum
>(Setq cerGenerator (New X509V3CertificateGenerator))
Org.BouncyCastle.X509.X509V3CertificateGenerator
>(Setq now DateTime.Now)
1/26/2014 8:27:36 PM
>(Setq yearAfter (now.AddYears 1))
1/26/2015 8:27:36 PM
>(cerGenerator.SetIssuerDN issuer)
NULL
>(cerGenerator.SetNotBefore now)
NULL
>(cerGenerator.SetNotAfter yearAfter)
NULL
>(cerGenerator.SetPublicKey keyPair.Public)
NULL
>(cerGenerator.SetSerialNumber BigInteger.One)
NULL
>(cerGenerator.SetSignatureAlgorithm "SHA512withRSAEncryption")
NULL
>(cerGenerator.SetSubjectDN issuer)
NULL
>(Setq certificate (cerGenerator.Generate keyPair.Private))
[0]         Version: 3
       SerialNumber: 1
           IssuerDN: CN=Planet Quantum
         Start Date: 1/26/2014 8:27:36 PM
         Final Date: 1/26/2015 8:27:36 PM
          SubjectDN: CN=Planet Quantum
         Public Key: Org.BouncyCastle.Crypto.Parameters.RsaKeyParameters
Signature Algorithm: SHA-512withRSA
          Signature: 824d77b0dfbfa4358af80601617f932f68e39c07
                     fca9fff1221eb455475433702a22bb4f45f5b521
                     689c1baaa8849a8e9412793c5f859a3c595c5bd7
                     ce8d8e609c7a489bede16021e0157728a63898b4
                     6ad6736a412594e083f9f204e5ce0d8212c0928f
                     55b364b3ac50ab9d446e7c84d6a22d423d9f9699
                     7ce42cf95443efedad18635e2627c04ad3109f1f
                     25d3752465d75fd0af34cb8bc07ac9b249dd1aa1
                     0df6203064ec0892b8a42a2649515f164de1e3fc
                     f1cc2e947fbc31147e08f473b0585e026b1e8ff0
                     8fa36306791ade1aefeaf13cdf34b598e83918ae
                     e1e98e424f9bfbf64ed7aee17da2e12edf62847f
                     74e01bf69346ce72b0d1e0ae1661901b
>(File.WriteAllBytes "C:\\Temp\\SelfSigned.cer" (certificate.CertificateStructure.GetEncoded))
NULL
>



140126.txt



©2004-2018 Planet Quantum Kelly Roach