Επεξεργασία

Κοινή χρήση μέσω


ECDsa.SignData Method

Definition

Computes the hash value of the specified data and signs it.

Overloads

SignData(Byte[], HashAlgorithmName)

Computes the hash value of the specified byte array using the specified hash algorithm and signs the resulting hash value.

SignData(Stream, HashAlgorithmName)

Computes the hash value of the specified stream using the specified hash algorithm and signs the resulting hash value.

SignData(ReadOnlySpan<Byte>, HashAlgorithmName)

Computes the hash value of the specified data and signs it.

SignData(Byte[], HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

SignData(Stream, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName)

Computes the hash value of the specified data and signs it in the indicated format into the provided buffer.

SignData(Byte[], Int32, Int32, HashAlgorithmName)

Computes the hash value of a portion of the specified byte array using the specified hash algorithm and signs the resulting hash value.

SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it in the indicated format into the provided buffer.

SignData(Byte[], Int32, Int32, HashAlgorithmName, DSASignatureFormat)

Computes the hash value of the specified data and signs it using the specified signature format.

SignData(Byte[], HashAlgorithmName)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified byte array using the specified hash algorithm and signs the resulting hash value.

public:
 virtual cli::array <System::Byte> ^ SignData(cli::array <System::Byte> ^ data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public virtual byte[] SignData (byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
abstract member SignData : byte[] * System.Security.Cryptography.HashAlgorithmName -> byte[]
override this.SignData : byte[] * System.Security.Cryptography.HashAlgorithmName -> byte[]
Public Overridable Function SignData (data As Byte(), hashAlgorithm As HashAlgorithmName) As Byte()

Parameters

data
Byte[]

The input data for which to compute the hash.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

data is null.

hashAlgorithm.Name is null or Empty.

Applies to

SignData(Stream, HashAlgorithmName)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified stream using the specified hash algorithm and signs the resulting hash value.

public:
 virtual cli::array <System::Byte> ^ SignData(System::IO::Stream ^ data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public virtual byte[] SignData (System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
abstract member SignData : System.IO.Stream * System.Security.Cryptography.HashAlgorithmName -> byte[]
override this.SignData : System.IO.Stream * System.Security.Cryptography.HashAlgorithmName -> byte[]
Public Overridable Function SignData (data As Stream, hashAlgorithm As HashAlgorithmName) As Byte()

Parameters

data
Stream

The input stream for which to compute the hash.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

data is null.

hashAlgorithm.Name is null or Empty.

Applies to

SignData(ReadOnlySpan<Byte>, HashAlgorithmName)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified data and signs it.

public:
 cli::array <System::Byte> ^ SignData(ReadOnlySpan<System::Byte> data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public byte[] SignData (ReadOnlySpan<byte> data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
member this.SignData : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName -> byte[]
Public Function SignData (data As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName) As Byte()

Parameters

data
ReadOnlySpan<Byte>

The data to hash and sign.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

hashAlgorithm's Name is an empty string.

hashAlgorithm's Name is null.

Remarks

This method will use IeeeP1363FixedFieldConcatenation to encode the the signature. To use a different signature format, use SignData(ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat).

Applies to

SignData(Byte[], HashAlgorithmName, DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified data and signs it using the specified signature format.

public:
 cli::array <System::Byte> ^ SignData(cli::array <System::Byte> ^ data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::DSASignatureFormat signatureFormat);
public byte[] SignData (byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat);
member this.SignData : byte[] * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.DSASignatureFormat -> byte[]
Public Function SignData (data As Byte(), hashAlgorithm As HashAlgorithmName, signatureFormat As DSASignatureFormat) As Byte()

Parameters

data
Byte[]

The data to sign.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

data is null.

signatureFormat is not a known format.

hashAlgorithm has a null or empty Name.

An error occurred in the hashing or signing operation.

Applies to

SignData(Stream, HashAlgorithmName, DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified data and signs it using the specified signature format.

public:
 cli::array <System::Byte> ^ SignData(System::IO::Stream ^ data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::DSASignatureFormat signatureFormat);
public byte[] SignData (System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat);
member this.SignData : System.IO.Stream * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.DSASignatureFormat -> byte[]
Public Function SignData (data As Stream, hashAlgorithm As HashAlgorithmName, signatureFormat As DSASignatureFormat) As Byte()

Parameters

data
Stream

The data to sign.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

data is null.

signatureFormat is not a known format.

hashAlgorithm has a null or empty Name.

An error occurred in the hashing or signing operation.

Applies to

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified data and signs it using the specified signature format.

public:
 cli::array <System::Byte> ^ SignData(ReadOnlySpan<System::Byte> data, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::DSASignatureFormat signatureFormat);
public byte[] SignData (ReadOnlySpan<byte> data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat);
member this.SignData : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.DSASignatureFormat -> byte[]
Public Function SignData (data As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, signatureFormat As DSASignatureFormat) As Byte()

Parameters

data
ReadOnlySpan<Byte>

The data to hash and sign.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

hashAlgorithm's Name is an empty string.

hashAlgorithm's Name is null.

signatureFormat is not a known format.

Applies to

SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified data and signs it in the indicated format into the provided buffer.

public:
 int SignData(ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public int SignData (ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
member this.SignData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName -> int
Public Function SignData (data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithm As HashAlgorithmName) As Integer

Parameters

data
ReadOnlySpan<Byte>

The data to hash and sign.

destination
Span<Byte>

The buffer to receive the signature.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

Returns

The total number of bytes written to destination.

Exceptions

hashAlgorithm's Name is an empty string.

-or-

The buffer in destination is too small to hold the signature.

hashAlgorithm's Name is null.

Remarks

This method will use IeeeP1363FixedFieldConcatenation to encode the the signature. To use a different signature format, use SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, DSASignatureFormat).

Applies to

SignData(Byte[], Int32, Int32, HashAlgorithmName)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of a portion of the specified byte array using the specified hash algorithm and signs the resulting hash value.

public:
 virtual cli::array <System::Byte> ^ SignData(cli::array <System::Byte> ^ data, int offset, int count, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public virtual byte[] SignData (byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
abstract member SignData : byte[] * int * int * System.Security.Cryptography.HashAlgorithmName -> byte[]
override this.SignData : byte[] * int * int * System.Security.Cryptography.HashAlgorithmName -> byte[]
Public Overridable Function SignData (data As Byte(), offset As Integer, count As Integer, hashAlgorithm As HashAlgorithmName) As Byte()

Parameters

data
Byte[]

The input data for which to compute the hash.

offset
Int32

The offset into the array at which to begin using data.

count
Int32

The number of bytes in the array to use as data.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

data is null.

hashAlgorithm.Name is null or Empty.

offset is less than zero.

-or-

count is less than zero.

-or-

offset + count - 1 results in an index that is beyond the upper bound of data.

Applies to

SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified data and signs it in the indicated format into the provided buffer.

public:
 int SignData(ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::DSASignatureFormat signatureFormat);
public int SignData (ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat);
member this.SignData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.DSASignatureFormat -> int
Public Function SignData (data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithm As HashAlgorithmName, signatureFormat As DSASignatureFormat) As Integer

Parameters

data
ReadOnlySpan<Byte>

The data to hash and sign.

destination
Span<Byte>

The buffer to receive the signature.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

The total number of bytes written to destination.

Exceptions

hashAlgorithm's Name is an empty string.

-or-

The buffer in destination is too small to hold the signature.

hashAlgorithm's Name is null.

signatureFormat is not a known format.

Applies to

SignData(Byte[], Int32, Int32, HashAlgorithmName, DSASignatureFormat)

Source:
ECDsa.cs
Source:
ECDsa.cs
Source:
ECDsa.cs

Computes the hash value of the specified data and signs it using the specified signature format.

public:
 cli::array <System::Byte> ^ SignData(cli::array <System::Byte> ^ data, int offset, int count, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::DSASignatureFormat signatureFormat);
public byte[] SignData (byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.DSASignatureFormat signatureFormat);
member this.SignData : byte[] * int * int * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.DSASignatureFormat -> byte[]
Public Function SignData (data As Byte(), offset As Integer, count As Integer, hashAlgorithm As HashAlgorithmName, signatureFormat As DSASignatureFormat) As Byte()

Parameters

data
Byte[]

The data to sign.

offset
Int32

The offset into data at which to begin hashing.

count
Int32

The number of bytes to read from data.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use to create the hash value.

signatureFormat
DSASignatureFormat

The encoding format to use for the signature.

Returns

Byte[]

The ECDSA signature for the specified data.

Exceptions

data is null.

signatureFormat is not a known format.

-or-

offset is less than zero.

-or-

count is less than zero.

-or-

offset + count - 1 results in an index that is beyond the upper bound of data.

hashAlgorithm has a null or empty Name.

An error occurred in the hashing or signing operation.

Applies to