0

我做过类似的事情。这是对的吗?

我有:

        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;
}

我想它已经完成了。这是正确的方法吗?你怎么看?

4

1 回答 1

1

正如已经写成评论的那样:

DSS字典中证书的 PDF 密钥是Certs,而不是Cert。密钥Cert用于单个签名的 VRI 字典。

详细信息可在ETSI TS 102 778-4(又名 PAdES 第 4 部分)的附件 A.1文档安全存储中找到。它也将出现在 ISO 32000-2 中。

于 2013-07-19T12:08:45.563 回答