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

# PkiUtil

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

```csharp
public static class PkiUtil
```

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

## Propriedades

### `LastLogException`

```csharp
public static Exception LastLogException { get; set; }
```

**Retorno**

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

---

### `OfflineSignerConfigurator`

Validation configuration preset for offline signers. Use on methods SetCertificateValidationConfigurator

```csharp
public static Action<CertificateValidationOptions> OfflineSignerConfigurator { get; }
```

**Retorno**

[`Action<CertificateValidationOptions>`](https://learn.microsoft.com/dotnet/api/system.action-1)

---

## Métodos

### `Compress(byte[])`

```csharp
public static byte[] Compress(byte[] data)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `data` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |

**Retorno**

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

---

### `DecodeDerInteger(byte[])`

```csharp
public static BigInteger DecodeDerInteger(byte[] encoded)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `encoded` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |

**Retorno**

[`BigInteger`](https://learn.microsoft.com/dotnet/api/system.numerics.biginteger)

---

### `DecodeHexString(string)`

```csharp
public static byte[] DecodeHexString(string hexString)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `hexString` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) |  |

**Retorno**

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

---

### `Decompress(byte[])`

```csharp
public static byte[] Decompress(byte[] data)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `data` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) |  |

**Retorno**

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

---

### `EncodePem(PemObjects, byte[])`

```csharp
public static string EncodePem(PemObjects objectType, byte[] content)
```

**Parâmetros**

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

**Retorno**

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

---

### `EncodeToHexString(byte[], string, bool)`

Encodes a byte array to hex string

```csharp
public static string EncodeToHexString(byte[] content, string separator = "", bool upperCase = false)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `content` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | Content to encode |
| `separator` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) | Separator string between hex bytes. Default: no separator |
| `upperCase` | [`bool`](https://learn.microsoft.com/dotnet/api/system.boolean) | True for encoding an upper case hex string, False for lower case hex string. Default: lower case |

**Retorno**

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

---

### `FlushLog()`

```csharp
public static void FlushLog()
```

---

### `SetGlobalTimestampRequester(ITimestampRequester)`

```csharp
public static void SetGlobalTimestampRequester(ITimestampRequester tsRequester)
```

**Parâmetros**

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

---

### `SetGlobalUserCertificateStore(ICertificateStore)`

```csharp
public static void SetGlobalUserCertificateStore(ICertificateStore userCertificateStore)
```

**Parâmetros**

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

---

### `SetGlobalUserCertificateStore(IUserCertificateStore)`

```csharp
public static void SetGlobalUserCertificateStore(IUserCertificateStore userCertificateStore)
```

**Parâmetros**

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

---

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