Class CpECDsa
Assembly: CryptoPro.Security.Cryptography.dll
Syntax
public abstract class CpECDsa : AsymmetricAlgorithm, IDisposable
Properties
KeyExchangeAlgorithm
When overridden in a derived class, gets the name of the key exchange algorithm. Otherwise, throws an NotImplementedException.
Declaration
public override string KeyExchangeAlgorithm { get; }
Property Value
| Type |
Description |
| string |
The name of the key exchange algorithm.
|
Overrides
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
Methods
Create()
Declaration
public static CpECDsa Create()
Returns
Create(int)
Declaration
public static CpECDsa Create(int keySizeInBits)
Parameters
| Type |
Name |
Description |
| int |
keySizeInBits |
|
Returns
Create(ECParameters)
Declaration
public static CpECDsa Create(ECParameters parameters)
Parameters
Returns
ExportParameters(bool)
Declaration
public abstract ECParameters ExportParameters(bool includePrivateParameters)
Parameters
| Type |
Name |
Description |
| bool |
includePrivateParameters |
|
Returns
Gets the largest size, in bytes, for a signature produced by this key in the indicated format.
Declaration
public int GetMaxSignatureSize(DSASignatureFormat signatureFormat)
Parameters
| Type |
Name |
Description |
| DSASignatureFormat |
signatureFormat |
The encoding format for a signature.
|
Returns
| Type |
Description |
| int |
The largest size, in bytes, for a signature produced by this key in the indicated format.
|
Exceptions
HashData(byte[], int, int, CpHashAlgorithmName)
Declaration
protected virtual byte[] HashData(byte[] data, int offset, int count, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
HashData(Stream, CpHashAlgorithmName)
Declaration
protected virtual byte[] HashData(Stream data, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
ImportParameters(ECParameters)
Declaration
public abstract void ImportParameters(ECParameters parameters)
Parameters
ImportPublicKey(ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Declaration
public abstract void ImportPublicKey(ReadOnlySpan<byte> encodedPublicKey, ReadOnlySpan<byte> encodedParameters)
Parameters
SignData(byte[], CpHashAlgorithmName)
Declaration
public byte[] SignData(byte[] data, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
Declaration
public byte[] SignData(byte[] data, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
SignData(byte[], int, int, CpHashAlgorithmName)
Declaration
public virtual byte[] SignData(byte[] data, int offset, int count, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
Declaration
public virtual byte[] SignData(byte[] data, int offset, int count, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
SignData(Stream, CpHashAlgorithmName)
Declaration
public virtual byte[] SignData(Stream data, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
SignData(ReadOnlySpan<byte>, CpHashAlgorithmName)
Computes the hash value of the specified data and signs it.
Declaration
public byte[] SignData(ReadOnlySpan<byte> data, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
| Type |
Description |
| byte[] |
The ECDSA signature for the specified data.
|
Exceptions
SignData(ReadOnlySpan<byte>, Span<byte>, CpHashAlgorithmName)
Computes the hash of the provided data with the specified algorithm
and sign the hash with the current key, writing the signature into a
provided buffer.
Declaration
public int SignData(ReadOnlySpan<byte> data, Span<byte> destination, CpHashAlgorithmName hashAlgorithm)
Parameters
| Type |
Name |
Description |
| ReadOnlySpan<byte> |
data |
The input data to hash and sign.
|
| Span<byte> |
destination |
The buffer to receive the ECDSA signature.
|
| CpHashAlgorithmName |
hashAlgorithm |
The hash algorithm to use to create the hash value.
|
Returns
| Type |
Description |
| int |
The total number of bytes written to destination.
|
Exceptions
| Type |
Condition |
| ArgumentException |
hashAlgorithm's
Name is an empty string.
-or-
The buffer in destination is too small to hold
the signature.
|
| CryptographicException |
This instance represents only a public key.
-or-
An error occurred creating the signature.
|
SignHash(byte[], CpHashAlgorithmName)
Declaration
public virtual byte[] SignHash(byte[] hash, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
Declaration
public virtual byte[] SignHash(byte[] hash, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
SignHash(ReadOnlySpan<byte>, CpHashAlgorithmName)
Declaration
public byte[] SignHash(ReadOnlySpan<byte> hash, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
Computes the signature for the specified hash value.
Declaration
public byte[] SignHash(ReadOnlySpan<byte> hash, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
| Type |
Description |
| byte[] |
The ECDSA signature for the specified hash value.
|
Exceptions
SignHash(ReadOnlySpan<byte>, Span<byte>, CpHashAlgorithmName)
Sign the hash with the current key, writing the signature into a
provided buffer.
Declaration
public int SignHash(ReadOnlySpan<byte> hash, Span<byte> destination, CpHashAlgorithmName hashAlgorithm)
Parameters
| Type |
Name |
Description |
| ReadOnlySpan<byte> |
hash |
The hash value of the data to be signed.
|
| Span<byte> |
destination |
The buffer to receive the ECDSA signature.
|
| CpHashAlgorithmName |
hashAlgorithm |
The hash algorithm used to create the hash of
hash.
|
Returns
| Type |
Description |
| int |
The total number of bytes written to destination.
|
Exceptions
| Type |
Condition |
| ArgumentException |
hashAlgorithm's
Name is an empty string.
-or-
The buffer in destination is too small to hold
the signature.
|
| CryptographicException |
This instance represents only a public key.
-or-
An error occurred creating the signature.
|
TryHashData(ReadOnlySpan<byte>, Span<byte>, CpHashAlgorithmName, out int)
Declaration
protected virtual bool TryHashData(ReadOnlySpan<byte> data, Span<byte> destination, CpHashAlgorithmName hashAlgorithm, out int bytesWritten)
Parameters
Returns
TrySignData(ReadOnlySpan<byte>, Span<byte>, CpHashAlgorithmName, out int)
Declaration
public virtual bool TrySignData(ReadOnlySpan<byte> data, Span<byte> destination, CpHashAlgorithmName hashAlgorithm, out int bytesWritten)
Parameters
Returns
TrySignHash(ReadOnlySpan<byte>, Span<byte>, CpHashAlgorithmName, out int)
Declaration
public virtual bool TrySignHash(ReadOnlySpan<byte> hash, Span<byte> destination, CpHashAlgorithmName hashAlgorithm, out int bytesWritten)
Parameters
Returns
Declaration
public virtual bool TrySignHash(ReadOnlySpan<byte> hash, Span<byte> destination, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat, out int bytesWritten)
Parameters
Returns
TrySignHashCore(ReadOnlySpan<byte>, Span<byte>, CpHashAlgorithmName, out int)
Declaration
protected virtual bool TrySignHashCore(ReadOnlySpan<byte> hash, Span<byte> destination, CpHashAlgorithmName hashAlgorithm, out int bytesWritten)
Parameters
Returns
Declaration
protected abstract bool TrySignHashCore(ReadOnlySpan<byte> hash, Span<byte> destination, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat, out int bytesWritten)
Parameters
Returns
VerifyData(byte[], byte[], CpHashAlgorithmName)
Declaration
public bool VerifyData(byte[] data, byte[] signature, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
Declaration
public bool VerifyData(byte[] data, byte[] signature, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
VerifyData(byte[], int, int, byte[], CpHashAlgorithmName)
Declaration
public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
Declaration
public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
VerifyData(Stream, byte[], CpHashAlgorithmName)
Declaration
public bool VerifyData(Stream data, byte[] signature, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
VerifyData(ReadOnlySpan<byte>, ReadOnlySpan<byte>, CpHashAlgorithmName)
Declaration
public virtual bool VerifyData(ReadOnlySpan<byte> data, ReadOnlySpan<byte> signature, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
VerifyHash(byte[], byte[], CpHashAlgorithmName)
Declaration
public virtual bool VerifyHash(byte[] hash, byte[] signature, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
VerifyHash(ReadOnlySpan<byte>, ReadOnlySpan<byte>, CpHashAlgorithmName)
Declaration
public virtual bool VerifyHash(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
Declaration
public virtual bool VerifyHash(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
VerifyHashCore(ReadOnlySpan<byte>, ReadOnlySpan<byte>, CpHashAlgorithmName)
Verifies that a digital signature is valid for the provided hash.
Declaration
protected virtual bool VerifyHashCore(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, CpHashAlgorithmName hashAlgorithm)
Parameters
Returns
| Type |
Description |
| bool |
true if the digital signature is valid for the
provided data; otherwise, false.
|
Exceptions
Verifies that a digital signature is valid for the provided hash.
Declaration
protected abstract bool VerifyHashCore(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, CpHashAlgorithmName hashAlgorithm, DSASignatureFormat signatureFormat)
Parameters
Returns
| Type |
Description |
| bool |
true if the digital signature is valid for the
provided data; otherwise, false.
|
Exceptions
Implements