Skip to content

Decrypt Method ​

Definition ​

  • Namespace: JASE.Crypto
  • Assembly: JASE.Crypto.dll

Overloads ​

NameDescription
byte[] Decrypt(byte[] encryptedData, AesGcmOptions options)Decrypts a byte array using AES-GCM with the provided associated AesGcmOptions
string Decrypt(string input, AesGcmOptions options)Decrypts a Base64 encoded string using AES-GCM with the provided associated AesGcmOptions
byte[] Decrypt(byte[] encryptedData, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)Decrypts a byte array using AES-GCM with the given key and optional associated metadata.
byte[] Decrypt(byte[] input, string passPhrase, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)Decrypts a self-describing JASE envelope using only a passphrase. The salt, iteration count, hash and KDF algorithm are read from the envelope itself, so no salt argument is required.
string Decrypt(string input, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)Decrypts a string using AES-GCM with the given key and optional associated metadata.
string Decrypt(string base64input, string passPhrase, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)Decrypts a self-describing JASE envelope using only a passphrase. The salt, iteration count, hash and KDF algorithm are read from the envelope itself, so no salt argument is required.
byte[] Decrypt(byte[] input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.
byte[] Decrypt(byte[] input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.
string Decrypt(string base64input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.
string Decrypt(string base64input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.

byte[] Decrypt(byte[] encryptedData, AesGcmOptions options) ​

csharp
byte[] Decrypt(byte[] encryptedData, AesGcmOptions options)

Decrypts a byte array using AES-GCM with the provided associated AesGcmOptions

byte[] Decrypt(byte[] encryptedData, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null) ​

csharp
byte[] Decrypt(byte[] encryptedData, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)

Decrypts a byte array using AES-GCM with the given key and optional associated metadata.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata for the decryption.
encryptedDataThe encrypted input data as a byte array.
keyThe encryption key.

Returns ​

The decrypted data as a byte array.

byte[] Decrypt(byte[] input, string passPhrase, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null) ​

csharp
byte[] Decrypt(byte[] input, string passPhrase, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)

Decrypts a self-describing JASE envelope using only a passphrase. The salt, iteration count, hash and KDF algorithm are read from the envelope itself, so no salt argument is required.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata that was bound at encrypt time.
encodingOptional encoding for string conversions (default is UTF-8).
formatEnvelope format. Must be a self-describing format (default: JaseV1).
inputThe encrypted input data as a byte[].
passPhraseThe passphrase used to derive the encryption key.

Returns ​

The decrypted data as a byte array.

byte[] Decrypt(byte[] input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null) ​

csharp
byte[] Decrypt(byte[] input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)

Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata for the decryption.
encodingOptional encoding for string conversions (default is UTF-8).
inputThe encrypted input data as a byte[]
iterationsThe number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults.
passPhraseThe passphrase used to derive the encryption key.
saltThe salt used to derive the encryption key.

Returns ​

The decrypted string.

byte[] Decrypt(byte[] input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null) ​

csharp
byte[] Decrypt(byte[] input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)

Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata for the decryption.
encodingOptional encoding for string conversions (default is UTF-8).
inputThe encrypted input data as a byte[].
iterationsThe number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults.
passPhraseThe passphrase used to derive the encryption key.
saltThe salt used to derive the encryption key.

Returns ​

The decrypted string.

string Decrypt(string input, AesGcmOptions options) ​

csharp
string Decrypt(string input, AesGcmOptions options)

Decrypts a Base64 encoded string using AES-GCM with the provided associated AesGcmOptions

string Decrypt(string input, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null) ​

csharp
string Decrypt(string input, byte[] key, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)

Decrypts a string using AES-GCM with the given key and optional associated metadata.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata for the decryption.
encodingOptional encoding for string conversions (default is UTF-8).
inputThe encrypted input data as a string.
keyThe encryption key.

Returns ​

The decrypted string.

string Decrypt(string base64input, string passPhrase, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null) ​

csharp
string Decrypt(string base64input, string passPhrase, byte[] associatedMetaData = null, Encoding encoding = null, AesEnvelopeFormat? format = null)

Decrypts a self-describing JASE envelope using only a passphrase. The salt, iteration count, hash and KDF algorithm are read from the envelope itself, so no salt argument is required.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata that was bound at encrypt time.
base64inputThe encrypted input data as a Base64 encoded string.
encodingOptional encoding for string conversions (default is UTF-8).
formatEnvelope format. Must be a self-describing format (default: JaseV1).
passPhraseThe passphrase used to derive the encryption key.

Returns ​

The decrypted string.

string Decrypt(string base64input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null) ​

csharp
string Decrypt(string base64input, string passPhrase, string salt, byte[] associatedMetaData = null, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)

Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata for the decryption.
base64inputThe encrypted input data as a Base64 encoded string.
encodingOptional encoding for string conversions (default is UTF-8).
iterationsThe number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults.
passPhraseThe passphrase used to derive the encryption key.
saltThe salt used to derive the encryption key.

Returns ​

The decrypted string.

string Decrypt(string base64input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null) ​

csharp
string Decrypt(string base64input, string passPhrase, string salt, string associatedMetaData, Encoding encoding = null, int iterations = null, AesEnvelopeFormat? format = null)

Decrypts a Base64 encoded string using AES-GCM and a passphrase and salt.

Parameters ​

NameDescription
associatedMetaDataOptional associated metadata for the decryption.
base64inputThe encrypted input data as a Base64 encoded string.
encodingOptional encoding for string conversions (default is UTF-8).
iterationsThe number of iterations used in the PBKDF2 algorithm. Higher values increase brute-force cost at the expense of CPU time. The default is 210,000 (DEFAULT_ITERATIONS), matching library-wide PBKDF2 defaults.
passPhraseThe passphrase used to derive the encryption key.
saltThe salt used to derive the encryption key.

Returns ​

The decrypted string.