From 746c4948ea3e85d84300929b60ed997cb06f8ab5 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 24 Nov 2026 16:56:27 +0000 Subject: [PATCH] docs(csc): describe experimental CSC lab administration and signing (#179) Document the unreleased CSC v1 synthetic-only integration, operator endpoint and certificate pinning, per-instance lifecycle, authorized account and guest signing, SHA-256/RSA and the verified PDF profiles. Explain uncertain outcomes, session recovery, private-key consent limitations and production provider homologation explicitly. Add two English Sphinx pages under the existing admin and user manuals with reciprocal links and toctree entries. Locally verified both make admin and make user; only the repository's pre-existing html_extra_path warning remains. Actual UI screenshots and final E2E validation will follow review of the integrated experimental backend. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- admin_manual/csc.rst | 183 +++++++++++++++++++++++++++++++ admin_manual/index.rst | 3 +- user_manual/external_signing.rst | 101 +++++++++++++++++ user_manual/index.rst | 3 +- 4 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 admin_manual/csc.rst create mode 100644 user_manual/external_signing.rst diff --git a/admin_manual/csc.rst b/admin_manual/csc.rst new file mode 100644 index 00000000..d8d08cab --- /dev/null +++ b/admin_manual/csc.rst @@ -0,0 +1,183 @@ +.. + SPDX-FileCopyrightText: 2026 LibreCode coop and contributors + SPDX-License-Identifier: CC-BY-3.0 + +CSC external signing (experimental) +=================================== + +.. warning:: + + This guide covers the **unreleased experimental CSC v1 synthetic + laboratory** on the LibreSign development branch. It does not describe a + production-ready personal signing provider, a qualified certificate, + CSC 2.2, or a feature available in LibreSign 13, 14, or 15. + +Overview and security model +--------------------------- + +The administrator configures one or more external-signing *integration +instances*. An instance identifies a CSC driver, a service endpoint, an +enabled state, and optional write-only secrets. An enabled instance is not +automatically an eligible signing method. A signer must still be authorized +for a particular LibreSign signature request, and the provider must separately +authorize use of its private key. + +For the initial laboratory, an operator must independently pin the **exact** +synthetic HTTPS endpoint and the **SHA-256 fingerprint** of the synthetic +signing certificate. The configured integration must match both pins, be +enabled, and have **no administrator access token or other secret**. A +shared administrative token is never evidence of the signer's consent. + +Production CSC credentials remain blocked until the provider proves +individual authentication and operation-bound signature authorization +(for example, a signer-authorized SAD). Laboratory tests do not establish +certificate-path trust or the legal identity of a person. + +Prerequisites +------------- + +* Use a LibreSign development build containing both the external signing + backend and signer interface. The experimental feature is disabled by + default. +* Install the SignerPHP CSC adapter shipped with the tested application + dependency lock. The driver catalog reports whether its adapter is + installed; this does not imply that a provider is configured. +* Use an administrator-approved synthetic CSC test provider with a public + **HTTPS DNS name**. Private addresses, IP-literal endpoints, local DNS + suffixes, redirects, credentials in URLs, and query strings are not + supported by the configured remote transport. +* The Nextcloud system configuration must **not** enable + ``allow_local_remote_servers``, and must keep ``dns_pinning`` enabled. + Review changes to these global security settings with the Nextcloud + operator; do not weaken them for CSC. +* Obtain the synthetic certificate fingerprint from the controlled test + laboratory by a separate trusted channel. It must be lowercase hexadecimal + SHA-256 (64 characters), not a subject name or an identifier entered by + the signer. + +The internal loopback HTTP CSC fixture is intended for automated tests +only. It is not an operator-configurable replacement for the HTTPS endpoint +requirement. + +Enable and configure the laboratory +----------------------------------- + +Enable the application-level feature gate as the Nextcloud web-server user: + +.. code-block:: console + + ./occ config:app:set libresign experimental_features --type boolean --value true + +This **global LibreSign experimental gate** is separate from the +**enabled/disabled state of each CSC integration instance**. Both must permit +the operation. Turning off the experimental gate hides the corresponding +administrative and signer-facing experimental endpoints without affecting +traditional LibreSign signature methods. + +Have the Nextcloud system operator set the exact laboratory endpoint and +certificate pin in the Nextcloud system configuration: + +.. code-block:: php + + // Example entries in Nextcloud config/config.php; replace both values. + 'libresign_csc_synthetic_lab_url' => 'https://csc-lab.example.org/csc', + 'libresign_csc_synthetic_lab_certificate_sha256' => 'replace-with-64-lowercase-hex-digits', + +The examples above are **placeholders**, not usable credentials or a +trusted laboratory. They deliberately do not name a production signing +provider. The configured CSC service URL must be byte-for-byte identical +to the operator-pinned URL. + +In the LibreSign administration interface, open **External signing +providers**, select the **Cloud Signature Consortium (CSC)** driver, and +create an integration with a descriptive name and the pinned HTTPS URL. +Do not supply an access token for the synthetic laboratory. Save and then +enable the instance. Each instance has its own identifier and optimistic +revision, so an administrator can manage multiple instances of one driver. + +Secret handling and administrative lifecycle +-------------------------------------------- + +A secret field is write-only: an existing value is reported as configured, +but never returned to the browser. Leave a configured secret blank to +preserve it, enter a replacement to rotate it, or explicitly clear an +optional secret. An instance with any configured secret is **not eligible +for synthetic personal signing**. + +Editing, enabling, disabling, and deleting instances use revision checks. +An HTTP 409 conflict can mean that another administrator changed the +instance, or that a signing session is still unresolved. In particular, +an uncertain private-key submission must retain the pinned integration +configuration for reconciliation. Do not delete or rotate an instance to +"clear" an uncertain signing result. Re-read the current instance and +investigate the unresolved session before another administrative operation. + +A deleted instance is tombstoned for audit; its endpoint configuration and +encrypted secrets are erased. Deleting an integration is not a way to +cancel an operation already submitted to a remote provider. + +Cryptographic scope +------------------- + +The experimental subset uses CSC 1.0.4.0-style credential discovery and +remote signing through SignerPHP. The certificate eligibility checks require +a currently valid X.509 certificate with an **RSA public key of at least +2,048 bits**, compatible key usage, **SHA-256**, and +**RSA PKCS#1 v1.5** signing. The tested PDF output profiles are +**PDF Basic** (``pdf-basic``) and **PAdES Baseline B-B** +(``pades-baseline-b``), subject to source PDF/DocMDP restrictions. + +These constraints are the *implemented laboratory subset*, not a statement +of full CSC conformance, trust-chain validation, long-term validation, +PAdES B-T/B-LT/B-LTA support, or provider-specific authorization. + +Sessions, recovery and uncertain results +---------------------------------------- + +LibreSign stores the authorized signing session on the server. Its +identity, SignRequest, document revision, certificate, and integration +cannot be substituted by the browser. The relevant states include +preparation, authorization pending, ready, signing pending, signature +received, completing, completed, rejected, expired, failed, and uncertain. + +A new HTTP request or PHP process may resume an existing permitted session +after **fresh signer verification**. If a remote ``signHash`` call times out +after it could have been submitted, LibreSign must treat the result as +**uncertain**. An expired lease or a failed HTTP response does not prove +that the provider did not sign. Do not automatically resubmit the +private-key operation, delete the session, or tell the signer to start again. + +On a confirmed result, LibreSign must validate the final PDF cryptographically, +check the exact source revision and earlier signatures/DocMDP restrictions, +and publish the result to the original request at most once before showing +success. An uncertain result requires operator/provider reconciliation, +not a "retry" of the private-key operation. + +Troubleshooting and validation +------------------------------ + +* **No CSC option:** check the global feature gate, driver availability, + integration enabled state, exact operator pin and empty synthetic secret + set. Traditional LibreSign methods should remain available. +* **No eligible certificate:** check expiry, RSA key size, signing key + usage, fingerprint pin and laboratory discovery response. Do not + loosen the certificate checks simply to make the credential appear. +* **HTTP 409 on administration:** refresh the instance revision and + check for unresolved sessions; do not force deletion. +* **Pending or uncertain:** inspect the server-side session state and + the test provider's operation ledger. Do not call ``signHash`` again + merely because a browser or worker timed out. +* **PDF rejected:** check document revision, earlier PDF signatures, + DocMDP permissions and the cryptographic validator output before + permitting a publication or success notification. + +The source tests for the experimental laboratory use synthetic certificates, +CSC fixtures, real SignerPHP PDF preparation/completion and cryptographic +validation. For release acceptance, additionally run a disposable +Nextcloud end-to-end test with an authenticated signer, an invited guest, +PDF Basic and PAdES B-B, concurrent requests, and restart/reconciliation. +Test data, database, Nextcloud configuration and storage must be isolated +from production. Automated laboratory interoperability **does not** +homologate a real CSC provider. + +See the `external signing guide for signers <../user_manual/external_signing.html>`_. diff --git a/admin_manual/index.rst b/admin_manual/index.rst index 249bc412..469f6347 100644 --- a/admin_manual/index.rst +++ b/admin_manual/index.rst @@ -43,4 +43,5 @@ Visit our `blog `__ installation configuration maintenance - security \ No newline at end of file + security + csc diff --git a/user_manual/external_signing.rst b/user_manual/external_signing.rst new file mode 100644 index 00000000..6ce698d5 --- /dev/null +++ b/user_manual/external_signing.rst @@ -0,0 +1,101 @@ +.. + SPDX-FileCopyrightText: 2026 LibreCode coop and contributors + SPDX-License-Identifier: CC-BY-3.0 + +External signing with CSC (experimental) +======================================== + +.. warning:: + + External CSC signing currently supports **synthetic test laboratory + credentials only** in unreleased LibreSign development builds. It does + not sign with your personal certificate at a production provider or prove + your real-world identity. Your ordinary LibreSign signing methods are + unaffected. + +When this method is available +----------------------------- + +An administrator must have enabled the LibreSign experimental feature, +configured and enabled a matching CSC laboratory integration, and verified +that its synthetic certificate is eligible. The option appears only for +signers and requests the backend permits. + +The initial experiment does not offer CSC signing for requests that require +a visible PDF signature field, mandatory geolocation, or identification +document approval. These workflows continue to use their supported +LibreSign signing methods. + +Verify that you are the invited signer +-------------------------------------- + +Open the LibreSign signature-request link and review the document in the +usual signing screen. Select **External signing (experimental)** when it +appears. + +* **Nextcloud account:** sign in with the account bound to this signature + request and choose the account verification method where offered. +* **Guest without a Nextcloud account:** use the email address bound to the + invitation, request the usual LibreSign verification code, and enter that + code. The invitation link alone is not sufficient to discover remote + signing credentials. + +The code is checked by LibreSign for the specific request; it is not a +CSC provider credential or remote private-key consent. + +Select a synthetic credential and PDF format +-------------------------------------------- + +After verification, choose an available CSC integration and one of its +eligible **synthetic** certificates. Review the displayed certificate +subject, expiry and SHA-256 fingerprint. LibreSign excludes certificates +that do not satisfy the experiment's required certificate properties. + +Choose **PDF Basic** or **PAdES B-B** if offered for the selected +certificate and document. The experimental laboratory uses SHA-256 with +RSA PKCS#1 v1.5 signatures and RSA keys of at least 2,048 bits. Support +is limited by existing PDF signatures and DocMDP permissions. + +Select **Prepare external signature**. Preparation binds the server-owned +session to the authorized signer, current request, document revision and +chosen synthetic certificate. It does not yet mean that the document was +signed. + +Continue and check the status +----------------------------- + +Select **Continue external signing** when offered. During the operation +the interface can show preparation, required authorization, pending +signature, signature received, publication in progress, completion, +rejection, expiry, failure, or an **uncertain** result. + +The document is complete only after LibreSign has verified and published +the signed PDF to the original request. A server error or a browser refresh +is **not** proof of signature failure. + +Use **Check signing status** to read the existing session. Returning to the +page or using another browser request requires fresh signer verification. +LibreSign must not submit the remote private-key operation a second time +when a previous attempt may already have reached the provider. + +If the result is uncertain +-------------------------- + +An uncertain status means the provider *may already have signed* even if +LibreSign did not receive the HTTP response. **Do not start a new attempt, +request a second certificate operation, or assume that an expired browser +session allows resubmission.** Contact the administrator and provide the +request reference without sharing your verification code. The administrator +must reconcile the remote result and the server-owned session. + +If the option is unavailable +---------------------------- + +The experimental feature may be switched off, your request may be ineligible, +or no eligible synthetic provider or certificate may exist. Do not try +other people's credential identifiers or change the request address; the +server checks the authorized signer independently. Use one of the standard +methods offered for your document or contact the administrator. + +For administration, laboratory prerequisites and further troubleshooting, +see the `administrator CSC guide <../admin_manual/csc.html>`_. diff --git a/user_manual/index.rst b/user_manual/index.rst index 3feaab6f..e2a64411 100644 --- a/user_manual/index.rst +++ b/user_manual/index.rst @@ -43,5 +43,6 @@ Visit our `blog `__ start functionality + external_signing faq - suport \ No newline at end of file + suport