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

            Assert.True(req.Verify());
        }
        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);
        }
        public void Export()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_BASE64);
            var    req     = new Pkcs10CertificateRequest(rawData);

            Assert.IsType <byte[]>(req.Export());
        }
        public void Attributes_Get_Double()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_DOUBLE_ATTR);
            var    req     = new Pkcs10CertificateRequest(rawData);

            Assert.Equal(3, req.Attributes.Length);
        }
        public void Attributes_Get()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_INTUNE_CHALLENGE_BASE64);
            var    req     = new Pkcs10CertificateRequest(rawData);

            Assert.Equal(6, req.Attributes.Length);
        }
        public void Version()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_BASE64);
            var    req     = new Pkcs10CertificateRequest(rawData);
            var    version = req.Version;

            Assert.IsType <int>(version);
        }
        public void PublicKey()
        {
            byte[] rawData   = Convert.FromBase64String(PKCS10_BASE64);
            var    req       = new Pkcs10CertificateRequest(rawData);
            var    publicKey = req.PublicKey;

            Assert.NotNull(publicKey);
            Assert.IsType <PublicKey>(publicKey);
        }
        public void SignatureAlgorithm()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_BASE64);
            var    req     = new Pkcs10CertificateRequest(rawData);
            var    subject = req.SignatureAlgorithm;

            Assert.NotNull(subject);
            Assert.IsType <Oid>(subject);
        }
        public void Subject()
        {
            byte[] rawData = Convert.FromBase64String(PKCS10_BASE64);
            var    req     = new Pkcs10CertificateRequest(rawData);
            var    subject = req.Subject;

            Assert.NotNull(subject);
            Assert.IsType <string>(subject);
        }
예제 #10
0
        public void Extension_TemplateV1()
        {
            byte[] rawData  = Convert.FromBase64String(PKCS10_TEMPLATE_V1_BASE64);
            var    req      = new Pkcs10CertificateRequest(rawData);
            var    template = (X509TemplateExtensionV1)req.GetExtension(OidExtensions.TemplateV1);

            Assert.Equal(new Oid(OidExtensions.TemplateV1).Value, template.Oid.Value);
            Assert.Equal("CodeSigning", template.CertificateTemplate);
        }
예제 #11
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());
        }
예제 #12
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);
        }
예제 #13
0
        public void Extension_TemplateV2()
        {
            byte[] rawData  = Convert.FromBase64String(PKCS10_BASE64);
            var    req      = new Pkcs10CertificateRequest(rawData);
            var    template = (X509TemplateExtensionV2)req.GetExtension(OidExtensions.TemplateV2);

            Assert.Equal(new Oid(OidExtensions.TemplateV2).Value, template.Oid.Value);
            Assert.Equal(100, template.MajorVersion);
            Assert.Equal(6, template.MinorVersion);
            Assert.NotNull(template.Id);
            Assert.IsType <Oid>(template.Oid);
        }