示例#1
0
        /// <summary>
        /// Create CA test certificates.
        /// </summary>
        private async Task CreateCATestCerts(string tempStorePath)
        {
            Assert.IsTrue(EraseStore(tempStorePath));

            string           subjectName = "CN=CA Test Cert, O=OPC Foundation";
            X509Certificate2 newCACert   = CertificateFactory.CreateCertificate(
                null, null, subjectName, null)
                                           .SetCAConstraint()
                                           .CreateForRSA()
                                           .AddToStore(CertificateStoreType.Directory, tempStorePath);

            _caCert = newCACert;

            // initialize cert revocation list (CRL)
            X509CRL newCACrl = await CertificateGroup.RevokeCertificateAsync(tempStorePath, newCACert);

            _caCrl = newCACrl;
        }
示例#2
0
        /// <summary>
        /// Create CA test certificates.
        /// </summary>
        private async Task CreateCATestCerts(string tempStorePath)
        {
            Assert.IsTrue(EraseStore(tempStorePath));

            string           subjectName = "CN=CA Test Cert, O=OPC Foundation";
            X509Certificate2 newCACert   = CertificateFactory.CreateCertificate(
                CertificateStoreType.Directory, tempStorePath, null,
                null,
                null,
                subjectName,
                null,
                CertificateFactory.DefaultKeySize,
                DateTime.UtcNow,
                CertificateFactory.DefaultLifeTime,
                CertificateFactory.DefaultHashSize,
                true);

            _caCert = newCACert;

            // initialize cert revocation list (CRL)
            X509CRL newCACrl = await CertificateGroup.RevokeCertificateAsync(tempStorePath, newCACert);

            _caCrl = newCACrl;
        }