-
-
Notifications
You must be signed in to change notification settings - Fork 24
GH-457 time stamp validation #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements timestamp validation for digital signatures in PDF documents as part of GH-457. The changes improve the signature verification process by validating embedded timestamps and modernizing the certificate verification infrastructure.
Changes:
- Implements timestamp validation logic to verify embedded timestamps in signatures
- Refactors certificate verification to use modern revocation checking (OCSP/CRL)
- Adds new exception types and utility classes for certificate validation
- Updates UI messages to reflect that embedded timestamps are now validated
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| MessageBundle.properties | Updated messages to indicate embedded timestamps are now validated |
| Library.java | Renamed class reference from LoadJceProvider to JceProvider |
| JceProvider.java | Renamed class from LoadJceProvider for consistency |
| RevokedCertificateException.java | New exception class for handling revoked certificates |
| RevocationsVerifier.java | New class implementing OCSP and CRL revocation verification |
| OcspHelper.java | New helper class for OCSP operations |
| OCSPVerifier.java | New verifier class for OCSP validation |
| CertificateVerifier.java | Refactored to support timestamp validation and automatic certificate downloads |
| CertificateUtils.java | New utility class with extracted certificate helper methods |
| CRLVerifier.java | Updated method names and improved URL handling |
| Pkcs7Validator.java | Added timestamp validation call and fixed typo |
| AbstractPkcsValidator.java | Implemented timestamp validation logic |
| SignatureDictionary.java | Added getPDate method to retrieve parsed date objects |
| PDate.java | Added asDateWithTimeZone method for timezone-aware date conversion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| isSignerTimeValid = true; | ||
| } | ||
| } catch (Exception e) { | ||
| throw new RuntimeException(e); |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generic RuntimeException doesn't provide sufficient context about the timestamp validation failure. Consider creating a specific exception type (e.g., TimestampValidationException) or wrapping with SignatureIntegrityException with a descriptive message.
| } | ||
|
|
||
| public void validateTimestamp() { | ||
| if (timeStampToken == null) return; |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silent return when timeStampToken is null makes it unclear whether validation succeeded or was skipped. Consider logging at INFO or FINE level when timestamp validation is skipped.
| if (timeStampToken == null) return; | |
| if (timeStampToken == null) { | |
| logger.log(Level.FINE, "Timestamp validation skipped: timeStampToken is null."); | |
| return; | |
| } |
| CertificateException, CRLException, | ||
| CertificateVerificationException, NamingException { | ||
| if (crlURL.startsWith("https://")) { | ||
| if (crlURL.startsWith("http")) { |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition now accepts both 'http' and 'https' URLs, but also matches any string starting with 'http' (e.g., 'httpx://'). Use startsWith(\"http://\") || startsWith(\"https://\") for more precise validation.
| if (crlURL.startsWith("http")) { | |
| if (crlURL.startsWith("http://") || crlURL.startsWith("https://")) { |
GH-457