With the expansion of EU digital identity frameworks such as eIDAS and the EU Digital Identity Wallet (EUDIW), signing documents via national eID cards has become a core requirement for enterprise web portals. To handle browser-based card interactions, the European eID ecosystem widely relies on Web eID—an open-source framework originally developed by the Estonian Information System Authority (RIA) that enables web applications to execute cryptographic operations on physical smart cards via standard browser extensions and PKCS#11 drivers.
Integrating client-side hardware tokens with database-centric document generation creates a distinct architectural challenge: web browsers cannot directly access local hardware readers, and private keys stored on eID chips must never leave the card. To produce compliant PAdES (PDF) or XAdES (XML) signatures, the application must generate the document structure and compute the cryptographic digest on the server, send that hash to the browser for physical token signing, and then assemble the completed signature package back on the server.
This two-phase workflow is natively supported by PL/SIGN (for PAdES) and PL/XSIGN (for XAdES) inside Oracle Database without requiring any modifications to the underlying PL/SQL packages.
Architectural Flow
The integration uses a standard REST API layer—such as Oracle REST Data Services (ORDS)—to bridge the frontend JavaScript library (web-eid.js) with the Oracle Database engine:
- Preparation: The frontend reads the user’s public X.509 certificate from the eID card and sends it to Oracle via REST. The database invokes
PL_SIGN.PREPARE_PDF_SIGNATUREorPL_XSIGN.PREPARE_XADES_BB_*, which builds the document structure, reserves the signature placeholder, and returns the computed SHA-256 digest (hash_to_sign). - Hardware Signing: The
web-eid.jsfrontend library prompts the user for their PIN2 and executes the RSA signature calculation directly inside the eID smart card chip. - Completion: The browser posts the resulting raw RSA signature bytes back to Oracle. The database invokes
PL_SIGN.COMPLETE_PDF_SIGNATUREorPL_XSIGN.COMPLETE_XADES_BB_*to embed the signature value into the reserved placeholder and return the final signed document.
PL/SQL Implementation Example
The following PL/SQL block demonstrates the two-phase PAdES signing workflow using PL_SIGN:
SQL
DECLARE
l_req PL_SIGN.T_PDF_SIGNATURE_REQUEST;[cite: 1]
l_signed_pdf BLOB;
BEGIN
-- 1. Prepare PDF signature placeholder and compute SHA-256 digest
l_req := PL_SIGN.PREPARE_PDF_SIGNATURE([cite: 1]
p_pdf => :input_pdf,[cite: 1]
p_certificate_der => :user_cert_der,[cite: 1]
p_reason => 'Signed via Web eID'[cite: 1]
);
-- 2. Hardware signing occurs in the browser via web-eid.js
-- Raw RSA signature bytes returned to server: :raw_rsa_signature
-- 3. Embed signature and finalize PAdES document
l_signed_pdf := PL_SIGN.COMPLETE_PDF_SIGNATURE([cite: 1]
p_request => l_req,[cite: 1]
p_signature_value => :raw_rsa_signature,[cite: 1]
p_certificate_der => :user_cert_der[cite: 1]
);
PL_SIGN.FREE_PDF_SIGNATURE_REQUEST(l_req);[cite: 1]
END;
Conclusion
By decoupling digest generation from private key operations, PL/SIGN and PL/XSIGN enable full eIDAS and Qualified Electronic Signature (QES) compliance directly within Oracle Database. Because the PL/SQL engines handle ByteRange calculations, XML canonicalization, and container formatting out of the box, bringing Web eID functionality to an Oracle application requires only simple REST wrappers and standard frontend integration.
