Pdf 如何在DSS中添加证书
我做过那样的事。对吗 我已经:Pdf 如何在DSS中添加证书,pdf,digital-signature,pdfbox,Pdf,Digital Signature,Pdfbox,我做过那样的事。对吗 我已经: PDDocumentCatalog catalog = template.getDocumentCatalog(); COSDictionary catalogDictionary = catalog.getCOSDictionary(); COSDictionary dssDictionary = new COSDictionary(); COSArray certDSS = getCertific
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;
}
PDDocumentCatalog=template.getDocumentCatalog();
COSDictionary catalogDictionary=catalog.getCOSDictionary();
COSDictionary=新的COSDictionary();
COSArray certDSS=GetCertificateCasarray(certChainList);
setItem(COSName.getPDFName(“Cert”),certDSS);
catalogDictionary.setItem(COSName.getPDFName(“DSS”),dssDictionary);
和要填写的代码:
公共静态COSArray GetCertificateCasarray(列表certChainList){
COSArray certDSS=新的COSArray();
对于(X509证书X509证书:certChainList){
PDStream certificateStream=新的PDStream(新的costream(新的RandomAccessBuffer());
appendRawCommands(certificateStream.createOutputStream(),x509Certificate.getEncoded());
PDObjectStream pd=新的PDObjectStream(certificateStream.getStream());
证书添加(pd);
}
返回证书DSS;
}
我想已经完成了。这是正确的方法吗?你怎么看?作为评论:
DSS字典中证书的PDF密钥是Certs,而不是Cert。密钥Cert用于单个签名的VRI字典
详情见附录A.1文件安全存储(又名PAdES第4部分)。它也将出现在ISO 32000-2中。DSS字典中证书的PDF密钥是Certs,而不是Cert。密钥Cert用于单个签名的VRI字典中。写下该注释作为答案,我将作为答案进行检查。