私はそのようなことをしました。それが正しいか?
私は:
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;
}
できたと思います。それは正しい方法ですか?どう思いますか?