Class SigStructure


public class SigStructure extends CBORItemList
Sig Signature

This class represents Sig_structure which is defined in 4.4. Signing and Verification Process of RFC 9052 as follows.

 Sig_structure = [
     context : "Signature" / "Signature1",
     body_protected : empty_or_serialized_map,
     ? sign_protected : empty_or_serialized_map,
     external_aad : bstr,
     payload : bstr
 ]
 
Since:
1.1
See Also:
  • Constructor Details

    • SigStructure

      public SigStructure(COSEProtectedHeader bodyAttributes, COSEProtectedHeader signerAttributes, CBORByteArray externalData, CBORByteArray payload)
      A constructor with the protected header of the content, the protected header of COSE_Signature, the external data and the payload.

      This constructor is for COSE_Sign.

      Parameters:
      bodyAttributes - The protected header of the content. Must not be null.
      signerAttributes - The protected header of COSE_Signature. Must not be null.
      externalData - The external data.
      payload - The payload.
    • SigStructure

      public SigStructure(COSEProtectedHeader bodyAttributes, CBORByteArray externalData, CBORByteArray payload)
      A constructor with the protected header of the content, the external data and the payload.

      This constructor is for COSE_Sign1.

      Parameters:
      bodyAttributes - The protected header of the content. Must not be null.
      externalData - The external data.
      payload - The payload.
  • Method Details

    • getContext

      public CBORString getContext()
      Get the context.
      Returns:
      A CBORString representing either "Signature" or "Signature1".
    • getBodyAttributes

      public COSEProtectedHeader getBodyAttributes()
      Get the protected header of the content.
      Returns:
      The protected header of the content.
    • getSignerAttributes

      public COSEProtectedHeader getSignerAttributes()
      Get the protected header of COSE_Signature.

      Note that this is not available when the context is "Signature1".

      Returns:
      The protected header of COSE_Signature.
    • getExternalData

      public CBORByteArray getExternalData()
      Get the external data.
      Returns:
      The external data.
    • getPayload

      public CBORByteArray getPayload()
      Get the payload.
      Returns:
      The payload.
    • isSignature

      public boolean isSignature()
      Check if the context is "Signature".
      Returns:
      true if the context is "Signature".
    • isSignature1

      public boolean isSignature1()
      Check if the context is "Signature1".
      Returns:
      true if the context is "Signature1".