Decrypts the specified encrypted file in the specified output file, using the
provided private key.
Decryption is be done by reading an encrypted "session key" from the encrypted
file and then decrypting using the private key of the receiver. If the session key
is successfully decrypted, then the message will be decrypted
using
SupportedStreamAlgorithms algorithm with the decrypted session
key.
Namespace: LLCryptoLib.CryptoAssembly: LLCryptoLib (in LLCryptoLib.dll) Version: 2.0.1024.0 (2.0.1024)
Syntax
C# |
---|
public void Decrypt(
FileInfo encryptedFile,
FileInfo outputFile,
RSA rsaPrivateKey
) |
Visual Basic |
---|
Public Sub Decrypt ( _
encryptedFile As FileInfo, _
outputFile As FileInfo, _
rsaPrivateKey As RSA _
) |
Visual C++ |
---|
public:
void Decrypt(
FileInfo^ encryptedFile,
FileInfo^ outputFile,
RSA^ rsaPrivateKey
) |
Parameters
- encryptedFile
- Type: System.IO..::..FileInfo
The encrypted file.
- outputFile
- Type: System.IO..::..FileInfo
The output file.
- rsaPrivateKey
- Type: System.Security.Cryptography..::..RSA
The RSA private key.
Examples
CopyC#
string storeName = "MyCA";
string certificateName = "Alice";
RSA privateKey = AsymmetricCrypter.LoadPrivateKey(StoreLocation.CurrentUser, storeName, certificateName);
AsymmetricCrypter ac = new AsymmetricCrypter(SupportedStreamAlgorithms.BLOWFISH256);
ac.Decrypt(new FileInfo(ENCRYPTED_FILE), new FileInfo(DECRYPTED_FILE), privateKey);
Exceptions
Exception | Condition |
---|
System..::..ArgumentNullException | |
System..::..ArgumentException | Input file does not exist. |
See Also