Seal a Document
Seal a file as your organization with a single server-to-server request. Only the file's digest is sent; the file stays on your server. No user interaction is needed.
Before you begin
- A test account and a registered webpage. See Getting Started.
- Your
client_id. opensslandcurlon your machine.
Your own credentials are required
e-Sealing needs an HMAC key tied to your own client_id, so the shared sandbox credentials can't be used. Run the commands below in your terminal.
1. Get your HMAC key and enable e-sealing
e-Seal requests are signed with an HMAC key instead of your OAuth secret.
- Open My Webpages and click EDIT for your webpage.
- Scroll to Eseal Settings and click Generate.
- Copy the HMAC key and store it somewhere safe. It's shown only once.
- Send your
client_idto eID Easy support so test e-seal credentials can be configured for your client.
Keep your HMAC key on the server
Anyone with it can create e-seals in your name. Never put it in front-end code or a git repository.
2. Calculate the file's digest
DIGEST=$(openssl dgst -sha256 -binary document.pdf | base64)
3. Build and sign the request
The HMAC covers the HTTP method, path, timestamp, and the exact request body.
BODY='{"client_id":"YOUR_CLIENT_ID","files":[{"fileName":"document.pdf","fileContent":"'"$DIGEST"'","mimeType":"application/pdf"}],"signature_form":"CAdES","signature_profile":"CAdES_BASELINE_T"}'
TS=$(date +%s)
HMAC=$(printf '%s' "POST/api/signatures/e-seal${TS}${BODY}" \
| openssl dgst -sha256 -hmac "YOUR_HMAC_KEY" -binary | base64)
WARNING
Send the body exactly as signed. Don't pretty-print or reorder the JSON after calculating the HMAC. The timestamp must be within 5 minutes of the server time.
4. Send it
curl -X POST https://test.eideasy.com/api/signatures/e-seal \
-H "Content-Type: application/json" \
-H "X-Timestamp: $TS" \
-H "X-HMAC-Signature: $HMAC" \
-d "$BODY"
{
"status": "OK",
"signatures": [
{ "fileName": "document.pdf.p7s", "mimeType": "application/pkcs7-signature", "fileContent": "base64-encoded-signature" }
]
}
You get a detached CAdES signature for your file. ๐ Use the signature_form and signature_profile values enabled for your client. Test e-seals use a test certificate and aren't legally binding.
Go live
- Follow the shared go-live steps.
- Generate a new HMAC key in the live admin panel.
- Ask support to configure your production e-seal certificate.