我做过类似的事情。这是对的吗?
我:
PDDocumentCatalog catalog = template.getDocumentCatalog();
COSDictionary catalogDictionary = catalog.getCOSDictionary();
COSDictionary dssDictionary = new COSDictionary();
COSArray certDSS = getCertificateCosArray(certChainList);
dssDictionary.setItem(COSName.getPDFName("Cert"), certDSS);
catalogDictionary.setItem(COSName.getPDFName("DSS"), dssDictionary);
and code to fill:
public static COSArray getCertificateCosArray( List<X509Certificate> certChainList) {
COSArray certDSS = new COSArray();
for (X509Certificate x509Certificate : certChainList) {
PDStream certificateStream = new PDStream(new COSStream(new RandomAccessBuffer()));
appendRawCommands(certificateStream.createOutputStream(), x509Certificate.getEncoded());
PDObjectStream pd = new PDObjectStream(certificateStream.getStream());
certDSS.add(pd);
}
return certDSS;
}
我认为已经完成了。这是正确的方法吗?你觉得怎么样?
答案 0 :(得分:1)
已经写成评论:
DSS 词典中的证书的PDF密钥为 Certs ,而不是证书。密钥证书用于单个签名的VRI词典。
详细信息可以在ETSI TS 102 778-4的附件A.1 文件安全存储中找到(又名PAdES第4部分)。它也将出现在ISO 32000-2中。