Encrypt Method
Encrypt(Byte[], Int32, Int32)
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 override byte[] Encrypt(byte[] plaintext, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | plaintext | The data to encrypt. |
System.Int32 | offset | The offset in |
System.Int32 | length | The number of bytes to encrypt. |
Returns
System.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.
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The |
System.InvalidOperationException | The object has been created or initialized, but the Encapsulate(CoseKey) method has not been called. |
System.ArgumentException | The length of the |