Class ASignature

All Implemented Interfaces:
IValidated, IWriteable, Comparable<ABlob>
Direct Known Subclasses:
Ed25519Signature

public abstract class ASignature extends AArrayBlob
Class representing a cryptographic signature
  • Constructor Details

    • ASignature

      protected ASignature(byte[] signature, int pos)
  • Method Details

    • verify

      public abstract boolean verify(AArrayBlob message, AccountKey publicKey)
      Checks if the signature is valid for a given message hash
      Parameters:
      message - Message to verify
      publicKey - Public key of signer
      Returns:
      True if signature is valid, false otherwise
    • read

      public static ASignature read(ByteBuffer bb) throws BadFormatException
      Reads a Signature from the given ByteBuffer. Assumes tag byte already read. Uses Ed25519
      Parameters:
      bb - ByteBuffer to read from
      Returns:
      Signature instance
      Throws:
      BadFormatException - If encoding is invalid
    • fromHex

      public static ASignature fromHex(String hex)
      Construct a Signature from a hex string Uses Ed25519
      Parameters:
      hex - Hex String to read from
      Returns:
      Signature instance
    • fromBlob

      public static ASignature fromBlob(ABlob sigData)
      Construct a Signature from a Blob Uses Ed25519
      Parameters:
      sigData - Blob of data representing raw signature
      Returns:
      Signature instance
    • isEmbedded

      public boolean isEmbedded()
      Description copied from class: ACell
      Determines if this Cell Represents an embedded object. Embedded objects are encoded directly into the encoding of the containing Cell (avoiding the need for a hashed reference). Subclasses should override this if they have a cheap O(1) way to determine if they are embedded or otherwise.
      Overrides:
      isEmbedded in class ACell
      Returns:
      true if Cell is embedded, false otherwise
    • getTag

      public byte getTag()
      Description copied from class: ACell
      Gets the tag byte for this cell. The tag byte is always equal to the first byte of the Cell's canonical Encoding, and is sufficient to distinguish how to read the rest of the encoding.
      Overrides:
      getTag in class AArrayBlob
      Returns:
      Tag byte for this Cell
    • getBytes

      public abstract byte[] getBytes()
      Gets the raw bytes representing this signature, as a zero based array
      Overrides:
      getBytes in class ABlobLike<CVMLong>
      Returns:
      byte array from this signature
    • equals

      public boolean equals(ABlob b)
      Description copied from class: ABlob
      Determines if this Blob is equal to another Blob. Blobs are defined to be equal if they have the same on-chain representation, i.e. if and only if all of the following are true: - Blob is of the same general type - Blobs are of the same length - All byte values are equal
      Overrides:
      equals in class AArrayBlob
      Parameters:
      b - Blob to compare with
      Returns:
      true if Blobs are equal, false otherwise