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.​JsonWebKey
Assembly: Microsoft.IdentityModel.Tokens
Inheritance: object → SecurityKey → JsonWebKey
Represents a JSON Web Key as defined in https://datatracker.ietf.org/doc/html/rfc7517.
Properties
public
System.​Collections.​Generic.​IDictionary<​string, object>
AdditionalData
When deserializing from JSON any properties that are not defined will be placed here.
public
string
Alg
Gets or sets the 'alg' (KeyType).
public
string
Crv
Gets or sets the 'crv' (ECC - Curve).
public
string
D
Gets or sets the 'd' (ECC - Private Key OR RSA - Private Exponent).
Remarks Value is formated as: Base64urlUInt
public
string
DP
Gets or sets the 'dp' (RSA - First Factor CRT Exponent).
Remarks Value is formated as: Base64urlUInt
public
string
DQ
Gets or sets the 'dq' (RSA - Second Factor CRT Exponent).
Remarks Value is formated as: Base64urlUInt
public
string
E
Gets or sets the 'e' (RSA - Exponent).
public
string
K
Gets or sets the 'k' (Symmetric - Key Value).
public
string
KeyId
Gets the key id of this <see cref="T:Microsoft.IdentityModel.Tokens.JsonWebKey" /> .
public
System.​Collections.​Generic.​IList<​string>
KeyOps
Gets the 'key_ops' (Key Operations).
public
string
Kid
Gets or sets the 'kid' (Key ID)..
public
string
Kty
Gets or sets the 'kty' (Key Type).
public
string
N
Gets or sets the 'n' (RSA - Modulus).
Remarks Value is formatted as: Base64urlEncoding
public
System.​Collections.​Generic.​IList<​string>
Oth
Gets or sets the 'oth' (RSA - Other Primes Info).
public
string
P
Gets or sets the 'p' (RSA - First Prime Factor)..
Remarks Value is formatted as: Base64urlUInt
public
string
Q
Gets or sets the 'q' (RSA - Second Prime Factor)..
Remarks Value is formatted as: Base64urlUInt
public
string
QI
Gets or sets the 'qi' (RSA - First CRT Coefficient)..
Remarks Value is formatted as: Base64urlUInt
public
string
Use
Gets or sets the 'use' (Public Key Use)..
public
string
X
Gets or sets the 'x' (ECC - X Coordinate)..
Remarks Value is formatted as: Base64urlEncoding
public
System.​Collections.​Generic.​IList<​string>
X5c
Gets the 'x5c' collection (X.509 Certificate Chain)..
public
string
X5t
Gets or sets the 'x5t' (X.509 Certificate SHA-1 thumbprint)..
public
string
X5tS256
Gets or sets the 'x5t#S256' (X.509 Certificate SHA-256 thumbprint)..
public
string
X5u
Gets or sets the 'x5u' (X.509 URL)..
public
string
Y
Gets or sets the 'y' (ECC - Y Coordinate)..
Remarks Value is formatted as: Base64urlEncoding
public
int
KeySize
Gets the key size of <see cref="T:Microsoft.IdentityModel.Tokens.JsonWebKey" /> .
public
bool
HasPrivateKey
Gets a bool indicating if a private key exists.
public
CryptoProviderFactory
CryptoProviderFactory
Gets or sets <see cref="T:Microsoft.IdentityModel.Tokens.CryptoProviderFactory" /> .
Methods
public static
JsonWebKey
Create​(string json)
Returns a new instance of <see cref="T:Microsoft.IdentityModel.Tokens.JsonWebKey" /> .
Returns <see cref="T:Microsoft.IdentityModel.Tokens.JsonWebKey" />
json
A string that contains JSON Web Key parameters in JSON format.
public
bool
CanComputeJwkThumbprint​()
Determines whether the <see cref="T:Microsoft.IdentityModel.Tokens.JsonWebKey" /> 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 the JWK thumprint per spec: https://datatracker.ietf.org/doc/html/rfc7638 />.
Returns A the JWK thumbprint.
public
string
ToString​()
Returns the formatted string: GetType(), Use: 'value', Kid: 'value', Kty: '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.
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