Пример #1
0
            public void PublicKeyOnlyCorrectlyParses()
            {
                var cert       = RSACertificateBuilder.CreateNewCertificate("Test");
                var data       = cert.Export(X509ContentType.Cert);
                var publicCert = new X509Certificate2(data);

                var cng = RSACertificateParser.ParsePublicCertificate(publicCert);

                Assert.IsNotNull(cng);
            }
Пример #2
0
            public void KeySize2048CertificateCorrectlyParses()
            {
                var options = new RSACertificateBuilderOptions
                {
                    FullSubjectName = "CN=Test",
                    KeySize         = 2048
                };

                var cert = RSACertificateBuilder.CreateNewCertificate(options);
                var cng  = RSACertificateParser.ParsePublicCertificate(cert);

                Assert.IsNotNull(cng);
            }
Пример #3
0
        /// <summary>
        /// Create an AES key that is encrypted using a RSA certificate
        /// </summary>
        /// <param name="keySize">Required AES key size</param>
        /// <param name="rsaPublicCert">RSA public certificate used to sign</param>
        /// <returns>data that can be stored</returns>
        public static byte[] CreateBlob(AESKeySize keySize, X509Certificate2 rsaPublicCert)
        {
            var cert = RSACertificateParser.ParsePublicCertificate(rsaPublicCert);

            return(CreateBlob(keySize, cert));
        }