Table of Contents

Class CertificateAlgorithm<T>

Namespace
JWT.Algorithms
Assembly
Coherence.JWT.dll
public abstract class CertificateAlgorithm<T> : IAsymmetricAlgorithm, IJwtAlgorithm where T : class

Type Parameters

T
Inheritance
CertificateAlgorithm<T>
Implements
Derived
Extension Methods

Constructors

CertificateAlgorithm(X509Certificate2)

protected CertificateAlgorithm(X509Certificate2 cert)

Parameters

cert X509Certificate2

CertificateAlgorithm(T)

protected CertificateAlgorithm(T publicKey)

Parameters

publicKey T

CertificateAlgorithm(T, T)

protected CertificateAlgorithm(T publicKey, T privateKey)

Parameters

publicKey T
privateKey T

Fields

_privateKey

protected readonly T _privateKey

Field Value

T

_publicKey

protected readonly T _publicKey

Field Value

T

Properties

HashAlgorithmName

Gets name of the hashing algorithm (e.g. SHA-256/SHA-384/SHA-512).

public abstract HashAlgorithmName HashAlgorithmName { get; }

Property Value

HashAlgorithmName

Name

Gets algorithm name.

public abstract string Name { get; }

Property Value

string

Methods

GetPrivateKey(X509Certificate2)

protected abstract T GetPrivateKey(X509Certificate2 cert)

Parameters

cert X509Certificate2

Returns

T

GetPublicKey(X509Certificate2)

protected abstract T GetPublicKey(X509Certificate2 cert)

Parameters

cert X509Certificate2

Returns

T

Sign(byte[])

Signs the provided byte array with the private key.

public byte[] Sign(byte[] bytesToSign)

Parameters

bytesToSign byte[]

Returns

byte[]

Sign(byte[], byte[])

Signs provided byte array with provided key.

public byte[] Sign(byte[] key, byte[] bytesToSign)

Parameters

key byte[]

The key used to sign the data

bytesToSign byte[]

The data to sign

Returns

byte[]

SignData(byte[])

protected abstract byte[] SignData(byte[] bytesToSign)

Parameters

bytesToSign byte[]

Returns

byte[]

Verify(byte[], byte[])

Verifies provided byte array with provided signature.

public bool Verify(byte[] bytesToSign, byte[] signature)

Parameters

bytesToSign byte[]

The data to verify

signature byte[]

The signature to verify with

Returns

bool

VerifyData(byte[], byte[])

protected abstract bool VerifyData(byte[] bytesToSign, byte[] signature)

Parameters

bytesToSign byte[]
signature byte[]

Returns

bool