Encrypt Method
Encrypt(byte[], int, int)
Returns the AES-256-CBC encryption of plaintext using an IV specified by the protocol and the EncryptionKey. With protocol 1 the IV is all 00 bytes. With protocol 2, it is a new, random value.
C#
public abstract byte[] Encrypt(byte[] plaintext, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
byte[] | plaintext | The data to encrypt. |
int | offset | The offset in |
int | length | The number of bytes to encrypt. |
Returns
byte[]
A new byte array containing the encrypted data. With protocol 2, the ciphertext is actually the concatenation of the IV and the encrypted data.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The |
InvalidOperationException | The object has been created or initialized, but the Encapsulate(CoseKey) method has not been called. |
ArgumentException | The length of the |