---
title: "PKCertificate"
description: "Namespace: Lacuna.Pki"
canonical: "https://docs.lacunasoftware.com/api/Lacuna.Pki/PKCertificate"
locale: "pt-BR"
product: "PKI SDK"
last_updated: "2026-06-02"
---

# PKCertificate

**Namespace:** `Lacuna.Pki`  
**Assembly:** `Lacuna.Pki`  
_Class_

```csharp
public class PKCertificate : Certificate
```

**Hierarquia:** [`object`](https://learn.microsoft.com/dotnet/api/system.object) → [`Certificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate) → `PKCertificate`

## Construtores

### `PKCertificate(byte[], bool, ICertificateStore)`

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

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certContent` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |
| `fillChain` | [`bool`](https://learn.microsoft.com/dotnet/api/system.boolean) |  |
| `certStore` | [`ICertificateStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ICertificateStore) |  |

---

## Propriedades

### `DnsNames`

SSL Certificate DNS Names

```csharp
public List<string> DnsNames { get; }
```

**Retorno**

[`List<string>`](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)

---

### `EmailAddress`

```csharp
public string EmailAddress { get; }
```

**Retorno**

[`string`](https://learn.microsoft.com/dotnet/api/system.string)

---

### `ExtendedKeyUsage`

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

```csharp
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.

```csharp
public bool IsCA { get; }
```

**Retorno**

[`bool`](https://learn.microsoft.com/dotnet/api/system.boolean)

---

### `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.

```csharp
public override bool IsSelfSigned { get; }
```

**Retorno**

[`bool`](https://learn.microsoft.com/dotnet/api/system.boolean)

---

### `IssuerDisplayName`

```csharp
public override string IssuerDisplayName { get; }
```

**Retorno**

[`string`](https://learn.microsoft.com/dotnet/api/system.string)

---

### `IssuerDN`

```csharp
protected override Name IssuerDN { get; }
```

**Retorno**

[`Name`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Name)

---

### `IssuerName`

The certificate's issuer name

```csharp
public Name IssuerName { get; protected set; }
```

**Retorno**

[`Name`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Name)

---

### `KeyUsage`

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

```csharp
public KeyUsage? KeyUsage { get; }
```

**Retorno**

`KeyUsage?`

---

### `PkiArgentina`

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

```csharp
public ArgentinaCertificateFields PkiArgentina { get; }
```

**Retorno**

[`ArgentinaCertificateFields`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ArgentinaCertificateFields)

---

### `PkiBrazil`

Brazil PKI fields

```csharp
public IcpBrasilCertificateFields PkiBrazil { get; }
```

**Retorno**

[`IcpBrasilCertificateFields`](https://docs.lacunasoftware.com/api/Lacuna.Pki/IcpBrasilCertificateFields)

---

### `PkiEcuador`

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

```csharp
public EcuadorCertificateFields PkiEcuador { get; }
```

**Retorno**

[`EcuadorCertificateFields`](https://docs.lacunasoftware.com/api/Lacuna.Pki/EcuadorCertificateFields)

---

### `PkiItaly`

Italy PKI fields

```csharp
public ItalyCertificateFields PkiItaly { get; }
```

**Retorno**

[`ItalyCertificateFields`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ItalyCertificateFields)

---

### `PkiParaguay`

Paraguay PKI fields

```csharp
public ParaguayCertificateFields PkiParaguay { get; }
```

**Retorno**

[`ParaguayCertificateFields`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ParaguayCertificateFields)

---

### `PkiPeru`

Peru PKI fields

```csharp
public PeruCertificateFields PkiPeru { get; }
```

**Retorno**

[`PeruCertificateFields`](https://docs.lacunasoftware.com/api/Lacuna.Pki/PeruCertificateFields)

---

### `SubjectDisplayName`

```csharp
public override string SubjectDisplayName { get; }
```

**Retorno**

[`string`](https://learn.microsoft.com/dotnet/api/system.string)

---

### `SubjectKeyIdentifier`

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

```csharp
public byte[] SubjectKeyIdentifier { get; }
```

**Retorno**

[`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte)

---

### `SubjectName`

The subject's name

```csharp
public Name SubjectName { get; protected set; }
```

**Retorno**

[`Name`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Name)

---

### `SubjectPKAlgorithm`

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

```csharp
public PKAlgorithm SubjectPKAlgorithm { get; protected set; }
```

**Retorno**

[`PKAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/PKAlgorithm)

---

### `SubjectPublicKey`

The subject's public key

```csharp
public PublicKey SubjectPublicKey { get; protected set; }
```

**Retorno**

[`PublicKey`](https://docs.lacunasoftware.com/api/Lacuna.Pki/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.

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

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certContent` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | Certificate bytes BER, DER, Base64 or PEM encoded |
| `certStore` | [`ICertificateStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ICertificateStore) | Certificate store to assist the chain loading |

**Retorno**

[`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/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.

```csharp
public static PKCertificate Decode(byte[] certContent)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certContent` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | Certificate bytes BER, DER, Base64 or PEM encoded |

**Retorno**

[`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/PKCertificate) — PKCertificate object

---

### `Decode(string, ICertificateStore)`

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

```csharp
public static PKCertificate Decode(string certContent, ICertificateStore certStore)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certContent` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) | Certificate Base64 or PEM encoded |
| `certStore` | [`ICertificateStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ICertificateStore) | Certificate store to assist the chain loading |

**Retorno**

[`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/PKCertificate) — PKCertificate object

---

### `Decode(string)`

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

```csharp
public static PKCertificate Decode(string certContent)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certContent` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) | Certificate Base64 or PEM encoded |

**Retorno**

[`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/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.

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

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certContent` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | Certificate bytes BER, DER, Base64 or PEM encoded |

**Retorno**

[`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/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.

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

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certContent` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) | Certificate Base64 or PEM encoded |

**Retorno**

[`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/PKCertificate) — PKCertificate object

---

### `GetCertificateChain()`

```csharp
public List<PKCertificate> GetCertificateChain()
```

**Retorno**

[`List<PKCertificate>`](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)

---

### `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.

```csharp
public byte[] GetOrGenerateSubjectKeyIdentifier()
```

**Retorno**

[`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte)

---

### `GetSignatureCsp(DigestAlgorithm)`

```csharp
public ISignatureCsp GetSignatureCsp(DigestAlgorithm digestAlgorithm)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `digestAlgorithm` | [`DigestAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/DigestAlgorithm) |  |

**Retorno**

[`ISignatureCsp`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ISignatureCsp)

---

### `GetSignatureCsp(SignatureAlgorithm)`

```csharp
public ISignatureCsp GetSignatureCsp(SignatureAlgorithm signatureAlgorithm)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `signatureAlgorithm` | [`SignatureAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/SignatureAlgorithm) |  |

**Retorno**

[`ISignatureCsp`](https://docs.lacunasoftware.com/api/Lacuna.Pki/ISignatureCsp)

---

### `GetTbsCertificateEncoded()`

```csharp
protected override byte[] GetTbsCertificateEncoded()
```

**Retorno**

[`byte[]`](https://learn.microsoft.com/dotnet/api/system.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.

```csharp
public bool IsFinalCA()
```

**Retorno**

[`bool`](https://learn.microsoft.com/dotnet/api/system.boolean) — Whether or not the certificate is a final CA

**Exceções**

| Tipo | Condição |
|---|---|
| [`InvalidOperationException`](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | Thrown when the current certificate is not a CA |
| [`CertificateIssuerNotFoundException`](https://docs.lacunasoftware.com/api/Lacuna.Pki/CertificateIssuerNotFoundException) | Thrown when certificate chain loading is required but fails |
| [`CertificateChainException`](https://docs.lacunasoftware.com/api/Lacuna.Pki/CertificateChainException) | Thrown when the certificate chain does not have a valid path length |

---

### `ToString()`

```csharp
public override string ToString()
```

**Retorno**

[`string`](https://learn.microsoft.com/dotnet/api/system.string)

---

## Membros herdados

[`issuer`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#issuer), [`Validate(ITrustArbitrator)`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#validate-lacuna-pki-itrustarbitrator), [`Validate(CertificateValidationOptions)`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#validate-lacuna-pki-certificatevalidationoptions), [`TryFillIssuer(ICertificateStore)`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#tryfillissuer-lacuna-pki-stores-icertificatestore), [`Equals(object)`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#equals-system-object), [`GetHashCode()`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#gethashcode), [`EncodedValue`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#encodedvalue), [`ValidityStart`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#validitystart), [`ValidityEnd`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#validityend), [`SignatureValue`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#signaturevalue), [`SerialNumber`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#serialnumber), [`Extensions`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#extensions), [`SignatureAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#signaturealgorithm), [`Issuer`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#issuer), [`IssuerFound`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#issuerfound), [`IssuerNotFound`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#issuernotfound), [`TrustAnchor`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#trustanchor), [`TbsCertificateEncoded`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#tbscertificateencoded), [`ThumbprintSHA1`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#thumbprintsha1), [`ThumbprintSHA256`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#thumbprintsha256), [`AuthorityInformationAccess`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#authorityinformationaccess), [`CAIssuersUri`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#caissuersuri), [`OcspUri`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#ocspuri), [`IssuerKeyIdentifier`](https://docs.lacunasoftware.com/api/Lacuna.Pki/Certificate#issuerkeyidentifier), [`Equals(object, object)`](<https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)>), [`ReferenceEquals(object, object)`](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [`GetType()`](https://learn.microsoft.com/dotnet/api/system.object.gettype), [`MemberwiseClone()`](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)
