Table of Contents

Class Certificate

Namespace
Org.BouncyCastle.Tls
Assembly
BouncyCastle.Cryptography.dll

Parsing and encoding of a Certificate struct from RFC 4346.

public sealed class Certificate
Inheritance
Certificate
Inherited Members

Remarks

opaque ASN.1Cert<2^24-1>;
struct {
  ASN.1Cert certificate_list<0..2^24-1>;
} Certificate;

Constructors

Certificate(TlsCertificate[])

public Certificate(TlsCertificate[] certificateList)

Parameters

certificateList TlsCertificate[]

Certificate(byte[], CertificateEntry[])

public Certificate(byte[] certificateRequestContext, CertificateEntry[] certificateEntryList)

Parameters

certificateRequestContext byte[]
certificateEntryList CertificateEntry[]

Certificate(short, byte[], CertificateEntry[])

public Certificate(short certificateType, byte[] certificateRequestContext, CertificateEntry[] certificateEntryList)

Parameters

certificateType short
certificateRequestContext byte[]
certificateEntryList CertificateEntry[]

Fields

EmptyChain

public static readonly Certificate EmptyChain

Field Value

Certificate

EmptyChainTls13

public static readonly Certificate EmptyChainTls13

Field Value

Certificate

Properties

CertificateType

public short CertificateType { get; }

Property Value

short

IsEmpty

public bool IsEmpty { get; }

Property Value

bool

true if this certificate chain contains no certificates, or false otherwise.

Length

public int Length { get; }

Property Value

int

Methods

Encode(TlsContext, Stream, Stream)

Encode this Certificate to a Stream, and optionally calculate the "end point hash" (per RFC 5929's tls-server-end-point binding).

public void Encode(TlsContext context, Stream messageOutput, Stream endPointHashOutput)

Parameters

context TlsContext

the TlsContext of the current connection.

messageOutput Stream

the Stream to encode to.

endPointHashOutput Stream

the Stream to write the "end point hash" to (or null).

Exceptions

IOException

GetCertificateAt(int)

public TlsCertificate GetCertificateAt(int index)

Parameters

index int

Returns

TlsCertificate

GetCertificateEntryAt(int)

public CertificateEntry GetCertificateEntryAt(int index)

Parameters

index int

Returns

CertificateEntry

GetCertificateEntryList()

public CertificateEntry[] GetCertificateEntryList()

Returns

CertificateEntry[]

GetCertificateList()

public TlsCertificate[] GetCertificateList()

Returns

TlsCertificate[]

an array of TlsCertificate representing a certificate chain.

GetCertificateRequestContext()

public byte[] GetCertificateRequestContext()

Returns

byte[]

Parse(ParseOptions, TlsContext, Stream, Stream)

Parse a Certificate from a Stream.

public static Certificate Parse(Certificate.ParseOptions options, TlsContext context, Stream messageInput, Stream endPointHashOutput)

Parameters

options Certificate.ParseOptions

the Certificate.ParseOptions to apply during parsing.

context TlsContext

the TlsContext of the current connection.

messageInput Stream

the Stream to parse from.

endPointHashOutput Stream

the Stream to write the "end point hash" to (or null).

Returns

Certificate

a Certificate object.

Exceptions

IOException