---
title: "Assinar um PDF com seu certificado em nuvem"
product: "PKI Suite"
slug: "sign-with-cloud-certificate"
language: "pt"
canonical_url: "https://try.lacunasoftware.com/pt/pki-suite/sign-with-cloud-certificate"
docs_url: "https://docs.lacunasoftware.com/pt-br/articles/pki-sdk/cloud-certificates"
samples:
  - title: "Sign a PDF with a cloud certificate using CloudHub"
    language: "dotnet"
    framework: "aspnet-mvc"
    url: "https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/dotnet/mvc/PkiSuiteAspNetMvcSample/Controllers/PadesCloudHubSdkController.cs"
  - title: "Sign a PDF with a cloud certificate using CloudHub"
    language: "java"
    framework: "spring-boot"
    url: "https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/java/springmvc/src/main/java/com/lacunasoftware/pkisuite/controller/PadesSignatureCloudhubRestController.java"
  - title: "Sign a PDF with a cloud certificate using CloudHub"
    language: "nodejs"
    framework: "express"
    url: "https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/nodejs/expressmvc/routes/pades-signature-cloudhub-restpki.js"
  - title: "Sign a PDF with a cloud certificate using CloudHub"
    language: "php"
    framework: "php"
    url: "https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/php/plain/public/pades-signature-cloudhub-rest/index.php"
samples_repo: "https://github.com/LacunaSoftware/PkiSuiteSamples"
trace_recorded: null
last_generated: "2026-10-12T15:24:28Z"
---

# Assinar um PDF com seu certificado em nuvem

Assine um PDF com o certificado em nuvem que seu PSC guarda para você: o CloudHub, no servidor, chega ao seu PSC, que assina só o hash do PDF, e o PKI SDK, no servidor, monta a assinatura.

Live demo: [https://try.lacunasoftware.com/pt/pki-suite/sign-with-cloud-certificate](https://try.lacunasoftware.com/pt/pki-suite/sign-with-cloud-certificate). It runs against Lacuna's real products; this page describes it for AI coding agents.

## Call sequence

No call sequence has been recorded for this demo yet, so none is shown here: this page doesn't guess calls. The docs and samples below show the calls; the live demo makes them.

## Patterns to copy

- Run the flow in this order: look the CPF up, which creates a signature session; send the user to their PSC's `AuthUrl`; take the `session` CloudHub adds to your redirect URI; then get the certificate and sign the hash in that session. The redirect URI must be under an origin registered for your API key, or CloudHub answers `UnauthorizedRedirectUri`.
- Only the hash goes to CloudHub: PKI SDK builds the signature around it with the same Start and Complete as a browser signing, and validates the certificate at Start so a refused one never reaches the PSC.
- Treat `session` as a bearer secret: keep it on the server, never log it, and strip it from the return page's address bar.
- The PSC decides when a session ends: match `SessionExpired` and `SessionInvalidOrAlreadyUsed` on the exception's `CodeStr`, then look the CPF up again. One session can sign several PDFs until then.
- `Lacuna.Cloudhub.Client` 1.0.0 builds its own `HttpClient` (keep one client, not one per call), takes no cancellation token, and puts the request URL, session included, in its exception messages, so never log them.

## Links

- Live demo: https://try.lacunasoftware.com/en/pki-suite/sign-with-cloud-certificate (Portuguese: https://try.lacunasoftware.com/pt/pki-suite/sign-with-cloud-certificate)
- Docs: https://docs.lacunasoftware.com/pt-br/articles/pki-sdk/cloud-certificates
- Sample, .NET (aspnet-mvc): [Sign a PDF with a cloud certificate using CloudHub](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/dotnet/mvc/PkiSuiteAspNetMvcSample/Controllers/PadesCloudHubSdkController.cs)
- Sample, Java (spring-boot): [Sign a PDF with a cloud certificate using CloudHub](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/java/springmvc/src/main/java/com/lacunasoftware/pkisuite/controller/PadesSignatureCloudhubRestController.java)
- Sample, Node.js (express): [Sign a PDF with a cloud certificate using CloudHub](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/nodejs/expressmvc/routes/pades-signature-cloudhub-restpki.js)
- Sample, PHP (php): [Sign a PDF with a cloud certificate using CloudHub](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/php/plain/public/pades-signature-cloudhub-rest/index.php)
- Every demo: https://try.lacunasoftware.com/llms.txt and https://try.lacunasoftware.com/demos.json
