Ejemplo n.º 1
0
        public void Verify()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_BASE64);
            var    req     = new Pkcs10CertificateRequest(rawData);

            Assert.True(req.Verify());
        }
Ejemplo n.º 2
0
        public void Create_Attributes()
        {
            var ChallengePasswordAttribute       = new X509ChallengePasswordAttribute("password");
            var EnrollmentNameValuePairAttribute = new X509EnrollmentNameValuePairAttribute(new X509EnrollmentNameValuePairParams()
            {
                CertificateUsage = (new List <Oid>()
                {
                    new Oid("1.2.3.4"), new Oid("2.3.4")
                }).ToArray()
            });
            var EnrollmentNameValuePairAttribute2 = new X509EnrollmentNameValuePairAttribute(new X509EnrollmentNameValuePairParams()
            {
                Other = "test"
            });

            var param = new CertificateRequestParams()
            {
                Attributes = new Attribute[] { ChallengePasswordAttribute, EnrollmentNameValuePairAttribute, EnrollmentNameValuePairAttribute2 }
            };
            var key = RSA.Create();

            key.ExportParameters(true);
            var req = new Pkcs10CertificateRequest(param, key);

            Assert.True(req.Verify());
            var lapo = Convert.ToBase64String(req.RawData);
        }
Ejemplo n.º 3
0
        public void Create_without_params()
        {
            var key = RSA.Create();

            key.ExportParameters(true);
            var param = new CertificateRequestParams();
            var req   = new Pkcs10CertificateRequest(param, key);

            Assert.True(req.Verify());
        }
Ejemplo n.º 4
0
        public void Import()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_BASE64);
            var    req     = new Pkcs10CertificateRequest(rawData);

            Assert.True(req.Verify());
            Assert.Equal(0, req.Version);
            Assert.Equal("", req.Subject);
            Assert.Equal("1.2.840.113549.1.1.1", req.PublicKey.Oid.Value.ToString());
            Assert.Equal(6, req.Extensions.Count);
        }