Exemplo n.º 1
0
 public static byte[] SHACalculate(ArraySegment <byte> data, SecurityPolicy policy)
 {
     using (System.Security.Cryptography.HashAlgorithm hashAlgorithm = UASecurity.HashAlgorithmForSecurityPolicy(policy))
     {
         return(hashAlgorithm.ComputeHash(data.Array, data.Offset, data.Count));
     }
 }
Exemplo n.º 2
0
 public static byte[] SHACalculate(byte[] data, SecurityPolicy policy)
 {
     using (System.Security.Cryptography.HashAlgorithm hashAlgorithm = UASecurity.HashAlgorithmForSecurityPolicy(policy))
     {
         return(hashAlgorithm.ComputeHash(data));
     }
 }
Exemplo n.º 3
0
 public static bool RsaPkcs15Sha_VerifySigned(
     ArraySegment <byte> data,
     byte[] signature,
     X509Certificate2 cert,
     SecurityPolicy policy)
 {
     return((cert.PublicKey.Key as RSA).VerifyHash(UASecurity.HashAlgorithmForSecurityPolicy(policy).ComputeHash(data.Array, data.Offset, data.Count), signature, UASecurity.HashStrForSecurityPolicy(policy), RSASignaturePadding.Pkcs1));
 }
Exemplo n.º 4
0
 public static byte[] RsaPkcs15Sha_Sign(
     ArraySegment <byte> data,
     RSA privProvider,
     SecurityPolicy policy)
 {
     byte[] hash = UASecurity.HashAlgorithmForSecurityPolicy(policy).ComputeHash(data.Array, data.Offset, data.Count);
     return(privProvider.SignHash(hash, UASecurity.HashStrForSecurityPolicy(policy), RSASignaturePadding.Pkcs1));
 }