From dev-return-59680-archive-asf-public=cust-asf.ponee.io@pdfbox.apache.org Wed Nov 21 18:07:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id D5569180675 for ; Wed, 21 Nov 2018 18:07:05 +0100 (CET) Received: (qmail 71096 invoked by uid 500); 21 Nov 2018 17:07:05 -0000 Mailing-List: contact dev-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list dev@pdfbox.apache.org Received: (qmail 71085 invoked by uid 99); 21 Nov 2018 17:07:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2018 17:07:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 916BD19186A for ; Wed, 21 Nov 2018 17:07:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.3 X-Spam-Level: X-Spam-Status: No, score=-110.3 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Wj6M8_Fkil8g for ; Wed, 21 Nov 2018 17:07:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 0DBE6623F5 for ; Wed, 21 Nov 2018 17:07:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 496BAE04AD for ; Wed, 21 Nov 2018 17:07:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B89C223FA3 for ; Wed, 21 Nov 2018 17:07:00 +0000 (UTC) Date: Wed, 21 Nov 2018 17:07:00 +0000 (UTC) From: "Michael Klink (JIRA)" To: dev@pdfbox.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PDFBOX-3017) Improve document signing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PDFBOX-3017?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D166= 94953#comment-16694953 ]=20 Michael Klink commented on PDFBOX-3017: --------------------------------------- Some remarks concerning your recent work with the validation example - h2. OCSP responses You added OCSP response signer certificate revocation checks in response to= [my SO comment here|https://stackoverflow.com/questions/30617875/add-dss-d= ictionary/30754978#comment93640061_30754978]. *Identifying the correct certificate* For this you determine the response signer certificate using {code:java} basicResponse.getCerts()[0] {code} This can return the wrong certificate. [RFC 6960|https://tools.ietf.org/html/rfc6960#section-4.2.2.3] says _the re= sponder MAY include certificates in the certs field of BasicOCSPResponse th= at help the OCSP client verify the responder's signature._ Thus, the expres= sion above may return the response signer certificate but it also may resul= ts in an {{Exception}} if no certificates are given, or it may return the w= rong certificate. You should use the *ResponderID* to identify the correct = certificate: _The purpose of the ResponderID information is to allow client= s to find the certificate used to sign a signed OCSP response._ *No revocation check may be necessary* [RFC 6960|https://tools.ietf.org/html/rfc6960#section-4.2.2.2.1] says _a CA= may specify that an OCSP client can trust a responder for the lifetime of = the responder's certificate. The CA does so by including the extension id-= pkix-ocsp-nocheck._ In that case no revocation check is necessary, probably= not even possible... *VRI section for OCSP response signer certificate revocation checks* You add the revocation information determined for an OCSP response signer c= ertificate into the leading PDF signature's *VRI*. This is wrong, this info= rmation should go into a separate *VRI* for the OCSP response in question: ||Key||Type||Value|| |VRI|dictionary|_(Optional)_ This dictionary contains Signature VRI diction= aries (see 12.8.4.4, "Validation-related information (VRI)"). The key of ea= ch entry in this dictionary is the base-16-encoded (uppercase) SHA1 digest = of the signature to which it applies ^a^ and the value is the Signature VRI= dictionary which contains the validation-related information for that sign= ature.| |^a^ ... For the signatures of *CRLs* and *OCSP* responses, the bytes that = are hashed are the respective signature object represented as a BER-encoded= OCTET STRING encoded with primitive encoding.| _(ISO 32000-2, Table 261 =E2=80=94 Entries in the document security store (= DSS) dictionary)_ _(similarly ETSI EN 319 142-1, Section 5.4.2.2 =E2=80=94 DSS Dictionary, Ta= ble "Entries in a DSS Dictionary")_ h2. CRLs You don't do CRL signer certificate revocation checks yet. While often the CRL signer already is the CA certificate, this is not neces= sarily so. Thus, in general you need to do revocation checks here, too. The resulting revocation information should go into their own *VRI* diction= ary, see the quoted table above. h2. VRIs You add neither a *TU* nor a *TS* to your *VRI* dictionaries. While this makes sense according to ETSI EN 319 142-1 (which says _the TU k= ey should not be used._ and _the TS key should not be used._), in my experi= ence Adobe Reader is unhappy without such a time indication. ---- Some experiences with Adobe Reader "LTV-enabled" signatures are in the {{Ad= obeLtvEnabling}} class for iText 7 from e.g. [this SO answer|https://stacko= verflow.com/a/51675015/1729265]. It's not 100% correct but mostly works. > Improve document signing > ------------------------ > > Key: PDFBOX-3017 > URL: https://issues.apache.org/jira/browse/PDFBOX-3017 > Project: PDFBox > Issue Type: Improvement > Components: AcroForm, Signing > Affects Versions: 2.0.0, 3.0.0 PDFBox > Reporter: Tilman Hausherr > Priority: Major > Fix For: 3.0.0 PDFBox > > Attachments: PDFBOX-3017_certificate_chain.diff, PDFBOX-3017_cert= ificate_chain_Screenshot.png, QV_RCA1_RCA3_CPCPS_V4_11.pdf, pdfa_signed_ins= ivible.pdf > > > Improve signing code: > - incremental save only works for signatures and doesn't respect certific= ates such as Adobe Extended Usage Rights > - -{{prepareNonVisualSignature}} clears the AcroForm DR {{acroForm.setDef= aultResources(null)}} which is not good if there are other form fields- > - visual/nonVisualSignature should move into the {{interactive.forms}} pa= ckage and be handled within the signature field > - -verify signature (to have tests that go full circle)- done June 2016 > - document or refactor / rewrite visible labyrinthine signature code > - why is it not possible to pass only the signatureField to addSignature,= instead having to create a COSDocument with a page and annotations that ha= s the signature field, and that must be searched for in {{prepareVisibleSig= nature()}}? > - -support rotated pages (see https://stackoverflow.com/questions/3401229= 3/pdfbox-sign-landscape-file-error/34359956#34359956 )- done in PDFBOX-3671 > - -make sure that signed PDF/A files are still PDF/A (see http://www.pdfa= .org/wp-content/uploads/2011/08/tn0006_digital_signatures_in_pdfa-1_2008-03= -14.pdf ); /ID possibly not OK; /Annots is possibly required ([~tilman] rem= oved this for invisible signatures); test signed files with PDF-Tools and w= ith preflight- tested, they are OK with PDF-Tools and preflight > - test whether "bad" signatures are detected by preflight (search in old = issues) > - -PDFBOX-3363 - why is the stream cached in a file? Should it be done in= memory?- done on July 15, 2016 > - remove {{setVisualSignature(PDVisibleSigProperties visSignatureProperti= es)}} from SignatureOptions.java, all it does is to call {{visSignatureProp= erties.getVisibleSignature()}} which returns an {{InputStream}}, and this i= s already available > - {{checkSignatureField}} violates the "do one thing" rule > - -decide whether the whole certificate chain should be passed in the sam= ple code, instead of only the first one- yes the whole chain is stored > - -check certificate chain, revocation lists, etc,- only if needed by use= rs, code [here|https://svn.apache.org/repos/asf/cxf/tags/cxf-2.4.1/distribu= tion/src/main/release/samples/sts_issue_operation/src/main/java/demo/sts/pr= ovider/cert/] > - deprecate / remove all PDVisibleSignDesigner constructors except those = with a PDDocument object, to avoid a file being opened twice > - ... your ideas... -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org For additional commands, e-mail: dev-help@pdfbox.apache.org