Class SignatureEntry

java.lang.Object
com.authlete.hms.SignatureEntry

public class SignatureEntry extends Object
Signature entry, a pack of label, signature, and signature metadata.
Since:
1.4
  • Constructor Details

    • SignatureEntry

      public SignatureEntry()
      Default constructor.
    • SignatureEntry

      public SignatureEntry(String label, byte[] signature, SignatureMetadata metadata)
      Constructor with initial property values.
      Parameters:
      label - The label assigned to the signature.
      signature - The signature.
      metadata - The signature metadata.
  • Method Details

    • getLabel

      public String getLabel()
      Get the label assigned to the signature.

      This should be the key of a member in the Signature and Signature-Input HTTP fields.

      Returns:
      The label.
    • setLabel

      public SignatureEntry setLabel(String label)
      Set the label assigned to the signature.

      This should be the key of a member in the Signature and Signature-Input HTTP fields.

      Parameters:
      label - The label.
      Returns:
      this object.
    • getSignature

      public byte[] getSignature()
      Get the signature.

      This should be the value of a member in the Signature HTTP field.

      Returns:
      The signature.
    • setSignature

      public SignatureEntry setSignature(byte[] signature)
      Set the signature.

      This should be the value of a member in the Signature HTTP field.

      Parameters:
      signature - The signature.
      Returns:
      this object.
    • getMetadata

      public SignatureMetadata getMetadata()
      Get the signature metadata.

      This should be the value of a member in the Signature-Input HTTP field.

      Returns:
      The signature metadata.
    • setMetadata

      public SignatureEntry setMetadata(SignatureMetadata metadata)
      Set the signature metadata.

      This should be the value of a member in the Signature-Input HTTP field.

      Parameters:
      metadata - The signature metadata.
      Returns:
      this object.
    • toString

      public String toString()
      Get the string representation of this instance in the following format: "label={label}, signature={signature}, metadata={metadata}".

      If the label is set, {label} is replaced with its value; otherwise, it is an empty string.

      If the signature is set, {signature} is replaced with :{base64-encoded-signature}:; otherwise, it is an empty string.

      If the signature metadata is set, {signature} is replaced with the result of SignatureMetadata.serialize(); otherwise, it is an empty string.

      Overrides:
      toString in class Object
      Returns:
      The string representation of this instance.
    • scan

      public static Map<String,SignatureEntry> scan(SignatureField signatureField, SignatureInputField signatureInputField) throws IllegalArgumentException
      Build a list of signature entries from the provided Signature and Signature-Input HTTP fields.

      This method is an alias of scan(signatureField, signatureInputField, null).

      Parameters:
      signatureField - A SignatureField instance that represents the value of the Signature HTTP field.
      signatureInputField - A SignatureInputField instance that represents the value of the Signature-Input HTTP field.
      Returns:
      A map of signature entries, whose keys are signature labels and values are signature entries.
      Throws:
      IllegalArgumentException - Input data are invalid.
    • scan

      public static Map<String,SignatureEntry> scan(SignatureField signatureField, SignatureInputField signatureInputField, String tag) throws IllegalArgumentException
      Build a list of signature entries from the provided Signature and Signature-Input HTTP fields.

      If both the signatureField and the signatureInputField are null, this method returns null.

      If either of the signatureField or the signatureInputField is null but the other is not null, this method throws an exception.

      If both the signatureField and the signatureInputField are non-null, but the number of members in the signatureInputField does not match the number of members in the signatureField, this method throws an exception.

      If the signatureInputField does not contain a label found in the signatureField, this method throws an exception.

      In other cases, that is, if both the signatureField and the signatureInputField are non-null, their numbers of members are equal, and all the labels in the signatureField are present in the signatureInputField, this method builds a list of signature entries from the contents of the signatureField and the signatureInputField.

      Parameters:
      signatureField - A SignatureField instance that represents the value of the Signature HTTP field.
      signatureInputField - A SignatureInputField instance that represents the value of the Signature-Input HTTP field.
      tag - A tag value for filtering. If a non-null value is specified, only signatures with the tag value are included in the result.
      Returns:
      A map of signature entries, whose keys are signature labels and values are signature entries.
      Throws:
      IllegalArgumentException - Input data are invalid.