Class Kuznyechik
- Namespace
- CryptoHives.Foundation.Security.Cryptography.Cipher
- Assembly
- CryptoHives.Foundation.Security.Cryptography.dll
Kuznyechik (GOST R 34.12-2015) symmetric cipher implementation.
public sealed class Kuznyechik : SymmetricCipher, IDisposable
- Inheritance
-
Kuznyechik
- Implements
- Inherited Members
Remarks
Kuznyechik is a 128-bit block cipher with a 256-bit key, specified in the Russian Federal standard GOST R 34.12-2015 and documented in RFC 7801. It uses a Substitution-Permutation Network (SPN) structure with 10 rounds.
Security level: 256 bits (quantum: 128 bits with Grover's algorithm)
Example usage:
using var kuz = Kuznyechik.Create();
kuz.Mode = CipherMode.CBC;
kuz.Padding = PaddingMode.PKCS7;
kuz.GenerateKey();
kuz.GenerateIV();
byte[] ciphertext = kuz.Encrypt(plaintext);
byte[] decrypted = kuz.Decrypt(ciphertext);
Constructors
Kuznyechik()
Initializes a new instance of the Kuznyechik class.
public Kuznyechik()
Fields
KeySizeBits
Key size in bits for Kuznyechik.
public const int KeySizeBits = 256
Field Value
KeySizeBytes
Key size in bytes for Kuznyechik.
public const int KeySizeBytes = 32
Field Value
Properties
AlgorithmName
Gets the name of the cipher algorithm.
public override string AlgorithmName { get; }
Property Value
Examples
"AES-256", "ChaCha20", "AES-256-GCM"
IVSize
Gets the required IV/nonce size in bytes for the current mode.
public override int IVSize { get; }
Property Value
Methods
Create()
Creates a new instance of the Kuznyechik cipher.
public static Kuznyechik Create()
Returns
- Kuznyechik
A new Kuznyechik cipher instance.
CreateCipherDecryptor(ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Creates a decryptor transform using the specified key and IV.
protected override ICipherTransform CreateCipherDecryptor(ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)
Parameters
keyReadOnlySpan<byte>The secret key.
ivReadOnlySpan<byte>The initialization vector or nonce.
Returns
- ICipherTransform
A new cipher decryptor transform.
CreateCipherEncryptor(ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Creates an encryptor transform using the specified key and IV.
protected override ICipherTransform CreateCipherEncryptor(ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)
Parameters
keyReadOnlySpan<byte>The secret key.
ivReadOnlySpan<byte>The initialization vector or nonce.
Returns
- ICipherTransform
A new cipher encryptor transform.