0
我已經完成了這樣的操作。這是對的嗎?如何在DSS中添加證書
我已經:
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;
}
i'think它的完成。這是正確的方式?你怎麼看?
** DSS **字典中的證書的PDF密鑰是** Certs **,而不是** Cert **。密鑰** Cert **用於單個簽名的VRI字典中。 – mkl
發表評論,作爲答案,我將檢查爲答案。 – grep