PDFBox 在使用 adbe.x509 时在签名字典中指定证书。rsa_sha1

PDFBox specify cert in the signature dictionary when using adbe.x509.rsa_sha1

在pdfbox中使用adbe.x509.rsa_sha1作为子过滤器时,规范(32000-1:2008,第468页)要求设置'Cert'签名字典字段。 PDSignature 或 COSDictionary 中没有设置此 'Cert' 字段的方法,该字段应包含 "an array of byte strings that shall represent the x.509 certificate chain (...)".

有没有办法指定这个 'Cert' 字段?或者这暂时不可能?

如@TimanHausherr 所述,目前无法直接在 PDFBox (2.0.4) 中设置证书值。仍然可以使用以下方法手动包含 'Cert' 条目:

byte[] cert = ...;
PDSignature signature = new PDSignature();
COSString certCosString = new COSString(cert);
signature.getCOSObject().setItem("Cert", certCosString);

当 PDFBox 使用 'signature' 签署文档时,现在将包含 cert 字段。