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

# PKCertificateWithKey

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

```csharp
public class PKCertificateWithKey
```

**Hierarquia:** [`object`](https://learn.microsoft.com/dotnet/api/system.object) → `PKCertificateWithKey`

## Construtores

### `PKCertificateWithKey(PKCertificate, IPrivateKey)`

```csharp
public PKCertificateWithKey(PKCertificate certificate, IPrivateKey privateKey)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `certificate` | [`PKCertificate`](https://docs.lacunasoftware.com/api/Lacuna.Pki/PKCertificate) |  |
| `privateKey` | [`IPrivateKey`](https://docs.lacunasoftware.com/api/Lacuna.Pki/IPrivateKey) |  |

---

## Propriedades

### `Certificate`

```csharp
public PKCertificate Certificate { get; }
```

**Retorno**

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

---

### `PrivateKey`

```csharp
public IPrivateKey PrivateKey { get; }
```

**Retorno**

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

---

## Métodos

### `GetEncryptionCsp()`

```csharp
public IEncryptionCsp GetEncryptionCsp()
```

**Retorno**

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

---

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

---

### `SignData(DigestAlgorithm, byte[])`

```csharp
public byte[] SignData(DigestAlgorithm digestAlgorithm, byte[] buffer)
```

**Parâmetros**

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

**Retorno**

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

---

### `SignData(SignatureAlgorithm, byte[])`

```csharp
public byte[] SignData(SignatureAlgorithm signatureAlgorithm, byte[] buffer)
```

**Parâmetros**

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

**Retorno**

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

---

### `SignHash(DigestAlgorithm, byte[])`

```csharp
public byte[] SignHash(DigestAlgorithm digestAlgorithm, byte[] hash)
```

**Parâmetros**

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

**Retorno**

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

---

### `SignHash(SignatureAlgorithm, byte[])`

```csharp
public byte[] SignHash(SignatureAlgorithm signatureAlgorithm, byte[] hash)
```

**Parâmetros**

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

**Retorno**

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

---

### `VerifyData(DigestAlgorithm, byte[], byte[])`

```csharp
public bool VerifyData(DigestAlgorithm digestAlgorithm, byte[] dataSigned, byte[] signature)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `digestAlgorithm` | [`DigestAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/DigestAlgorithm) |  |
| `dataSigned` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |
| `signature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |

**Retorno**

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

---

### `VerifyData(SignatureAlgorithm, byte[], byte[])`

```csharp
public bool VerifyData(SignatureAlgorithm signatureAlgorithm, byte[] dataSigned, byte[] signature)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `signatureAlgorithm` | [`SignatureAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/SignatureAlgorithm) |  |
| `dataSigned` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |
| `signature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |

**Retorno**

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

---

### `VerifyHash(DigestAlgorithm, byte[], byte[])`

```csharp
public bool VerifyHash(DigestAlgorithm digestAlgorithm, byte[] hashSigned, byte[] signature)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `digestAlgorithm` | [`DigestAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/DigestAlgorithm) |  |
| `hashSigned` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |
| `signature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |

**Retorno**

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

---

### `VerifyHash(SignatureAlgorithm, byte[], byte[])`

```csharp
public bool VerifyHash(SignatureAlgorithm signatureAlgorithm, byte[] hashSigned, byte[] signature)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `signatureAlgorithm` | [`SignatureAlgorithm`](https://docs.lacunasoftware.com/api/Lacuna.Pki/SignatureAlgorithm) |  |
| `hashSigned` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |
| `signature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |

**Retorno**

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

---

## Membros herdados

[`ToString()`](https://learn.microsoft.com/dotnet/api/system.object.tostring), [`Equals(object)`](<https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)>), [`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), [`GetHashCode()`](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [`GetType()`](https://learn.microsoft.com/dotnet/api/system.object.gettype), [`MemberwiseClone()`](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)
