Decrypt a message encrypted using an RSA encryption scheme.
Namespace: CryptoSysPKIAssembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.30549 (23.1.0.0)
Syntaxpublic static byte[] Decrypt(
byte[] data,
string privateKeyFile,
string password = "",
RsaEME method = RsaEME.PKCSv1_5,
RsaHashAlg hashAlg = RsaHashAlg.Sha1,
RsaAdvOptions advOpts = RsaAdvOptions.Default
)
Public Shared Function Decrypt (
data As Byte(),
privateKeyFile As String,
Optional password As String = "",
Optional method As RsaEME = RsaEME.PKCSv1_5,
Optional hashAlg As RsaHashAlg = RsaHashAlg.Sha1,
Optional advOpts As RsaAdvOptions = RsaAdvOptions.Default
) As Byte()
Parameters
- data Byte
- Data to be decrypted (must be exactly the same length as the key modulus size).
- privateKeyFile String
- Name of the private key file, or a string containing the key in PEM format, or a valid internal private key string.
- password String (Optional)
- Password for encrypted private key, or "" if password is not required.
- method RsaEME (Optional)
- Encoding method [optional, default = EME.PKCSv1_5]
- hashAlg RsaHashAlg (Optional)
- Hash function for EME-OAEP encoding, otherwise ignored.
- advOpts RsaAdvOptions (Optional)
- Advanced options for EME-OEAP only.
Return Value
ByteDecrypted data.
RemarksFor RSA-OAEP you must set the correct options to match the parameters used for the encryption.
See Also