Class AesSiv
- Namespace
 - Dorssel.Security.Cryptography
 
- Assembly
 - Dorssel.Security.Cryptography.AesExtra.dll
 
Represents an Advanced Encryption Standard (AES) key to be used with the Synthetic Initialization Vector (SIV) mode of operation.
public sealed class AesSiv : IDisposable
  - Inheritance
 - 
      
      AesSiv
 
- Implements
 
- Inherited Members
 
Constructors
AesSiv(byte[])
Initializes a new instance of the AesSiv class with a provided key.
public AesSiv(byte[] key)
  Parameters
keybyte[]The secret key to use for this instance.
Exceptions
- ArgumentNullException
 keyis null.- CryptographicException
 The
keylength is other than 32, 48, or 64 bytes (256, 384, or 512 bits).
AesSiv(ReadOnlySpan<byte>)
Initializes a new instance of the AesSiv class with a provided key.
public AesSiv(ReadOnlySpan<byte> key)
  Parameters
keyReadOnlySpan<byte>The secret key to use for this instance.
Exceptions
- CryptographicException
 The
keylength is other than 32, 48, or 64 bytes (256, 384, or 512 bits).
Methods
Decrypt(byte[], byte[], params byte[][])
Decrypts the ciphertext into the provided destination buffer if the data can be validated.
public void Decrypt(byte[] ciphertext, byte[] plaintext, params byte[][] associatedData)
  Parameters
ciphertextbyte[]The encrypted content to decrypt, including the prepended IV.
plaintextbyte[]The byte array to receive the decrypted contents.
associatedDatabyte[][]Extra data associated with this message, which must match the value provided during encryption.
Exceptions
- ArgumentNullException
 ciphertextis null.- ArgumentException
 ciphertextis too short.- ArgumentNullException
 plaintextis null.- ArgumentException
 plaintextis not exactly one block smaller thanciphertext.- ArgumentNullException
 associatedDatais null.- ArgumentException
 associatedDatahas too many items.- ArgumentException
 associatedDatacontains an item that is null.- ObjectDisposedException
 The AesSiv instance has been disposed.
- CryptographicException
 The tag value could not be verified.
Decrypt(ReadOnlySpan<byte>, Span<byte>, ReadOnlySpan<byte>)
Decrypts the ciphertext into the provided destination buffer if the data can be validated.
public void Decrypt(ReadOnlySpan<byte> ciphertext, Span<byte> plaintext, ReadOnlySpan<byte> associatedData)
  Parameters
ciphertextReadOnlySpan<byte>The encrypted content to decrypt, including the prepended IV.
plaintextSpan<byte>The byte array to receive the decrypted contents.
associatedDataReadOnlySpan<byte>Extra data associated with this message, which must match the value provided during encryption.
Remarks
This method expects exactly one associated data item, possibly of zero length, which differs from expecting no associated data items at all.
Exceptions
- ArgumentException
 ciphertextis too short.- ArgumentException
 plaintextis not exactly one block smaller thanciphertext.- ObjectDisposedException
 The AesSiv instance has been disposed.
- CryptographicException
 The tag value could not be verified.
Decrypt(ReadOnlySpan<byte>, Span<byte>, params ReadOnlySpan<ReadOnlyMemory<byte>>)
Decrypts the ciphertext into the provided destination buffer if the data can be validated.
public void Decrypt(ReadOnlySpan<byte> ciphertext, Span<byte> plaintext, params ReadOnlySpan<ReadOnlyMemory<byte>> associatedData)
  Parameters
ciphertextReadOnlySpan<byte>The encrypted content to decrypt, including the prepended IV.
plaintextSpan<byte>The byte array to receive the decrypted contents.
associatedDataReadOnlySpan<ReadOnlyMemory<byte>>Extra data associated with this message, which must match the value provided during encryption.
Exceptions
- ArgumentException
 ciphertextis too short.- ArgumentException
 plaintextis not exactly one block smaller thanciphertext.- ArgumentException
 associatedDatahas too many items.- ObjectDisposedException
 The AesSiv instance has been disposed.
- CryptographicException
 The tag value could not be verified.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
  Encrypt(byte[], byte[], params byte[][])
Encrypts the plaintext into the ciphertext destination buffer, prepending the synthetic IV.
public void Encrypt(byte[] plaintext, byte[] ciphertext, params byte[][] associatedData)
  Parameters
plaintextbyte[]The content to encrypt.
ciphertextbyte[]The byte array to receive the encrypted contents, prepended with the synthetic IV.
associatedDatabyte[][]Extra data associated with this message, which must also be provided during decryption.
Exceptions
- ArgumentNullException
 plaintextis null.- ArgumentNullException
 ciphertextis null.- ArgumentException
 ciphertextis too short.- ArgumentException
 ciphertextis not exactly one block larger thanplaintext.- ArgumentNullException
 associatedDatais null.- ArgumentException
 associatedDatahas too many items.- ArgumentException
 associatedDatacontains an item that is null.- ObjectDisposedException
 The AesSiv instance has been disposed.
Encrypt(ReadOnlySpan<byte>, Span<byte>, ReadOnlySpan<byte>)
Encrypts the plaintext into the ciphertext destination buffer, prepending the synthetic IV.
public void Encrypt(ReadOnlySpan<byte> plaintext, Span<byte> ciphertext, ReadOnlySpan<byte> associatedData)
  Parameters
plaintextReadOnlySpan<byte>The content to encrypt.
ciphertextSpan<byte>The byte array to receive the encrypted contents, prepended with the synthetic IV.
associatedDataReadOnlySpan<byte>Extra data associated with this message, which must also be provided during decryption.
Remarks
This method adds exactly one associated data item, possibly of zero length, which differs from adding no associated data items at all.
Exceptions
- ArgumentException
 ciphertextis not exactly one block larger thanplaintext.- ObjectDisposedException
 The AesSiv instance has been disposed.
Encrypt(ReadOnlySpan<byte>, Span<byte>, params ReadOnlySpan<ReadOnlyMemory<byte>>)
Encrypts the plaintext into the ciphertext destination buffer, prepending the synthetic IV.
public void Encrypt(ReadOnlySpan<byte> plaintext, Span<byte> ciphertext, params ReadOnlySpan<ReadOnlyMemory<byte>> associatedData)
  Parameters
plaintextReadOnlySpan<byte>The content to encrypt.
ciphertextSpan<byte>The byte array to receive the encrypted contents, prepended with the synthetic IV.
associatedDataReadOnlySpan<ReadOnlyMemory<byte>>Extra data associated with this message, which must also be provided during decryption.
Exceptions
- ArgumentException
 ciphertextis not exactly one block larger thanplaintext.- ArgumentException
 associatedDatahas too many items.- ObjectDisposedException
 The AesSiv instance has been disposed.