Пример #1
0
        public CertificateRequest
        (
            CertificateSubject subject,
            CipherAlgorithm cipher = CipherAlgorithm.ECDH,
            int keySize            = 384
        )
        {
            CertificateRequestValidation requestValidation = new CertificateRequestValidation();

            if (!requestValidation.IsValidKeySize(cipher, keySize))
            {
                throw new KeySizeUnsupportedException(String.Format("The keysize specified '{0}' is not supported by the specified algorithm '{1}'", keySize, cipher));
            }


            Subject                = subject ?? throw new ArgumentNullException(nameof(subject));
            CipherAlgorithm        = cipher;
            KeySize                = keySize;
            ManagedPrivateKey      = true;
            SigningRequestProtocol = SigningRequestProtocol.Pkcs10;
        }
 public Win32CertificateProvider(ICngNativeProvider cngProvider)
 {
     this.cngProvider  = cngProvider ?? throw new ArgumentNullException(nameof(cngProvider));
     secret            = new SecretKeyProvider();
     requestValidation = new CertificateRequestValidation();
 }
 public Win32CertificateProvider()
 {
     secret            = new SecretKeyProvider();
     cngProvider       = new CngNativeProviderProxy();
     requestValidation = new CertificateRequestValidation();
 }