Skip to content

CreateForKey Method ​

Definition ​

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

EncryptionOptions CreateForKey(byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null, Encoding encoding = null) ​

csharp
EncryptionOptions CreateForKey(byte[] key, SymmetricAlgorithms algorithm = null, EncryptionPaddingMode padding = null, Encoding encoding = null)

Creates interop EncryptionOptions from a raw symmetric key. The key bytes are used directly (no derivation) and must match a legal key size for algorithm. Produces the standard, interoperable IV ‖ ciphertext layout (IV prepended, PKCS7, no MAC).

Parameters ​

NameDescription
algorithmSymmetric algorithm (default AES-256).
encodingEncoding used for string operations (default UTF-8).
keyRaw key material (e.g. 16/24/32 bytes for AES).
paddingBlock padding mode (default PKCS7 for cross-library interop).

Returns ​

A configured EncryptionOptions instance.