Pular para o conteúdo principal

PKCertificate

Namespace: Lacuna.Pki
Assembly: Lacuna.Pki
Class

public class PKCertificate : Certificate

Hierarquia: objectCertificatePKCertificate

Construtores

PKCertificate(byte[], bool, ICertificateStore)

protected PKCertificate(byte[] certContent, bool fillChain, ICertificateStore certStore)

Parâmetros

NomeTipoDescrição
certContentbyte[]
fillChainbool
certStoreICertificateStore

Propriedades

DnsNames

SSL Certificate DNS Names

public List<string> DnsNames { get; }

Retorno

List<string>


EmailAddress

public string EmailAddress { get; }

Retorno

string


ExtendedKeyUsage

The subject's extended key usage, or null if the extension is not present.

public ExtendedKeyUsage? ExtendedKeyUsage { get; }

Retorno

ExtendedKeyUsage?


IsCA

Denotes whether this certificate is a Certification Authority certificate, that is, if it may be used to verify certificate signatures, as defined in RFC 5280 item 4.2.1.9.

public bool IsCA { get; }

Retorno

bool


IsSelfSigned

Denotes whether this is a self-signed certificate (root certificate) or not.

NOTICE: never test the condition Issuer==null to assertain if a certificate is self-signed, since that condition may throw an exception in case the certificate is not a self-signed certificate but its issuer could not be located. For such purposes, use this property instead.

public override bool IsSelfSigned { get; }

Retorno

bool


IssuerDisplayName

public override string IssuerDisplayName { get; }

Retorno

string


IssuerDN

protected override Name IssuerDN { get; }

Retorno

Name


IssuerName

The certificate's issuer name

public Name IssuerName { get; protected set; }

Retorno

Name


KeyUsage

The subject's key usage, or null if the KeyUsage extension is not present.

public KeyUsage? KeyUsage { get; }

Retorno

KeyUsage?


PkiArgentina

Argentina PKI fields (INFRAESTRUCTURA DE FIRMA DIGITAL – REPÚBLICA ARGENTINA)

public ArgentinaCertificateFields PkiArgentina { get; }

Retorno

ArgentinaCertificateFields


PkiBrazil

Brazil PKI fields

public IcpBrasilCertificateFields PkiBrazil { get; }

Retorno

IcpBrasilCertificateFields


PkiEcuador

Ecuador PKI common certificate fields among BCE (Banco Central Del Ecuador) and Security Data entities

public EcuadorCertificateFields PkiEcuador { get; }

Retorno

EcuadorCertificateFields


PkiItaly

Italy PKI fields

public ItalyCertificateFields PkiItaly { get; }

Retorno

ItalyCertificateFields


PkiParaguay

Paraguay PKI fields

public ParaguayCertificateFields PkiParaguay { get; }

Retorno

ParaguayCertificateFields


PkiPeru

Peru PKI fields

public PeruCertificateFields PkiPeru { get; }

Retorno

PeruCertificateFields


SubjectDisplayName

public override string SubjectDisplayName { get; }

Retorno

string


SubjectKeyIdentifier

Returns the bytes of the SubjectKeyIdentifier extension, or null if the extension is not present.

public byte[] SubjectKeyIdentifier { get; }

Retorno

byte[]


SubjectName

The subject's name

public Name SubjectName { get; protected set; }

Retorno

Name


SubjectPKAlgorithm

The public-key algorithm of the subject's public key

public PKAlgorithm SubjectPKAlgorithm { get; protected set; }

Retorno

PKAlgorithm


SubjectPublicKey

The subject's public key

public PublicKey SubjectPublicKey { get; protected set; }

Retorno

PublicKey


Métodos

Decode(byte[], ICertificateStore)

Decodes and creates a certificate object from certificate bytes BER, DER, Base64 or PEM encoded. With certificate chain loading.

public static PKCertificate Decode(byte[] certContent, ICertificateStore certStore)

Parâmetros

NomeTipoDescrição
certContentbyte[]Certificate bytes BER, DER, Base64 or PEM encoded
certStoreICertificateStoreCertificate store to assist the chain loading

Retorno

PKCertificate — PKCertificate object


Decode(byte[])

Decodes and creates a certificate object from certificate bytes BER, DER, Base64 or PEM encoded. Without loading the certificate chain.

public static PKCertificate Decode(byte[] certContent)

Parâmetros

