Class CAdESLongTermValuesUtil

java.lang.Object
org.bouncycastle.cades.CAdESLongTermValuesUtil

public final class CAdESLongTermValuesUtil extends Object
Helpers for upgrading a CAdES B-T signature to B-LT (RFC 5126 X-L / ETSI EN 319 122-1 B-LT) by attaching the four long-term validation-data attributes:
  • id-aa-ets-certificateRefs (RFC 5126 sec. 6.2.1) — digest + IssuerSerial references for each non-signer cert.
  • id-aa-ets-revocationRefs (RFC 5126 sec. 6.2.2) — digest references for each CRL (and/or OCSP response).
  • id-aa-ets-certValues (RFC 5126 sec. 6.3.3) — the cert bytes themselves.
  • id-aa-ets-revocationValues (RFC 5126 sec. 6.3.4) — the CRL / OCSP response bytes themselves.

Both CRL (X509CRLHolder) and OCSP (BasicOCSPResp) revocation material are supported. An OCSP response contributes:

  • An OcspResponsesID entry under the revocationRefs attribute's ocspids branch, holding the responder identifier, producedAt timestamp and a digest of the BasicOCSPResponse bytes (RFC 5126 sec. 6.2.2).
  • A BasicOCSPResponse entry under the revocationValues attribute's ocspVals branch (RFC 5126 sec. 6.3.4).
The caller is responsible for fetching the long-term material out-of-band (BC stays out of HTTP / OCSP transport); this helper only assembles the attributes and attaches them.

Level detector ordering: CAdESLevelDetector.attainedLevel(SignerInformation) only reports CAdESLevel.B_LT when a signature time-stamp (CAdESLevel.B_T) is also present on the signer; without it the detector keeps reporting CAdESLevel.B_B regardless of the four LT attributes being attached. Apply the signature time-stamp via CAdESSignatureTimestampUtil.applySignatureTimestamp(CMSSignedData, SignerId, TimeStampToken) first if you want the detector to advance.

Reading LT material back: getCertificateValues(SignerInformation), getCertificateRevocationLists(SignerInformation) and getOcspResponses(SignerInformation) expose the embedded trust material as the corresponding holder / response types so a relying party can plug them into JCA CertPathValidator / OCSP verification directly. validateLongTermValues(SignerInformation, DigestCalculatorProvider) checks the LT bundle is internally self-consistent (every reference's hash matches the corresponding value bytes); a full chain / revocation validation at the timestamp's genTime is the caller's responsibility and is built on top of those holders.