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

# CadesSignatureCompression

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

Class with methods for compressing and decompressing CAdES signatures storing objects likely to be repeated across different
signatures such as certificates and CRLs on an external store, avoiding redundant storage of such objects.

```csharp
public static class CadesSignatureCompression
```

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

## Métodos

### `Compress(byte[], ISimpleStore, out byte[])`

Compresses a CAdES signature storing objects likely to be repeated across different signatures such as certificates and CRLs in an
external store, separating the encapsulated content within the signature (attached signature) if present.

```csharp
public static byte[] Compress(byte[] cadesSignature, ISimpleStore store, out byte[] encapsulatedContent)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `cadesSignature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | The CAdES signature to be compressed. |
| `store` | [`ISimpleStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ISimpleStore) | The external store on which to store the repeatable objects. |
| `encapsulatedContent` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | When this method returns, contains the encapsulated content within the signature, if any. |

**Retorno**

[`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) — The compressed signature in a proprietary format that can be decompressed with the `Byte%5b%5d)` method.

**Comentários**

The given signature need not have been generated by the SDK, it can be any CAdES signature.

If you wish to store the signature with the encapsulated content inside, or if you don´t care about the encapsulated content (for instance if
all your signatures are detached), use the method `ISimpleStore)` instead.

---

### `Compress(byte[], ISimpleStore)`

Compresses a CAdES signature storing objects likely to be repeated across different signatures such as certificates and CRLs in an
external store.

```csharp
public static byte[] Compress(byte[] cadesSignature, ISimpleStore store)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `cadesSignature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | The CAdES signature to be compressed. |
| `store` | [`ISimpleStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ISimpleStore) | The external store on which to store the repeatable objects. |

**Retorno**

[`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) — The compressed signature in a proprietary format that can be decompressed with the `Byte%5b%5d)` method.

**Comentários**

The given signature need not have been generated by the SDK, it can be any CAdES signature.

If the given signature has an encapsulated content (attached signature), this method does not remove it. If you want
to separate the encapsulated content from the signature during the compression, use the method `Byte%5b%5d%40)`
instead.

---

### `Decompress(byte[], ISimpleStore, byte[])`

Decompresses a CAdES signature previously compressed with the compression methods from this class.

```csharp
public static byte[] Decompress(byte[] compressedSignature, ISimpleStore store, byte[] encapsulatedContent)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `compressedSignature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | The compressed signature in proprietary format. |
| `store` | [`ISimpleStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ISimpleStore) | The external store where the repeatable objects were stored during the compression. |
| `encapsulatedContent` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | The encapsulated content separated during the compression, if any. |

**Retorno**

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

**Comentários**

If the original signature had an encapsulated content and the method `Byte%5b%5d%40)`
was used to compress the signature, you must pass the encapsulatedContent parameter.

---

### `Decompress(byte[], ISimpleStore)`

Decompresses a CAdES signature previously compressed with the compression methods from this class.

```csharp
public static byte[] Decompress(byte[] compressedSignature, ISimpleStore store)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `compressedSignature` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | The compressed signature in proprietary format. |
| `store` | [`ISimpleStore`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Stores/ISimpleStore) | The external store where the repeatable objects were stored during the compression. |

**Retorno**

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

---

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