Class DecryptVerifyResult
Contains the plaintext extracted after decrypting a nested JWE(JWS) token and verifying the inner JWS signature. Metadata for both operations is separated to provide transparency about decryption and signature verification.
Important: Check isSignatureValid() to confirm
authenticity. Decryption can succeed even if signature verification fails.
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the key identifier actually used for decryption.Gets the algorithm used for decryption.byte[]Gets the decrypted plaintext bytes.Gets the key identifier requested for decryption.Gets warnings related to the decryption operation.Gets the algorithm used for signing (from JWS header).Gets additional signer information (if present in JWS claims).Gets the key identifier used for signing (from JWS header).Gets warnings related to the signature verification operation.booleanChecks if there are any warnings (decrypt or verify).booleanChecks if decryption operation produced warnings.booleanChecks if verification operation produced warnings.booleanChecks if operation completed successfully with no issues.booleanChecks if the signature verification succeeded.setActualDecryptKeyUsed(String actualDecryptKeyUsed) Sets the key identifier actually used for decryption.setDecryptAlgorithmUsed(String decryptAlgorithmUsed) Sets the algorithm used for decryption.setDecryptedData(byte[] decryptedData) Sets the decrypted plaintext bytes.setDecryptKeyRequested(String decryptKeyRequested) Sets the key identifier requested for decryption.setDecryptWarnings(List<String> decryptWarnings) Sets warnings related to the decryption operation.setSignAlgorithmUsed(String signAlgorithmUsed) Sets the algorithm used for signing.setSignatureValid(boolean signatureValid) Sets whether signature verification succeeded.setSignerInfo(String signerInfo) Sets additional signer information.setSigningKey(String signingKey) Sets the key identifier used for signing.setVerifyWarnings(List<String> verifyWarnings) Sets warnings related to the signature verification operation.toString()Returns string representation for debugging.
-
Constructor Details
-
DecryptVerifyResult
public DecryptVerifyResult()Default constructor initializing empty warning lists.
-
-
Method Details
-
getDecryptedData
public byte[] getDecryptedData()Gets the decrypted plaintext bytes.- Returns:
- decrypted data (may be null if operation failed)
-
setDecryptedData
Sets the decrypted plaintext bytes.- Parameters:
decryptedData- the plaintext- Returns:
- this instance for fluent API
-
getDecryptKeyRequested
Gets the key identifier requested for decryption.- Returns:
- requested decrypt key ID
-
setDecryptKeyRequested
Sets the key identifier requested for decryption.- Parameters:
decryptKeyRequested- the key ID- Returns:
- this instance for fluent API
-
getActualDecryptKeyUsed
Gets the key identifier actually used for decryption.May differ from requested if key rotation occurred.
- Returns:
- actual decrypt key ID used
-
setActualDecryptKeyUsed
Sets the key identifier actually used for decryption.- Parameters:
actualDecryptKeyUsed- the key ID- Returns:
- this instance for fluent API
-
getDecryptAlgorithmUsed
Gets the algorithm used for decryption.Example: "ML-KEM-1024+A256GCM", "RSA-OAEP-256+A256GCM"
- Returns:
- decryption algorithm
-
setDecryptAlgorithmUsed
Sets the algorithm used for decryption.- Parameters:
decryptAlgorithmUsed- the algorithm- Returns:
- this instance for fluent API
-
getDecryptWarnings
Gets warnings related to the decryption operation.Examples: key expiration, key rotation, deprecated algorithm.
- Returns:
- unmodifiable list of decrypt warnings (never null)
-
setDecryptWarnings
Sets warnings related to the decryption operation.- Parameters:
decryptWarnings- the warnings- Returns:
- this instance for fluent API
-
isSignatureValid
public boolean isSignatureValid()Checks if the signature verification succeeded.Critical: Always check this before trusting the plaintext. Decryption can succeed even if signature is invalid.
- Returns:
- true if signature verification passed
-
setSignatureValid
Sets whether signature verification succeeded.- Parameters:
signatureValid- true if signature is valid- Returns:
- this instance for fluent API
-
getSigningKey
Gets the key identifier used for signing (from JWS header).- Returns:
- signing key ID
-
setSigningKey
Sets the key identifier used for signing.- Parameters:
signingKey- the key ID- Returns:
- this instance for fluent API
-
getSignAlgorithmUsed
Gets the algorithm used for signing (from JWS header).Example: "ML-DSA-87", "ECDSA-P256-SHA256"
- Returns:
- signature algorithm
-
setSignAlgorithmUsed
Sets the algorithm used for signing.- Parameters:
signAlgorithmUsed- the algorithm- Returns:
- this instance for fluent API
-
getSignerInfo
Gets additional signer information (if present in JWS claims).May contain subject, issuer, or other identity claims.
- Returns:
- signer information
-
setSignerInfo
Sets additional signer information.- Parameters:
signerInfo- the information- Returns:
- this instance for fluent API
-
getVerifyWarnings
Gets warnings related to the signature verification operation.Examples: key expiration, algorithm deprecation, timestamp issues.
- Returns:
- unmodifiable list of verify warnings (never null)
-
setVerifyWarnings
Sets warnings related to the signature verification operation.- Parameters:
verifyWarnings- the warnings- Returns:
- this instance for fluent API
-
hasAnyWarnings
public boolean hasAnyWarnings()Checks if there are any warnings (decrypt or verify).- Returns:
- true if either decryption or verification produced warnings
-
hasDecryptWarnings
public boolean hasDecryptWarnings()Checks if decryption operation produced warnings.- Returns:
- true if decrypt warnings list is non-empty
-
hasVerifyWarnings
public boolean hasVerifyWarnings()Checks if verification operation produced warnings.- Returns:
- true if verify warnings list is non-empty
-
isCompleteSuccess
public boolean isCompleteSuccess()Checks if operation completed successfully with no issues.Success means: signature valid AND no warnings.
- Returns:
- true if signature is valid and no warnings exist
-
toString
Returns string representation for debugging.
-