Exemplo n.º 1
0
        public X509Certificate IssueCertificate(
            string pkcs10Request,
            ExtensionBuilder extensionBuilder,
            string customDN = null
            )
        {
            Pkcs10CertificationRequest request;

            using (var _sr = new StringReader(pkcs10Request))
            {
                var pRd = new PemReader(_sr);
                request = (Pkcs10CertificationRequest)pRd.ReadObject();
                pRd.Reader.Close();
            }

            var isGost = request.SignatureAlgorithm.Algorithm.Id.Contains("1.2.643");

            PkiService service;

            if (isGost)
            {
                service = new GOSTPkiService();
            }
            else
            {
                service = new RSAPkiService();
            }

            return(service.IssueCertificate(request, extensionBuilder, customDN));
        }
Exemplo n.º 2
0
        public byte[] VerifySignature(CmsSignedData cms)
        {
            var isGost = false;

            var signer = cms.GetSignerInfos().GetSigners();

            foreach (var s in signer)
            {
                var sig = (SignerInformation)s;
                isGost = sig.DigestAlgOid.Contains("1.2.643");
            }

            PkiService service;

            if (isGost)
            {
                service = new GOSTPkiService();
            }
            else
            {
                service = new RSAPkiService();
            }

            return(service.VerifySignature(cms));
        }
Exemplo n.º 3
0
        public X509Crl CreateCrl(bool isGost = false)
        {
            PkiService service;

            if (isGost)
            {
                service = new GOSTPkiService();
            }
            else
            {
                service = new RSAPkiService();
            }

            return(service.CreateCRL());
        }