C#: RSACryptoServiceProvider Encrypt and VerifyData?
here are my methods for encrypting and decrypting data using RSA:
private RSACryptoServiceProvider _RSACSP { get; set; }
public byte[] Encrypt(byte[] value, bool doOAEPPadding)
{
try
{
return (this._RSACSP.Encrypt(value, doOAEP开发者_运维技巧Padding));
}
catch
{
return (null);
}
}
public byte[] Decrypt(byte[] value, bool doOAEPPadding)
{
try
{
return (this._RSACSP.Decrypt(value, doOAEPPadding));
}
catch
{
return (null);
}
}
Now, how do I use this._RSACSP.VerifyData(...); to verify the encrypted data? I looked around and everything mentions SHA1, except I'm not even sure that's in use here.
Any help is appreciated.
You do not use (or need) it to verify the outcome of Encrypt/Decrypt.
VerifyData is used to verify a signature created with one of the SignData() overloads.
Signing data is another use of Asymmetric encryption.
加载中,请稍侯......
精彩评论