CryptoSys PKI Pro Manual

Rsa.Decrypt Method

Decrypt a message encrypted using an RSA encryption scheme.

Syntax

[C#]
public static byte[] Decrypt(
   byte[] data,
   string privateKeyFile,
   string password = "",
   Rsa.EME method = Rsa.EME.PKCSv1_5,
   Rsa.HashAlg hashAlg = Rsa.HashAlg.Sha1,
   Rsa.AdvOptions advOpts = Rsa.AdvOptions.Default 
)
[VB]
Public Shared Function Decrypt (
   data As Byte(),
   privateKeyFile As String,
   Optional password As String = "",
   Optional method As Rsa.EME = Rsa.EME.PKCSv1_5,
   Optional hashAlg As Rsa.HashAlg = Rsa.HashAlg.Sha1,
   Optional advOpts As Rsa.AdvOptions = Rsa.AdvOptions.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  Rsa.EME  (Optional)
Encoding method [optional, default = EME.PKCSv1_5]
hashAlg  Rsa.HashAlg  (Optional)
Hash function for EME-OAEP encoding, otherwise ignored.
advOpts  Rsa.AdvOptions  (Optional)
Advanced options for EME-OEAP only.

Return Value

Decrypted data.

Remarks

For RSA-OAEP you must set the correct options to match the parameters used for the encryption.

See Also

VB6/C equivalent: RSA_Decrypt

[Contents] [Index]

[PREV: Rsa.DecodeMsgIso9796 Method...]   [Contents]   [Index]   
   [NEXT: Rsa.EncodeDigestForSignature Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-17T11:18:15Z.