Class CpECDsaCryptoServiceProvider
Inherited Members
Namespace: CryptoPro.Security.Cryptography
Assembly: CryptoPro.Security.Cryptography.dll
Syntax
public sealed class CpECDsaCryptoServiceProvider : CpECDsa, IDisposable, ICpCspAsymmetricAlgorithm
Constructors
CpECDsaCryptoServiceProvider()
Declaration
public CpECDsaCryptoServiceProvider()
CpECDsaCryptoServiceProvider(CpCspParameters)
Declaration
public CpECDsaCryptoServiceProvider(CpCspParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| CpCspParameters | parameters |
CpECDsaCryptoServiceProvider(int)
Declaration
public CpECDsaCryptoServiceProvider(int dwKeySize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | dwKeySize |
CpECDsaCryptoServiceProvider(int, CpCspParameters)
Declaration
public CpECDsaCryptoServiceProvider(int dwKeySize, CpCspParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| int | dwKeySize | |
| CpCspParameters | parameters |
Properties
ContainerCertificate
Получение/установка сертификата в конейнер.
Declaration
public byte[] ContainerCertificate { get; set; }
Property Value
| Type | Description |
|---|---|
| byte[] | Возвращается хранимый сертификат или null, если сертификат в контейнере отсутствует. |
CspKeyContainerInfo
Получает информацию о CSP CspKeyContainerInfo, в котором хранится ключевая пара.
Declaration
public CpCspKeyContainerInfo CspKeyContainerInfo { get; }
Property Value
| Type | Description |
|---|---|
| CpCspKeyContainerInfo |
Handle
Gets a copy to a native HCRYPTPROV handle.
Declaration
public nint Handle { get; }
Property Value
| Type | Description |
|---|---|
| nint |
HandleNoDuplicate
Gets a native HCRYPTPROV handle.
Declaration
public nint HandleNoDuplicate { get; }
Property Value
| Type | Description |
|---|---|
| nint |
KeySize
Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm.
Declaration
public override int KeySize { get; }
Property Value
| Type | Description |
|---|---|
| int | The size, in bits, of the key modulus used by the asymmetric algorithm. |
Overrides
Remarks
csp will return true Key size, which is double field size, dotnet code expect field size here.
Exceptions
| Type | Condition |
|---|---|
| CryptographicException | The key modulus size is invalid. |
KeySpec
Gets a key specification.
Declaration
public int KeySpec { get; }
Property Value
| Type | Description |
|---|---|
| int |
LegalKeySizes
Gets the key sizes that are supported by the asymmetric algorithm.
Declaration
public override KeySizes[] LegalKeySizes { get; }
Property Value
| Type | Description |
|---|---|
| KeySizes[] | An array that contains the key sizes supported by the asymmetric algorithm. |
Overrides
NotAfter
Срок действия закртытого ключа, указанного в KP_NOTAFTER
Declaration
public DateTimeOffset NotAfter { get; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset |
PublicOnly
Получает значение, указывающее, не содержит ли объект Gost3410_2012_256CryptoServiceProvider только открытый ключ.
Declaration
public bool PublicOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool | true, если Gost3410_2012_256CryptoServiceProvider содержит только открытый ключ, false - иначе. |
SignatureAlgorithm
When implemented in a derived class, gets the name of the signature algorithm. Otherwise, always throws a NotImplementedException.
Declaration
public override string SignatureAlgorithm { get; }
Property Value
| Type | Description |
|---|---|
| string | The name of the signature algorithm. |
Overrides
UseMachineKeyStore
Возвращает или устанавливает флаг того, что ключ должен храниться в STORE ключей компьютера, а не в профиле пользователя.
Declaration
public static bool UseMachineKeyStore { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | true, если ключ должен храниться в банке ключей компьютера, false - иначе. |
Remarks
Данный флаг устанавливает использование ключей из STORE пользователя
или компьютера при открытии ключей без указания данного флага.
Установка данного флага эквивалентна передаче установке флага
UseMachineKeyStore в
CspParameters. Свойство UseMachineKeyStore
устанавливается для всего кода в текущем домене, в то время как
CspParameters применимо только к объекту на который он
ссылается. Установка/сброс данного флага полезна при
имперсонализации или работе без загруженного профиля пользователя.
При инициализации объекта через конструктор CpECDsaCryptoServiceProvider(CpCspParameters) будут использованы именно эти параметры, в независимости от флага UseMachineKeyStore. По умолчанию значение флага из CpECDsaCryptoServiceProvider(CpCspParameters) устанавливется в использование ключей из хранилищи пользователя. Для использования ключей из хранилища компьютера при использовании конструктора CpECDsaCryptoServiceProvider(CpCspParameters) необходимо установить флаг Flags: UseMachineKeyStore.
Methods
Dispose(bool)
Dispose the key handles
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Overrides
ExportCspBlob()
Declaration
public byte[] ExportCspBlob()
Returns
| Type | Description |
|---|---|
| byte[] |
ExportCspBlob(bool)
Exports a blob containing the key information associated with an ECDSACryptoServiceProvider object.
Declaration
public byte[] ExportCspBlob(bool includePrivateParameters)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | includePrivateParameters |
Returns
| Type | Description |
|---|---|
| byte[] |
ExportParameters(bool)
Exports the EcParameters
Declaration
public override ECParameters ExportParameters(bool includePrivateParameters)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | includePrivateParameters |
Returns
| Type | Description |
|---|---|
| ECParameters |
Overrides
ImportCspBlob(byte[])
Imports a blob that represents ECDSA key information
Declaration
public void ImportCspBlob(byte[] keyBlob)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | keyBlob |
ImportParameters(ECParameters)
Imports the specified EcParameters
Declaration
public override void ImportParameters(ECParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| ECParameters | parameters |
Overrides
ImportPublicKey(ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Declaration
public override void ImportPublicKey(ReadOnlySpan<byte> encodedPublicKey, ReadOnlySpan<byte> encodedParameters)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | encodedPublicKey | |
| ReadOnlySpan<byte> | encodedParameters |
Overrides
ImportSubjectPublicKeyInfo(ReadOnlySpan<byte>, out int)
When overriden in a derived class, imports the public key from an X.509 SubjectPublicKeyInfo structure after decryption, replacing the keys for this object.
Declaration
public override void ImportSubjectPublicKeyInfo(ReadOnlySpan<byte> source, out int bytesRead)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | source | The bytes of an X.509 SubjectPublicKeyInfo structure in the ASN.1-DER encoding. |
| int | bytesRead | When this method returns, contains a value that indicates the number of bytes read from |
Overrides
Exceptions
| Type | Condition |
|---|---|
| CryptographicException | The contents of -or- The contents of -or- The contents of -or- The algorithm-specific key import failed. |
| NotImplementedException | A derived type has not overriden this member. |
SignHash(byte[], string?)
Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.
Declaration
public byte[] SignHash(byte[] rgbHash, string? str)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | rgbHash | The input data for which to compute the hash |
| string | str | The hash algorithm to use to create the hash value. |
Returns
| Type | Description |
|---|---|
| byte[] | The ECDSA signature for the specified data. |
TrySignHashCore(ReadOnlySpan<byte>, Span<byte>, CpHashAlgorithmName, DSASignatureFormat, out int)
Declaration
protected override bool TrySignHashCore(ReadOnlySpan<byte> rgbHash, Span<byte> signature, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat, out int bytesWritten)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | rgbHash | |
| Span<byte> | signature | |
| CpHashAlgorithmName | hashAlgorithm | |
| DSASignatureFormat | signatureFormat | |
| int | bytesWritten |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
VerifyHashCore(ReadOnlySpan<byte>, ReadOnlySpan<byte>, CpHashAlgorithmName, DSASignatureFormat)
Verifies that a digital signature is valid for the provided hash.
Declaration
protected override bool VerifyHashCore(ReadOnlySpan<byte> rgbHash, ReadOnlySpan<byte> rgbSignature, CpHashAlgorithmName hashAlgorithmName, DSASignatureFormat signatureFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | rgbHash | |
| ReadOnlySpan<byte> | rgbSignature | |
| CpHashAlgorithmName | hashAlgorithmName | |
| DSASignatureFormat | signatureFormat |
Returns
| Type | Description |
|---|---|
| bool | true if the digital signature is valid for the provided data; otherwise, false. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| CryptographicException | An error occurred in the verification operation. |