CryptoProviderFactory.CreateForSigning Method

Definition

Overloads

CreateForSigning(SecurityKey, String)

Creates a SignatureProvider that creates a signature with the algorithm and SecurityKey.

CreateForSigning(SecurityKey, String, Boolean)

Creates a SignatureProvider that creates a signature with the algorithm and SecurityKey.

CreateForSigning(SecurityKey, String)

Creates a SignatureProvider that creates a signature with the algorithm and SecurityKey.

public virtual Microsoft.IdentityModel.Tokens.SignatureProvider CreateForSigning (Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm);
abstract member CreateForSigning : Microsoft.IdentityModel.Tokens.SecurityKey * string -> Microsoft.IdentityModel.Tokens.SignatureProvider
override this.CreateForSigning : Microsoft.IdentityModel.Tokens.SecurityKey * string -> Microsoft.IdentityModel.Tokens.SignatureProvider
Public Overridable Function CreateForSigning (key As SecurityKey, algorithm As String) As SignatureProvider

Parameters

key
SecurityKey

the SecurityKey to use for signing.

algorithm
String

the algorithm to use for signing.

Returns

A SignatureProvider that can be used to create a signature using the SecurityKey and algorithm.

Exceptions

thrown if algorithm is null or empty.

thrown if KeySize is too small.

thrown if the key / algorithm is not supported.

thrown if Create(String, Object[]) returns a type that is not assignable from SignatureProvider.

Remarks

AsymmetricSignatureProviders require access to a PrivateKey for Signing.

When finished with the SignatureProvider call ReleaseSignatureProvider(SignatureProvider).

If CustomCryptoProvider is set and IsSupportedAlgorithm(String, Object[]) returns true. Create(String, Object[]) is called to obtain the SignatureProvider.

Applies to

CreateForSigning(SecurityKey, String, Boolean)

Creates a SignatureProvider that creates a signature with the algorithm and SecurityKey.

public virtual Microsoft.IdentityModel.Tokens.SignatureProvider CreateForSigning (Microsoft.IdentityModel.Tokens.SecurityKey key, string algorithm, bool cacheProvider);
abstract member CreateForSigning : Microsoft.IdentityModel.Tokens.SecurityKey * string * bool -> Microsoft.IdentityModel.Tokens.SignatureProvider
override this.CreateForSigning : Microsoft.IdentityModel.Tokens.SecurityKey * string * bool -> Microsoft.IdentityModel.Tokens.SignatureProvider
Public Overridable Function CreateForSigning (key As SecurityKey, algorithm As String, cacheProvider As Boolean) As SignatureProvider

Parameters

key
SecurityKey

the SecurityKey to use for signing.

algorithm
String

the algorithm to use for signing.

cacheProvider
Boolean

indicates if the SignatureProvider should be cached for reuse.

Returns

A SignatureProvider that can be used to create a signature using the SecurityKey and algorithm.

Exceptions

thrown if algorithm is null or empty.

thrown if KeySize is too small.

thrown if the key / algorithm is not supported.

thrown if Create(String, Object[]) returns a type that is not assignable from SignatureProvider.

Remarks

AsymmetricSignatureProviders require access to a PrivateKey for Signing.

When finished with the SignatureProvider call ReleaseSignatureProvider(SignatureProvider).

If CustomCryptoProvider is set and IsSupportedAlgorithm(String, Object[]) returns true. Create(String, Object[]) is called to obtain the SignatureProvider.

Applies to