#### [Abblix\.Jwt](https://www.abblix.com/docs/api/abblix-jwt 'index')
### [Abblix\.Jwt](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt 'Abblix\.Jwt')

## CertificateJsonWebKeyExtensions Class

Converts an X\.509 certificate into a JSON Web Key: its public key, its private key when asked for, the
`use` its Key Usage extension permits, and the certificate itself\.

```csharp
public static class CertificateJsonWebKeyExtensions
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → CertificateJsonWebKeyExtensions
### Methods

## CertificateJsonWebKeyExtensions\.Apply\<T\>\(this T, X509Certificate2\) Method {#Abblix.Jwt.CertificateJsonWebKeyExtensions.Apply_T_(thisT,System.Security.Cryptography.X509Certificates.X509Certificate2)}

Applies X509Certificate2 properties to a JsonWebKey\.

```csharp
public static T Apply<T>(this T jwk, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
    where T : Abblix.Jwt.JsonWebKey;
```
#### Type parameters

###### `T` {#Abblix.Jwt.CertificateJsonWebKeyExtensions.Apply_T_(thisT,System.Security.Cryptography.X509Certificates.X509Certificate2).T}

The type of JsonWebKey \(must be a subclass\)\.
#### Parameters

###### `jwk` [T](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.CertificateJsonWebKeyExtensions#Abblix.Jwt.CertificateJsonWebKeyExtensions.Apply_T_(thisT,System.Security.Cryptography.X509Certificates.X509Certificate2).T 'Abblix\.Jwt\.CertificateJsonWebKeyExtensions\.Apply\<T\>\(this T, System\.Security\.Cryptography\.X509Certificates\.X509Certificate2\)\.T') {#Abblix.Jwt.CertificateJsonWebKeyExtensions.Apply_T_(thisT,System.Security.Cryptography.X509Certificates.X509Certificate2).jwk}

The JsonWebKey to which the certificate properties are to be applied\.

###### `certificate` [System\.Security\.Cryptography\.X509Certificates\.X509Certificate2](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2 'System\.Security\.Cryptography\.X509Certificates\.X509Certificate2') {#Abblix.Jwt.CertificateJsonWebKeyExtensions.Apply_T_(thisT,System.Security.Cryptography.X509Certificates.X509Certificate2).certificate}

The X509Certificate2 providing the properties\.

#### Returns
[T](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.CertificateJsonWebKeyExtensions#Abblix.Jwt.CertificateJsonWebKeyExtensions.Apply_T_(thisT,System.Security.Cryptography.X509Certificates.X509Certificate2).T 'Abblix\.Jwt\.CertificateJsonWebKeyExtensions\.Apply\<T\>\(this T, System\.Security\.Cryptography\.X509Certificates\.X509Certificate2\)\.T')  
The updated JsonWebKey with applied certificate properties\.

## CertificateJsonWebKeyExtensions\.ToJsonWebKey\(this X509Certificate2, bool\) Method {#Abblix.Jwt.CertificateJsonWebKeyExtensions.ToJsonWebKey(thisSystem.Security.Cryptography.X509Certificates.X509Certificate2,bool)}

Converts an X509Certificate2 to a JsonWebKey\. The private keys can be optionally included in the conversion\.

```csharp
public static Abblix.Jwt.JsonWebKey ToJsonWebKey(this System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, bool includePrivateKeys=false);
```
#### Parameters

###### `certificate` [System\.Security\.Cryptography\.X509Certificates\.X509Certificate2](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2 'System\.Security\.Cryptography\.X509Certificates\.X509Certificate2') {#Abblix.Jwt.CertificateJsonWebKeyExtensions.ToJsonWebKey(thisSystem.Security.Cryptography.X509Certificates.X509Certificate2,bool).certificate}

The X509Certificate2 to convert\.

###### `includePrivateKeys` [System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean') {#Abblix.Jwt.CertificateJsonWebKeyExtensions.ToJsonWebKey(thisSystem.Security.Cryptography.X509Certificates.X509Certificate2,bool).includePrivateKeys}

Indicates whether to include private keys in the conversion\.

#### Returns
[JsonWebKey](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.JsonWebKey 'Abblix\.Jwt\.JsonWebKey')  
A JsonWebKey representing the certificate\.
