Skip to content

Encrypt Method ​

Definition ​

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

Overloads ​

NameDescription
byte[] Encrypt(byte[] data, byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)Encrypts data with a raw key, producing the interoperable IV ‖ ciphertext layout.
string Encrypt(string data, byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)Encrypts a string with a raw key, returning Base64 of the interoperable IV ‖ ciphertext layout.

byte[] Encrypt(byte[] data, byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null) ​

csharp
byte[] Encrypt(byte[] data, byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)

Encrypts data with a raw key, producing the interoperable IV ‖ ciphertext layout.

Parameters ​

NameDescription
algorithmSymmetric algorithm (default AES-256).
dataThe plaintext to encrypt.
keyRaw key material (legal key size for algorithm).
paddingBlock padding mode (default PKCS7).

Returns ​

Ciphertext as IV ‖ ciphertext.

string Encrypt(string data, byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null) ​

csharp
string Encrypt(string data, byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null)

Encrypts a string with a raw key, returning Base64 of the interoperable IV ‖ ciphertext layout.

Parameters ​

NameDescription
algorithmSymmetric algorithm (default AES-256).
dataThe plaintext string to encrypt.
keyRaw key material (legal key size for algorithm).
paddingBlock padding mode (default PKCS7).

Returns ​

Base64-encoded ciphertext.