Class Gost28147CryptoServiceProvider
Implements
Inherited Members
Namespace: CryptoPro.Security.Cryptography
Assembly: CryptoPro.Security.Cryptography.dll
Syntax
public sealed class Gost28147CryptoServiceProvider : Gost28147, IDisposable
Constructors
Gost28147CryptoServiceProvider()
Declaration
public Gost28147CryptoServiceProvider()
Gost28147CryptoServiceProvider(CpCspParameters)
Declaration
public Gost28147CryptoServiceProvider(CpCspParameters parameters)
Parameters
Type | Name | Description |
---|---|---|
CpCspParameters | parameters |
Gost28147CryptoServiceProvider(nint, nint)
Создание объекта симметричного шифрования по HANDLE ключа.
Declaration
public Gost28147CryptoServiceProvider(nint keyHandle, nint providerHandle)
Parameters
Type | Name | Description |
---|---|---|
nint | keyHandle | HANDLE симметричного ключа. |
nint | providerHandle | HANDLE провайдера. |
Remarks
При создании объекта симметричного шифрования параметры ключа устанавливаются в свои значения по умолчанию:
Параметр | Значение |
---|---|
IV | null |
Mode | CFB |
Padding | None |
KeySize |
256
|
FeedbackSize |
64
|
BlockSize |
64
|
Класс становится владельцем ДУБЛЯ ключа и закрывает HANDLE при закрытии класса, HANDLE провайдера не дублируется, но увеличивается счетчик его использования (DangerousAddRef).
Exceptions
Type | Condition |
---|---|
ArgumentException | Параметр |
Properties
CipherOid
Параметры шифрования
Declaration
public string CipherOid { get; set; }
Property Value
Type | Description |
---|---|
string |
Key
Получение или установка ключа используемого для симметричного шифрования.
Declaration
public override byte[] Key { get; set; }
Property Value
Type | Description |
---|---|
byte[] | Симметричный ключ в чистом виде. |
Overrides
Remarks
Если ключ не был задан, то при получении ключа он будет сгенерирован функцией GenerateKey().
Размер ключа должен быть равен BlockSizeValue, т.е. 256 бит.
Exceptions
Type | Condition |
---|---|
ArgumentException | При установке ключа неправильного размера. |
CryptographicException | При запрете импорта (экспорта) "чистых" ключей при установке (получении). |
Methods
ComputeHash(HashAlgorithm)
Хэширует секретный ключ.
Declaration
public override byte[] ComputeHash(HashAlgorithm hash)
Parameters
Type | Name | Description |
---|---|---|
HashAlgorithm | hash | Класс, реализующий функцию хэширования. |
Returns
Type | Description |
---|---|
byte[] | Хэш-значение секретного ключа |
Overrides
CreateDecryptor()
Declaration
public override ICryptoTransform CreateDecryptor()
Returns
Type | Description |
---|---|
ICryptoTransform | A symmetric decryptor object. |
Overrides
CreateDecryptor(byte[], byte[])
When overridden in a derived class, creates a symmetric decryptor object with the specified Key property and initialization vector (IV).
Declaration
public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV)
Parameters
Type | Name | Description |
---|---|---|
byte[] | rgbKey | The secret key to use for the symmetric algorithm. |
byte[] | rgbIV | The initialization vector to use for the symmetric algorithm. |
Returns
Type | Description |
---|---|
ICryptoTransform | A symmetric decryptor object. |
Overrides
CreateEncryptor()
Declaration
public override ICryptoTransform CreateEncryptor()
Returns
Type | Description |
---|---|
ICryptoTransform | A symmetric encryptor object. |
Overrides
CreateEncryptor(byte[], byte[])
When overridden in a derived class, creates a symmetric encryptor object with the specified Key property and initialization vector (IV).
Declaration
public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV)
Parameters
Type | Name | Description |
---|---|---|
byte[] | rgbKey | The secret key to use for the symmetric algorithm. |
byte[] | rgbIV | The initialization vector to use for the symmetric algorithm. |
Returns
Type | Description |
---|---|
ICryptoTransform | A symmetric encryptor object. |
Overrides
Dispose(bool)
Releases the unmanaged resources used by the SymmetricAlgorithm and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
GenerateIV()
When overridden in a derived class, generates a random initialization vector (IV) to use for the algorithm.
Declaration
public override void GenerateIV()
Overrides
GenerateKey()
When overridden in a derived class, generates a random key (Key) to use for the algorithm.
Declaration
public override void GenerateKey()
Overrides
Unwrap(byte[], GostKeyWrapMethod)
Импортирует (расшифровывает) секретный ключ.
Declaration
public override SymmetricAlgorithm Unwrap(byte[] wrapped, GostKeyWrapMethod method)
Parameters
Type | Name | Description |
---|---|---|
byte[] | wrapped | Зашифрованный секретный ключ. |
GostKeyWrapMethod | method | Алгоритм экспорта ключа. |
Returns
Type | Description |
---|---|
SymmetricAlgorithm |
Overrides
Wrap(Gost28147, GostKeyWrapMethod)
Экспортирует (шифрует) секретный ключ.
Declaration
public override byte[] Wrap(Gost28147 prov, GostKeyWrapMethod method)
Parameters
Type | Name | Description |
---|---|---|
Gost28147 | prov | Шифруемый ключ. |
GostKeyWrapMethod | method | Алгоритм экспорта ключа. |
Returns
Type | Description |
---|---|
byte[] | Зашифрованный симметричный ключ |