2012-07-14 42 views
0

adobe閱讀器顯示pdf簽名狀態,有效和無效。如何使用itext顯示PDF簽名外觀中的時間戳狀態

我希望讀者能夠顯示簽名中包含的動態(而非靜態)時間戳狀態。

我使用的itext代碼如下。

PdfReader reader = new PdfReader(IN_FILE); 
FileOutputStream fout = new FileOutputStream(OUT_FILE); 
PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0'); 
PdfSignatureAppearance sap = stp.getSignatureAppearance(); 

sap.setCrypto(null, chain, null, PdfSignatureAppearance.SELF_SIGNED); 

sap.setVisibleSignature(new Rectangle(100, 100, 300, 200), 1, "Signature"); 

PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, new PdfName("adbe.pkcs7.detached")); 
dic.setReason(sap.getReason()); 
dic.setLocation(sap.getLocation()); 
dic.setContact(sap.getContact()); 
dic.setDate(new PdfDate(sap.getSignDate())); 
sap.setCryptoDictionary(dic); 

int contentEstimated = 15000; 
HashMap exc = new HashMap(); 
exc.put(PdfName.CONTENTS, new Integer(contentEstimated * 2 + 2)); 
sap.preClose(exc); 

PDFTemplate sigLayer = PdfSignatureAppearance.getLayer(n);

負責簽名外觀。但我無法包含動態時間戳狀態。

回答

0

待簽名時間戳散列值是在已簽名的PDF文件的簽名外觀已創建時計算的。

修改pdf添加ts信息將使簽名無效...