Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​IdentityModel.​Tokens.​SignatureProvider
Assembly: Microsoft.IdentityModel.Tokens
Inheritance: object → SignatureProvider
Implemented Interfaces
Provides signature services, signing and verifying.
Properties
public
string
Algorithm
Gets the signature algorithm.
public
string
Context
Gets or sets a user context for a <see cref="T:Microsoft.IdentityModel.Tokens.SignatureProvider" /> .
Remarks This is null by default. This is for use by the application and not used by this SDK.
public
CryptoProviderCache
CryptoProviderCache
Gets or sets the <see cref="P:Microsoft.IdentityModel.Tokens.SignatureProvider.CryptoProviderCache" /> that is associated with this <see cref="T:Microsoft.IdentityModel.Tokens.SignatureProvider" />
public
SecurityKey
Key
Gets the <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> .
public
bool
WillCreateSignatures
Gets or sets a bool indicating if this <see cref="T:Microsoft.IdentityModel.Tokens.SignatureProvider" /> is expected to create signatures.
Methods
public
void
Dispose​()
Calls <see cref="M:Microsoft.IdentityModel.Tokens.SignatureProvider.Dispose(System.Boolean)" /> and <see cref="M:System.GC.SuppressFinalize(System.Object)" />
protected
void
Dispose​(bool disposing)
Can be over written in descendants to dispose of internal components.
disposing
true, if called from Dispose(), false, if invoked inside a finalizer
public
byte[]
Sign​(byte[] input)
This must be overridden to produce a signature over the 'input'.
Returns signed bytes
input
bytes to sign.
public
byte[]
Sign​(byte[] input,
int offset,
int count)
Produces a signature over the specified region of the <paramref name="input" /> .
Returns The signature bytes.
input
The bytes to produce a signature over.
offset
The offset to specify the beginning of the region.
count
The count to specify the end of the region.
public
bool
Sign​(System.​ReadOnlySpan<​byte> data,
System.​Span<​byte> destination,
System.​Int32& bytesWritten)
public
bool
Verify​(byte[] input,
byte[] signature)
Verifies that the <paramref name="signature" /> over <paramref name="input" /> using the
<see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> and <see cref="P:Microsoft.IdentityModel.Tokens.SignatureProvider.Algorithm" /> specified by this
<see cref="T:Microsoft.IdentityModel.Tokens.SignatureProvider" /> are consistent.
Returns true if the computed signature matches the signature parameter, false otherwise.
input
the bytes that were signed.
signature
signature to compare against.
public
bool
Verify​(byte[] input,
int inputOffset,
int inputLength,
byte[] signature,
int signatureOffset,
int signatureLength)
Verifies that a signature created over the 'input' matches the signature. Using <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> and 'algorithm' passed to <see cref="M:Microsoft.IdentityModel.Tokens.SignatureProvider.#ctor(Microsoft.IdentityModel.Tokens.SecurityKey,System.String)" /> .
Returns true if computed signature matches the signature parameter, false otherwise.
input
The bytes to verify.
inputOffset
offset in to input bytes to caculate hash.
inputLength
number of bytes of signature to use.
signature
signature to compare against.
signatureOffset
offset into signature array.
signatureLength
how many bytes to verfiy.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object