Class COSERecipient


public class COSERecipient extends COSEObject
COSE_recipient

COSE_recipient is defined in 5.1. Enveloped COSE Structure of RFC 9052 as follows.

 COSE_recipient = [
     Headers,
     ciphertext : bstr / nil,
     ? recipients : [+COSE_recipient]
 ]
 
Since:
1.1
See Also:
  • Constructor Details

    • COSERecipient

      public COSERecipient(COSEProtectedHeader protectedHeader, COSEUnprotectedHeader unprotectedHeader, CBORItem ciphertext)
      A constructor with a protected header, an unprotected header and a cipher text.
      Parameters:
      protectedHeader - A protected header. Must not be null.
      unprotectedHeader - An unprotected header. Must not be null.
      ciphertext - A cipher text. Must be either CBORByteArray or CBORNull.
    • COSERecipient

      public COSERecipient(COSEProtectedHeader protectedHeader, COSEUnprotectedHeader unprotectedHeader, CBORItem ciphertext, CBORItemList recipients)
      A constructor with a protected header, an unprotected header, a cipher text and recipients.
      Parameters:
      protectedHeader - A protected header. Must not be null.
      unprotectedHeader - An unprotected header. Must not be null.
      ciphertext - A cipher text. Must be either CBORByteArray or CBORNull.
      recipients - Recipients. Must not be null. Items in the list must be instances of COSERecipient. At least one element must be contained.
  • Method Details

    • getCiphertext

      public CBORItem getCiphertext()
      Get the cipher text.

      The type of the value is CBORByteArray or CBORNull.

      Returns:
      The cipher text.
    • getRecipients

      public CBORItemList getRecipients()
      Get the list of recipients. Items in the list are COSERecipient instances.
      Returns:
      The list of recipients. null is returned if this instance was created without recipients.
    • build

      public static COSERecipient build(CBORItem item) throws COSEException
      Interpret the given CBOR data item as a recipient and build an instance of COSERecipient from it.
      Parameters:
      item - A CBOR data item that represents a recipient. It must be a CBOR array.
      Returns:
      A recipient.
      Throws:
      COSEException - The given CBOR data item does not conform to the requirements of recipient.
    • build

      public static COSERecipient build(List<Object> list) throws COSEException
      Build a COSERecipient instance from the given object list.
      Parameters:
      list - A object list that represents COSE_recipient.
      Returns:
      A COSERecipient instance built from the given object list.
      Throws:
      COSEException