Skip to content

Commit 4a450b0

Browse files
author
Eugene Bochilo
committed
Fix trimming zeroes in timestamp signature
DEVSIX-7968
1 parent b51c25b commit 4a450b0

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

sign/src/main/java/com/itextpdf/signatures/LtvVerification.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -482,18 +482,11 @@ private static byte[] buildOCSPResponse(byte[] basicOcspResponse) throws IOExcep
482482
return BOUNCY_CASTLE_FACTORY.createOCSPResp(ocspResponse).getEncoded();
483483
}
484484

485-
private PdfName getSignatureHashKey(String signatureName) throws NoSuchAlgorithmException, IOException {
485+
private PdfName getSignatureHashKey(String signatureName) throws NoSuchAlgorithmException {
486486
PdfSignature sig = sgnUtil.getSignature(signatureName);
487487
PdfString contents = sig.getContents();
488488
byte[] bc = PdfEncodings.convertToBytes(contents.getValue(), null);
489-
byte[] bt = null;
490-
if (PdfName.ETSI_RFC3161.equals(sig.getSubFilter())) {
491-
try (IASN1InputStream din = BOUNCY_CASTLE_FACTORY.createASN1InputStream(new ByteArrayInputStream(bc))) {
492-
IASN1Primitive pkcs = din.readObject();
493-
bc = pkcs.getEncoded();
494-
}
495-
}
496-
bt = hashBytesSha1(bc);
489+
byte[] bt = hashBytesSha1(bc);
497490
return new PdfName(convertToHex(bt));
498491
}
499492

0 commit comments

Comments
 (0)