Show / Hide Table of Contents

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 override byte[] Encrypt(byte[] plaintext, int offset, int length)

Parameters

Type Name Description
byte[] plaintext

The data to encrypt.

int offset

The offset in plaintext where the method will begin encrypting.

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.

Overrides

PinUvAuthProtocolBase.Encrypt(byte[], int, int)

Exceptions

Type Condition
ArgumentNullException

The plaintext argument is null.

InvalidOperationException

The object has been created or initialized, but the Encapsulate(CoseKey) method has not been called.

ArgumentException

The length of the plaintext is not a multiple of the AES block size (16 bytes).

In this article
Back to top Generated by DocFX