# Assinatura digital

Na modalidade assinatura em nuvem (via API) só podem ser enviado os hashes dos documentos.

Os hashes estarão em hexadecimal. Se mais de um hash for informado mas o scope do token for de apenas uma assinatura, uma mensagem de erro deve ser retornada.

&#x20;Podem ser realizadas assinaturas no formato RAW (ASN1 PKCS#1 v1.5), CMS-detached.

{% hint style="info" %}
Para abstrair o uso de recursos de criptografia em aplicações existentes e nativo em diversas linguagens de programação. Conheça também os middlewares: [PKCS11](/workspace/middleware/pkcs-11.md),  [CSP (Microsoft Crypto API)](/workspace/middleware/csp.md),[ Engine OpenSSL](/workspace/middleware/engine-openssl.md),  [JCA/JCE](/workspace/middleware/jca.md).&#x20;
{% endhint %}

{% hint style="info" %}
Para simplificar o uso dos demais serviços de assinatura padronizadas  como CMS, PDF Signature, XMLDsig, CAdES, PAdEs, XAdEs etc. Conheça o [CESS.](/workspace/cess.md)&#x20;
{% endhint %}

<mark style="color:green;">`POST`</mark> `https://api.birdid.com.br/v0/oauth/signature`

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Content-Type                                    | string | application/json |
| Accept                                          | string | application/json |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer           |

#### Request Body

| Name               | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| certificate\_alias | string  | Identificador do certificado correspondente à chave utilizada na assinatura                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| hashes             | array   | <p>Array de objetos com a estrutura<br><br>- <strong>id</strong>: identificador do conteúdo a ser assinado (pode ser um identificar numérico incremental, por exemplo)<br>- <strong>alias</strong>: identificador do conteúdo que será exibido no histórico de assinaturas do usuário<br>- <strong>hash</strong>: conteúdo a ser assinado<br>- <strong>hash\_algorithm</strong>: Object Identifier (OID) do algoritimo de hash. Por exemplo, para SHA256 utilize o OID 2.16.840.1.101.3.4.2.1<br>- <strong>signature\_format</strong>: formato da assinatura<br>     - RAW: Assinatura PKCS#1 v1.5, resultado direto da operação RSA/DSA sobre o hash<br>     - CMS: Assinatura CMS-detached utilizando o hash no campo messageDigest</p> |
| include\_chain     | boolean | Inclui a cadeia do certificado do assinante nas assinaturas CMS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

{% tabs %}
{% tab title="200 " %}

```
{
	"certificate_alias": "CERTIFICADO TESTE 1:1234567889",
	"signatures": [{
		"id": "Signature request ID 1",
		"raw_signature": "my raw signature base64"
	}, {
		"id": "Signature request ID 2",
		"raw_signature": "my raw signature base64"
	}, {
		"id": "Signature request ID n",
		"raw_signature": "my raw signature base64"
	}]
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vaultid.com.br/workspace/cloud/api/uso-de-certificado/assinatura-digital.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
