Class SignEncryptResult

java.lang.Object
co.ankatech.ankasecure.sdk.model.SignEncryptResult

public class SignEncryptResult extends Object
Result of a sign-then-encrypt operation.

Contains the nested JWE(JWS) token produced by signing plaintext (creating JWS) then encrypting the JWS (creating JWE). Metadata for both operations is separated to provide transparency about which keys were used at each step.

Token structure: JWE( JWS(plaintext) )

Since:
3.0.0
  • Constructor Details

    • SignEncryptResult

      public SignEncryptResult()
      Default constructor initializing empty warning lists.
  • Method Details

    • getJweToken

      public String getJweToken()
      Gets the nested JWE(JWS) token.
      Returns:
      compact serialized JWE token containing JWS
    • setJweToken

      public SignEncryptResult setJweToken(String jweToken)
      Sets the nested JWE(JWS) token.
      Parameters:
      jweToken - the token
      Returns:
      this instance for fluent API
    • getSignKeyRequested

      public String getSignKeyRequested()
      Gets the key identifier requested for signing.
      Returns:
      requested sign key ID
    • setSignKeyRequested

      public SignEncryptResult setSignKeyRequested(String signKeyRequested)
      Sets the key identifier requested for signing.
      Parameters:
      signKeyRequested - the key ID
      Returns:
      this instance for fluent API
    • getActualSignKeyUsed

      public String getActualSignKeyUsed()
      Gets the key identifier actually used for signing.

      May differ from requested if key rotation or fallback occurred.

      Returns:
      actual sign key ID used
    • setActualSignKeyUsed

      public SignEncryptResult setActualSignKeyUsed(String actualSignKeyUsed)
      Sets the key identifier actually used for signing.
      Parameters:
      actualSignKeyUsed - the key ID
      Returns:
      this instance for fluent API
    • getSignAlgorithmUsed

      public String getSignAlgorithmUsed()
      Gets the algorithm used for signing.

      Example: "ML-DSA-87", "ECDSA-P256-SHA256"

      Returns:
      signature algorithm
    • setSignAlgorithmUsed

      public SignEncryptResult setSignAlgorithmUsed(String signAlgorithmUsed)
      Sets the algorithm used for signing.
      Parameters:
      signAlgorithmUsed - the algorithm
      Returns:
      this instance for fluent API
    • getSignWarnings

      public List<String> getSignWarnings()
      Gets warnings related to the signing operation.

      Examples: key expiration, key rotation, deprecated algorithm.

      Returns:
      unmodifiable list of sign warnings (never null)
    • setSignWarnings

      public SignEncryptResult setSignWarnings(List<String> signWarnings)
      Sets warnings related to the signing operation.
      Parameters:
      signWarnings - the warnings
      Returns:
      this instance for fluent API
    • getEncryptKeyRequested

      public String getEncryptKeyRequested()
      Gets the key identifier requested for encryption.
      Returns:
      requested encrypt key ID
    • setEncryptKeyRequested

      public SignEncryptResult setEncryptKeyRequested(String encryptKeyRequested)
      Sets the key identifier requested for encryption.
      Parameters:
      encryptKeyRequested - the key ID
      Returns:
      this instance for fluent API
    • getActualEncryptKeyUsed

      public String getActualEncryptKeyUsed()
      Gets the key identifier actually used for encryption.

      May differ from requested if key rotation or fallback occurred.

      Returns:
      actual encrypt key ID used
    • setActualEncryptKeyUsed

      public SignEncryptResult setActualEncryptKeyUsed(String actualEncryptKeyUsed)
      Sets the key identifier actually used for encryption.
      Parameters:
      actualEncryptKeyUsed - the key ID
      Returns:
      this instance for fluent API
    • getEncryptAlgorithmUsed

      public String getEncryptAlgorithmUsed()
      Gets the algorithm used for encryption.

      Example: "ML-KEM-1024+A256GCM", "RSA-OAEP-256+A256GCM"

      Returns:
      encryption algorithm
    • setEncryptAlgorithmUsed

      public SignEncryptResult setEncryptAlgorithmUsed(String encryptAlgorithmUsed)
      Sets the algorithm used for encryption.
      Parameters:
      encryptAlgorithmUsed - the algorithm
      Returns:
      this instance for fluent API
    • getEncryptWarnings

      public List<String> getEncryptWarnings()
      Gets warnings related to the encryption operation.

      Examples: key expiration, key rotation, deprecated algorithm.

      Returns:
      unmodifiable list of encrypt warnings (never null)
    • setEncryptWarnings

      public SignEncryptResult setEncryptWarnings(List<String> encryptWarnings)
      Sets warnings related to the encryption operation.
      Parameters:
      encryptWarnings - the warnings
      Returns:
      this instance for fluent API
    • hasAnyWarnings

      public boolean hasAnyWarnings()
      Checks if there are any warnings (sign or encrypt).
      Returns:
      true if either signing or encryption produced warnings
    • hasSignWarnings

      public boolean hasSignWarnings()
      Checks if signing operation produced warnings.
      Returns:
      true if sign warnings list is non-empty
    • hasEncryptWarnings

      public boolean hasEncryptWarnings()
      Checks if encryption operation produced warnings.
      Returns:
      true if encrypt warnings list is non-empty
    • toString

      public String toString()
      Returns string representation for debugging.
      Overrides:
      toString in class Object
      Returns:
      debug string