Skip to content

Conversation

@pcorless
Copy link
Owner

GH-457

  • first part of ticket is to improve signature validation process
  • makes an attempt to validate the signatures timestamp
  • lots of clean up and modernization around signature verification

@pcorless pcorless requested a review from Copilot January 12, 2026 04:28
Copy link

Copilot AI left a 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);
Copy link

Copilot AI Jan 12, 2026

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.

Copilot uses AI. Check for mistakes.
}

public void validateTimestamp() {
if (timeStampToken == null) return;
Copy link

Copilot AI Jan 12, 2026

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.

Suggested change
if (timeStampToken == null) return;
if (timeStampToken == null) {
logger.log(Level.FINE, "Timestamp validation skipped: timeStampToken is null.");
return;
}

Copilot uses AI. Check for mistakes.
CertificateException, CRLException,
CertificateVerificationException, NamingException {
if (crlURL.startsWith("https://")) {
if (crlURL.startsWith("http")) {
Copy link

Copilot AI Jan 12, 2026

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.

Suggested change
if (crlURL.startsWith("http")) {
if (crlURL.startsWith("http://") || crlURL.startsWith("https://")) {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants