public override bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { if (hash == null) { throw new ArgumentNullException("hash"); } if (signature == null) { throw new ArgumentNullException("signature"); } if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw new ArgumentException(SR.GetString(SR.Cryptography_HashAlgorithmNameNullOrEmpty), "hashAlgorithm"); } if (padding == null) { throw new ArgumentNullException("padding"); } if (padding == RSASignaturePadding.Pkcs1) { return(NCryptNative.VerifySignaturePkcs1(KeyHandle, hash, hashAlgorithm.Name, signature)); } else if (padding == RSASignaturePadding.Pss) { return(NCryptNative.VerifySignaturePss(KeyHandle, hash, hashAlgorithm.Name, hash.Length, signature)); } else { // no other padding possibilities at present, but we might version independently from more being added. throw new CryptographicException(SR.GetString(SR.Cryptography_UnsupportedPaddingMode)); } }