Crypto provider for digital signature algorithms. The chief reason this is necessary is the excrable nature of the .NET APIs in which the base class does not expose methods such as sign.
상속: CryptoProviderAsymmetric
예제 #1
0
 /// <summary>
 /// Sign the request
 /// </summary>
 /// <param name="SigningKey"></param>
 public void Sign(CryptoProviderSignature SigningKey) {
     SignatureAlgorithm = new AlgorithmIdentifier(SigningKey.OID);
     var SignatureData = SigningKey.Sign(CertificationRequestInfo.DER());
     Signature = SignatureData.Integrity;
     }
예제 #2
0
        /// <summary>
        /// Create a certificate with the specified subject Key. Note that the template is 
        /// must be completed with calls to set validity etc. before use.
        /// </summary>
        /// <param name="SubjectKey">Cryptographic provider for the subject key.</param>
        /// <param name="Application">Certificate application(s).</param>
        public Certificate(CryptoProvider SubjectKey, Application Application) {
            _KeyPair = SubjectKey.KeyPair;
            if (SubjectKey as CryptoProviderSignature != null) {
                _CryptoProviderSignature = SubjectKey as CryptoProviderSignature;
                }
            if (SubjectKey as CryptoProviderExchange != null) {
                _CryptoProviderExchange = SubjectKey as CryptoProviderExchange;
                }

            var SubjectName = new Name(SubjectKey).ToList();
            TBSCertificate = new TBSCertificate(SubjectKey.KeyPair, SubjectName);
            }
예제 #3
0
        /// <summary>
        /// Sign certificate.
        /// </summary>
        /// <param name="Signer">Cryptographic provider for the signer.</param>
        public void Sign(CryptoProviderSignature Signer) {

            TBSCertificate.Signature = new AlgorithmIdentifier(Signer.OID);
            SignatureAlgorithm = TBSCertificate.Signature;

            var Data = TBSCertificate.DER();
            var SignatureData = Signer.Sign(Data);
            Signature = SignatureData.Integrity;

            _Data = this.DER();
            }
예제 #4
0
        /// <summary>
        /// Initialize the alg and kid parameters to match the specified 
        /// signature provider.
        /// </summary>
        /// <param name="SignatureProvider"></param>
        public SignatureHeader(CryptoProviderSignature SignatureProvider) {
            kid = SignatureProvider.UDF;
            alg = SignatureProvider.JSONName;

            }