Appearance
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
| Name | Description |
|---|---|
algorithm | Symmetric algorithm (default AES-256). |
encoding | Encoding used for string operations (default UTF-8). |
key | Raw key material (e.g. 16/24/32 bytes for AES). |
padding | Block padding mode (default PKCS7 for cross-library interop). |
Returns
A configured EncryptionOptions instance.