TintaSign

For developers

Protocol v1 between a web application and TintaSign on the user's computer.

Signing flow

  1. GET /v1/hello tells you whether TintaSign is running, its version and which key sources it sees.
  2. POST /v1/certificates returns the signing certificates. On a new site's first call the user allows, once, that the site sees the list.
  3. Your server builds the signed attributes (PDF) or the canonical SignedInfo (XML) from the document and the chosen certificate.
  4. POST /v1/sign opens the TintaSign window. The user confirms, enters the PIN and TintaSign returns the signature.
  5. Your server embeds the signature in the document and stores it.

JavaScript example

const H = 'https://127.0.0.1:52710';
const post = (path, body) => fetch(H + path, {
  method: 'POST', headers: { 'content-type': 'application/json' },
  body: JSON.stringify(body) }).then(r => r.json());

// is TintaSign running: version, key sources, features
const hello = await fetch(H + '/v1/hello').then(r => r.json());
// certificate list (or let the user pick in the TintaSign window via /v1/choose)
const list = await post('/v1/certificates', { purpose: 'signature' });
const cert = list.certificates[0];
// your server builds the signed attributes and the document fingerprint
const p = await myServer.prepare(docId, cert.certificate);
const r = await post('/v1/sign', { certificateId: cert.id,
  toBeSigned: p.signedAttributes, hashAlgorithm: 'sha256',
  documentLabel: 'Contract.pdf', documentSha256: p.documentSha256,
  requestId: p.id });
// server embeds the signature in the PDF
await myServer.complete(docId, r.signature);

Protocol v1

TintaSign listens on https://127.0.0.1:52710, or on 52711 or 52712 if the port is taken. Every request must carry an Origin header from an HTTPS page. The request body is at most 64 KB.

CallBodyResponse
GET /v1/hello–protocol, helperVersion, os, routes, features, originPaired
POST /v1/pair–{ paired }. The user confirms a new site. Needed only when the allowed-sites list is switched on.
POST /v1/certificatespurpose, issuers, keyUsage{ certificates: [ { id, subject, issuer, notAfter, qualified, certificate, chain } ] }
POST /v1/choosedocumentLabel, documentSha256, issuersThe user picks a certificate in the TintaSign window. Returns the chosen certificate.
POST /v1/signcertificateId, toBeSigned, hashAlgorithm, documentLabel, documentSha256, requestId{ signature, signatureAlgorithm }. With items it signs several documents with one confirmation. With format: "xmldsig" it signs XML.
POST /v1/resultsessionId, outcome, messageThe server's outcome (e.g. a revoked certificate) is shown in the TintaSign window.

Allowed sites

  • Requests are accepted from HTTPS pages only.
  • By default any HTTPS site may ask for a signature. The user confirms each signature in the window and a new site needs the user's permission before its first certificate list.
  • A site the user refuses can no longer use TintaSign until it is removed in the Allowed sites menu.
  • For managed computers: allowListEnabled: true and an allowedOrigins list in config.json. Sites outside the list then get not_paired until the user confirms them through /v1/pair.

Errors

An error comes back as { error }:

  • cancelled the user cancelled
  • device_missing the card or token is no longer connected
  • not_paired the site is not allowed
  • invalid_request the request is not a document signature or the fingerprint is wrong
  • busy another TintaSign window is already open
  • not_supported this version does not support the feature

Settings

The file config.json in the TintaSign data folder (Windows %LOCALAPPDATA%\WGSignHelper).

allowListEnabled, allowedOriginsallowed-sites list
pkcs11ExtraModulesadditional PKCS#11 modules
windowsStoreEnabled, pkcs11Enabled, nssEnabledswitch individual key sources on or off
signingKeyUsagenonRepudiation (default) or digitalSignatureOrNonRepudiation
portsports it listens on

Starting from the page

The installer registers the tintasign://start link. When /v1/hello does not answer, the page shows a button that opens TintaSign.