Relying party documentation
Document signing for relying parties
Your portal keeps PDFs on your servers; the eID API orchestrates prepare → Smart Signer → inject. You never deploy sign-util.jar or vendor API keys on the RP.
1. Purpose
After Sign in with eID, an authenticated citizen can sign a PDF through your application. Your backend calls eID with the citizen's access token. eID validates eligibility, runs the signing toolchain, and returns a base64-encoded signed PDF.
2. Architecture
Typical flow: citizen SSO at RP → upload PDF in RP UI (leave the upload enabled) → RP server POST https://sxm-eid-dev.eastus.cloudapp.azure.com/api/rp/esign/documents/sign with Authorization: Bearer and X-Sso-Client-Id → store returned PDF. Do not require a validate call before showing the file input.
3. Prerequisites
| Requirement | Who | Notes |
|---|---|---|
| SSO integration | RP | See /developers/sso/quickstart — broker or sandbox OIDC |
| Scope esign_sign + eid | Platform admin | OidcClients.AllowedScopes — /admin/rp-applications → Update OIDC policy |
| Issued eSign certificate | Citizen | Active citizen + Issued row in CitizenEsignCertificates |
| EID_API_BASE_URL | RP ops | Reachable from RP server (e.g. https://sxm-eid-dev.eastus.cloudapp.azure.com) |
| DocumentSigning enabled | eID ops | sign-util.jar + Smart Signer on API host |
4. API contract
| Method | Path | Auth |
|---|---|---|
| GET | /api/rp/esign/health | None — includes maxFileSizeBytes when enabled |
| POST | /api/rp/esign/documents/sign | Required. Bearer citizen access token from SSO. This is the call that signs the PDF. |
| POST | /api/rp/esign/documents/validate | Optional preflight. Same Bearer. Do not disable upload when you skip it. |
Sign request
POST https://sxm-eid-dev.eastus.cloudapp.azure.com/api/rp/esign/documents/sign
Authorization: Bearer {citizen_access_token}
X-Sso-Client-Id: {your_wso2_client_id} # same id as OidcClients.ClientId
Content-Type: multipart/form-data
file=<application/pdf>Optional validate (preflight)
Same headers as sign. COCI does not call this. The sign route already checks the token, the citizen, and the eSignature certificate. Use validate only if you want those errors before running the signing toolchain.
POST https://sxm-eid-dev.eastus.cloudapp.azure.com/api/rp/esign/documents/validate
Authorization: Bearer {citizen_access_token}
X-Sso-Client-Id: {your_wso2_client_id}
file=<application/pdf> # optional — size + PDF magic bytesValidate success (JSON)
{
"valid": true,
"eid": "SXM-123456789",
"rpClientId": "YOUR_WSO2_CLIENT_ID",
"esignCertificateActive": true,
"maxFileSizeBytes": 10485760,
"acceptedMediaTypes": ["application/pdf"]
}Sign success (JSON)
{
"signedDocumentBase64": "...",
"certificateSerial": "SXMESN...",
"signedAt": "2026-11-19T12:00:00Z",
"auditReference": "uuid"
}5. Authentication paths
| Path | Token | When |
|---|---|---|
| Broker SSO (recommended) | WSO2 access token from portal login | Set X-Sso-Client-Id to your WSO2 client_id. Approve writes oidc_wso2_relay_mappings so that id maps to itself (the OidcClients row). |
| Direct eID OIDC | eID-issued access token with esign_sign | Sandbox or custom RPs; authorize includes esign_sign scope |
6. Validation errors
Failed responses include a stable error code and message. Leave the PDF upload enabled and show that message from the sign response. A missing relay row is 401 invalid_token ("Broker client is not mapped"), not a disabled file input.
| error | HTTP | Meaning |
|---|---|---|
| missing_file | 400 | No multipart file field |
| invalid_pdf | 400 | Bytes are not a PDF (%PDF-) |
| file_too_large | 400 | Over DocumentSigning:MaxFileSizeBytes (see health maxFileSizeBytes) |
| invalid_token | 401 | Missing or unusable Bearer token, or X-Sso-Client-Id is not in oidc_wso2_relay_mappings |
| token_expired | 401 | Access token past lifetime |
| esign_signing_not_allowed | 403 | OidcClients or token missing esign_sign / eid (broker rules apply) |
| citizen_not_found | 404 | eid claim does not match a citizen |
| esign_not_active | 422 | No issued CitizenEsignCertificates row |
| citizen_ineligible | 422 | Citizen suspended, revoked, deceased, or not Active/Verified |
| eid_mismatch | 422 | Optional form eid ≠ token citizen |
| signing_disabled | 503 | DocumentSigning:Enabled=false |
| signing_unavailable | 503 | Smart Signer or sign-util.jar not ready |
| sign_engine_error | 502 | Vendor rejected hash sign |
| sign_util_error | 502 | Prepare or inject failed |
7. Next steps
- Quickstart — health check, then one sign
- Laravel guide — COCI-style client
- ASP.NET Core guide — HttpClient multipart sample