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.​X509SecurityKey
Assembly: Microsoft.IdentityModel.Tokens
Inheritance: object → SecurityKey → AsymmetricSecurityKey → X509SecurityKey
An <see cref="T:Microsoft.IdentityModel.Tokens.AsymmetricSecurityKey" /> that is backed by a <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" />
Properties
public
int
KeySize
Gets the key size.
public
string
X5t
Gets the X5t of this <see cref="T:Microsoft.IdentityModel.Tokens.X509SecurityKey" /> .
public
System.​Security.​Cryptography.​AsymmetricAlgorithm
PrivateKey
Returns the private key from the <see cref="T:Microsoft.IdentityModel.Tokens.X509SecurityKey" /> .
public
System.​Security.​Cryptography.​AsymmetricAlgorithm
PublicKey
Gets the public key from the <see cref="T:Microsoft.IdentityModel.Tokens.X509SecurityKey" /> .
public
bool
HasPrivateKey
Gets a bool indicating if a private key exists.
public
PrivateKeyStatus
PrivateKeyStatus
Gets an enum indicating if a private key exists.
Certificate
Gets the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> .
public
string
KeyId
Gets the key id of this <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> .
public
CryptoProviderFactory
CryptoProviderFactory
Gets or sets <see cref="T:Microsoft.IdentityModel.Tokens.CryptoProviderFactory" /> .
Methods
public
bool
CanComputeJwkThumbprint​()
Determines whether the <see cref="T:Microsoft.IdentityModel.Tokens.X509SecurityKey" /> can compute a JWK thumbprint.
Returns <c>true</c> if JWK thumbprint can be computed; otherwise, <c>false</c> .
Remarks
https://datatracker.ietf.org/doc/html/rfc7638
public
byte[]
ComputeJwkThumbprint​()
Computes a sha256 hash over the <see cref="T:Microsoft.IdentityModel.Tokens.X509SecurityKey" /> .
Returns A JWK thumbprint.
Remarks
https://datatracker.ietf.org/doc/html/rfc7638
public
bool
Equals​(object obj)
Returns a bool indicating if this key is equivalent to another key.
public
int
GetHashCode​()
Returns an int hash code.
public
string
ToString​()
Inherited from SecurityKey
Returns the formatted string: GetType(), KeyId: 'value', InternalId: 'value'.
Returns string
public
bool
IsSupportedAlgorithm​(string algorithm)
Inherited from SecurityKey
Checks if <see cref="P:Microsoft.IdentityModel.Tokens.SecurityKey.CryptoProviderFactory" /> can perform the cryptographic operation specified by the <paramref name="algorithm" /> with this <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> .
Returns true if <see cref="P:Microsoft.IdentityModel.Tokens.SecurityKey.CryptoProviderFactory" /> can perform the cryptographic operation sepecified by the <paramref name="algorithm" /> with this <see cref="T:Microsoft.IdentityModel.Tokens.SecurityKey" /> .
algorithm
the algorithm to be used.
protected
void
Finalize​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object