NomeTipoDescrição
certContentbyte[]Certificate bytes BER, DER, Base64 or PEM encoded

Retorno

PKCertificate — PKCertificate object


Decode(string, ICertificateStore)

Decodes and creates a certificate object from certificate Base64 or PEM encoded. With certificate chain loading.

public static PKCertificate Decode(string certContent, ICertificateStore certStore)

Parâmetros

NomeTipoDescrição
certContentstringCertificate Base64 or PEM encoded
certStoreICertificateStoreCertificate store to assist the chain loading

Retorno

PKCertificate — PKCertificate object


Decode(string)

Decodes and creates a certificate object from certificate Base64 or PEM encoded. Without loading the certificate chain.

public static PKCertificate Decode(string certContent)

Parâmetros

NomeTipoDescrição
certContentstringCertificate Base64 or PEM encoded

Retorno

PKCertificate — PKCertificate object


DecodeWithoutChainLoading(byte[])

Decodes and creates a certificate object without chain loading from certificate bytes BER, DER, Base64 or PEM encoded. Without loading the certificate chain.

[Obsolete("Use PKCertificate.Decode(certContent) instead")]
public static PKCertificate DecodeWithoutChainLoading(byte[] certContent)

Parâmetros

NomeTipoDescrição
certContentbyte[]Certificate bytes BER, DER, Base64 or PEM encoded

Retorno

PKCertificate — PKCertificate object


DecodeWithoutChainLoading(string)

Decodes and creates a certificate object without chain loading from certificate Base64 or PEM encoded. Without loading the certificate chain.

[Obsolete("Use PKCertificate.Decode(certContent) instead")]
public static PKCertificate DecodeWithoutChainLoading(string certContent)

Parâmetros

NomeTipoDescrição
certContentstringCertificate Base64 or PEM encoded

Retorno

PKCertificate — PKCertificate object


GetCertificateChain()

public List<PKCertificate> GetCertificateChain()

Retorno

List<PKCertificate>


GetOrGenerateSubjectKeyIdentifier()

If the certificate contains a Subject Key Identifier extension, returns the value of the key identifier. Otherwise, generates a key identifier using the SHA-1 digest algorithm, as specified in RFC 5280. NOTE: in some cases, one must only reference a certificate by its SubjectKeyIdentifier if the EXTENSION is present. If such cases, use the property SubjectKeyIdentifier instead, that returns a value only if the extension is present.

public byte[] GetOrGenerateSubjectKeyIdentifier()

Retorno

byte[]


GetSignatureCsp(DigestAlgorithm)

public ISignatureCsp GetSignatureCsp(DigestAlgorithm digestAlgorithm)

Parâmetros

NomeTipoDescrição
digestAlgorithmDigestAlgorithm

Retorno

ISignatureCsp


GetSignatureCsp(SignatureAlgorithm)

public ISignatureCsp GetSignatureCsp(SignatureAlgorithm signatureAlgorithm)

Parâmetros

NomeTipoDescrição
signatureAlgorithmSignatureAlgorithm

Retorno

ISignatureCsp


GetTbsCertificateEncoded()

protected override byte[] GetTbsCertificateEncoded()

Retorno

byte[]


IsFinalCA()

Returns whether or not the certificate is a final CA. That is, if the certificate is a CA that can issue end entities certificates only. This method may require certificate chain loading, which can throw exceptions.

public bool IsFinalCA()

Retorno

bool — Whether or not the certificate is a final CA

Exceções

TipoCondição
InvalidOperationExceptionThrown when the current certificate is not a CA
CertificateIssuerNotFoundExceptionThrown when certificate chain loading is required but fails
CertificateChainExceptionThrown when the certificate chain does not have a valid path length

ToString()

public override string ToString()

Retorno

string


Membros herdados

issuer, Validate(ITrustArbitrator), Validate(CertificateValidationOptions), TryFillIssuer(ICertificateStore), Equals(object), GetHashCode(), EncodedValue, ValidityStart, ValidityEnd, SignatureValue, SerialNumber, Extensions, SignatureAlgorithm, Issuer, IssuerFound, IssuerNotFound, TrustAnchor, TbsCertificateEncoded, ThumbprintSHA1, ThumbprintSHA256, AuthorityInformationAccess, CAIssuersUri, OcspUri, IssuerKeyIdentifier, Equals(object, object), ReferenceEquals(object, object), GetType(), MemberwiseClone()