Beispiel #1
0
 public static void SetCertDigest(byte[] rawCert, string digestAlgorithm, DigestAlgAndValueType destination)
 {
     using (var hashAlg = GetHashAlg(digestAlgorithm))
     {
         destination.DigestMethod.Algorithm = digestAlgorithm;
         destination.DigestValue            = hashAlg.ComputeHash(rawCert);
     }
 }
Beispiel #2
0
 public static void SetCertDigest(byte[] rawCert, string digestAlgorithm, DigestAlgAndValueType destination)
 {
     using (var hashAlg = GetHashAlg(digestAlgorithm))
     {
         destination.DigestMethod.Algorithm = "http://www.w3.org/2000/09/xmldsig#sha1"; //digestAlgorithm;
         destination.DigestValue            = hashAlg.ComputeHash(rawCert);
     }
 }
Beispiel #3
0
        public static void SetCertDigest(byte[] rawCert, DigestMethod digestMethod, DigestAlgAndValueType destination)
        {
            string digestAlgorithm = null;

            switch (digestMethod)
            {
            case DigestMethod.SHA1:
                digestAlgorithm = FirmaXades.SHA1Uri;
                break;

            case DigestMethod.SHA256:
                digestAlgorithm = FirmaXades.SHA256Uri;
                break;

            case DigestMethod.SHA512:
                digestAlgorithm = FirmaXades.SHA512Uri;
                break;
            }

            SetCertDigest(rawCert, digestAlgorithm, destination);
        }
Beispiel #4
0
 public static void SetCertDigest(byte[] rawCert, FirmaXadesNet.Crypto.DigestMethod digestMethod, DigestAlgAndValueType destination)
 {
     using (var hashAlg = digestMethod.GetHashAlgorithm())
     {
         destination.DigestMethod.Algorithm = digestMethod.URI;
         destination.DigestValue            = hashAlg.ComputeHash(rawCert);
     }
 }