GenerateSignature() private method

private GenerateSignature ( [ email ) : string
email [
return string
Example #1
0
        public static MailMessage DomainKeySign([NotNull] this MailMessage message, DomainKeySigner signer)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            if (signer == null)
            {
                throw new ArgumentNullException("signer");
            }

            message.BodyEncoding    = signer.Encoding;
            message.SubjectEncoding = signer.Encoding;
            message.HeadersEncoding = signer.Encoding;

            var email = Email.Parse(message.GetText());

            if (!CanSign(email))
            {
                throw new InvalidOperationException("Unable to Domain Key sign the message");
            }

            var sig = signer.GenerateSignature(email);

            message.Headers.Prepend(DomainKeySigner.SignatureKey, sig);

            return(message);
        }
Example #2
0
        public static MailMessage DomainKeySign([NotNull]this MailMessage message, DomainKeySigner signer)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            if (signer == null)
            {
                throw new ArgumentNullException("signer");
            }

            message.BodyEncoding = signer.Encoding;
            message.SubjectEncoding = signer.Encoding;
            message.HeadersEncoding = signer.Encoding;

            var email = Email.Parse(message.GetText());

            if(!CanSign(email))
            {
                throw new InvalidOperationException("Unable to Domain Key sign the message");
            }

            var sig = signer.GenerateSignature(email);

            message.Headers.Prepend(DomainKeySigner.SignatureKey, sig);

            return message;
        }