internal RsaesOaepParameters GetRsaesOaepParameters()
        {
            if (OaepHashAlgorithm == DigestAlgorithm.Sha1)
            {
                return(new RsaesOaepParameters());
            }

            var oid             = SecureMimeContext.GetDigestOid(OaepHashAlgorithm);
            var hashAlgorithm   = new AlgorithmIdentifier(new DerObjectIdentifier(oid), DerNull.Instance);
            var maskGenFunction = new AlgorithmIdentifier(PkcsObjectIdentifiers.IdMgf1, hashAlgorithm);

            return(new RsaesOaepParameters(hashAlgorithm, maskGenFunction, RsaesOaepParameters.DefaultPSourceAlgorithm));
        }
Beispiel #2
0
        public SystemSecuritySigner(DkimSignatureAlgorithm algorithm, AsymmetricAlgorithm key)
        {
            rsa = key as RSACryptoServiceProvider;

            switch (algorithm)
            {
            case DkimSignatureAlgorithm.RsaSha256:
                oid           = SecureMimeContext.GetDigestOid(DigestAlgorithm.Sha256);
                AlgorithmName = "RSASHA256";
                hash          = SHA256.Create();
                break;

            default:
                oid           = SecureMimeContext.GetDigestOid(DigestAlgorithm.Sha1);
                AlgorithmName = "RSASHA1";
                hash          = SHA1.Create();
                break;
            }
        }