CryptoProviderFactory.CreateForSigning 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
CreateForSigning(SecurityKey, String) |
Creates a SignatureProvider for signing with the specified |
CreateForSigning(SecurityKey, String, Boolean) |
Creates a SignatureProvider for signing with the specified |
CreateForSigning(SecurityKey, String)
Creates a SignatureProvider for signing with the specified key
and algorithm
.
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 instance that can be used to create a signature.
Exceptions
Thrown if algorithm
is null or empty.
Thrown if KeySize is too small.
Thrown if the key or algorithm combination is not supported.
Thrown if the type returned by Create(String, Object[]) is not assignable to SignatureProvider.
Remarks
AsymmetricSignatureProviders require access to a PrivateKey for signing.
Once done 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 for signing with the specified key
and algorithm
.
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 whether the SignatureProvider should be cached for reuse.
Returns
A SignatureProvider instance that can be used to create a signature.
Exceptions
Thrown if algorithm
is null or empty.
Thrown if KeySize is too small.
Thrown if the combination of key
and algorithm
is not supported.
Thrown if the type returned by Create(String, Object[]) is not assignable to SignatureProvider.
Remarks
AsymmetricSignatureProviders require access to a PrivateKey for signing.
Once done 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.