Ejemplo n.º 1
0
        /// <summary>
        /// Create the ContentType MIME header for a Signed MIME entity
        /// </summary>
        /// <param name="digestAlgorithm">Digest algorithm being used, such as SHA1</param>
        /// <returns>ContentType header</returns>
        public static ContentType CreateContentType(DigestAlgorithm digestAlgorithm)
        {
            ContentType contentType = new ContentType(SMIMEStandard.MultiPartTypeSigned);

            contentType.Parameters.Add(SMIMEStandard.ProtocolParameterKey, SMIMEStandard.SignatureProtocol);
            contentType.Parameters.Add(SMIMEStandard.MICAlgorithmKey, SMIMEStandard.ToString(digestAlgorithm));
            return(contentType);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Transforms the <paramref name="algorithm"/> to a string suitable for the <c>micalg</c> parameter value
 /// </summary>
 /// <param name="algorithm">The digest algorithm to transform</param>
 /// <returns>A string suitable for the value of the <c>micalg</c> parameter</returns>
 public static string AsString(this DigestAlgorithm algorithm)
 {
     return(SMIMEStandard.ToString(algorithm));
 }