CryptographyClient.SignAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| SignAsync(SignatureAlgorithm, Byte[], CancellationToken) |
Signs the specified digest. |
| SignAsync(MLDsaSignOptions, CancellationToken) |
Signs a message using a post-quantum ML-DSA (AKP) key. |
SignAsync(SignatureAlgorithm, Byte[], CancellationToken)
- Source:
- CryptographyClient.cs
- Source:
- CryptographyClient.cs
Signs the specified digest.
public virtual System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.SignResult> SignAsync(Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm algorithm, byte[] digest, System.Threading.CancellationToken cancellationToken = default);
abstract member SignAsync : Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm * byte[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.SignResult>
override this.SignAsync : Azure.Security.KeyVault.Keys.Cryptography.SignatureAlgorithm * byte[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.SignResult>
Public Overridable Function SignAsync (algorithm As SignatureAlgorithm, digest As Byte(), Optional cancellationToken As CancellationToken = Nothing) As Task(Of SignResult)
Parameters
- algorithm
- SignatureAlgorithm
The SignatureAlgorithm to use.
- digest
- Byte[]
The pre-hashed digest to sign. The hash algorithm used to compute the digest must be compatible with the specified algorithm.
- cancellationToken
- CancellationToken
A CancellationToken to cancel the operation.
Returns
The result of the sign operation. The returned SignResult contains the signature along with all other information needed to verify it. This information should be stored with the signature.
Exceptions
The specified algorithm does not match the key corresponding to the key identifier.
The local cryptographic provider threw an exception.
The key is invalid for the current operation.
The operation is not supported with the specified key.
The server returned an error. See Message for details returned from the server.
Applies to
SignAsync(MLDsaSignOptions, CancellationToken)
- Source:
- CryptographyClient.cs
Signs a message using a post-quantum ML-DSA (AKP) key.
public virtual System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.SignResult> SignAsync(Azure.Security.KeyVault.Keys.Cryptography.MLDsaSignOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member SignAsync : Azure.Security.KeyVault.Keys.Cryptography.MLDsaSignOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.SignResult>
override this.SignAsync : Azure.Security.KeyVault.Keys.Cryptography.MLDsaSignOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Security.KeyVault.Keys.Cryptography.SignResult>
Public Overridable Function SignAsync (options As MLDsaSignOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SignResult)
Parameters
- options
- MLDsaSignOptions
The MLDsaSignOptions describing the message or external mu to sign and any optional context.
- cancellationToken
- CancellationToken
A CancellationToken to cancel the operation.
Returns
The result of the sign operation. The returned SignResult contains the signature along with all other information needed to verify it. This information should be stored with the signature.
Exceptions
options is null.
The client was constructed with a local key and cannot perform this operation.
The server returned an error. See Message for details returned from the server.
Remarks
The algorithm is inferred from the key and is not specified by the caller. This operation is always performed by the vault and is not supported by local-only clients.