Class Ed25519Signature

All Implemented Interfaces:
IValidated, IWriteable

public class Ed25519Signature extends ASignature
Immutable dtata value class representing an Ed25519 digital signature.
  • Field Details

    • SIGNATURE_LENGTH

      public static final int SIGNATURE_LENGTH
      Length in bytes of an Ed25519 signature
      See Also:
      Constant Field Values
    • ZERO

      public static final ASignature ZERO
      A Signature containing zerod bytes (not valid)
  • Method Details

    • wrap

      public static Ed25519Signature wrap(byte[] signature)
      Creates a Signature instance with specific bytes
      Parameters:
      signature - Bytes for signature
      Returns:
      Signature instance
    • isCanonical

      public boolean isCanonical()
      Description copied from class: ACell
      Returns true if this Cell is in a canonical format for message writing. Reading or writing a non-canonical value should be considered illegal, but non-canonical objects may be used on a temporary internal basis.
      Specified by:
      isCanonical in class ACell
      Returns:
      true if the object is in canonical format, false otherwise
    • toCanonical

      public ACell toCanonical()
      Description copied from class: ACell
      Converts this Cell to its canonical version. Returns this if already canonical
      Specified by:
      toCanonical in class ACell
      Returns:
      Canonical version of Cell
    • isCVMValue

      public final boolean isCVMValue()
      Description copied from class: ACell
      Returns true if this object represents a first class CVM Value. Sub-structural cells that are not themselves first class values should return false. CVM values might not be in a canonical format, e.g. temporary data structures
      Specified by:
      isCVMValue in class ACell
      Returns:
      true if the object is a CVM Value, false otherwise
    • read

      public static Ed25519Signature read(ByteBuffer bb) throws BadFormatException
      Read a signature from a ByteBuffer. Assumes tag already read.
      Parameters:
      bb - ByteBuffer to read from
      Returns:
      Signature instance
      Throws:
      BadFormatException - If encoding is invalid
    • encode

      public int encode(byte[] bs, int pos)
      Description copied from class: ACell
      Writes this Cell's encoding to a byte array, including a tag byte which will be written first
      Specified by:
      encode in interface IWriteable
      Specified by:
      encode in class ACell
      Parameters:
      bs - A byte array to which to write the encoding
      pos - The offset into the byte array
      Returns:
      New position after writing
    • encodeRaw

      public int encodeRaw(byte[] bs, int pos)
      Description copied from class: ACell
      Writes this Cell's encoding to a byte array, excluding the tag byte
      Specified by:
      encodeRaw in class ACell
      Parameters:
      bs - A byte array to which to write the encoding
      pos - The offset into the byte array
      Returns:
      New position after writing
    • print

      public void print(StringBuilder sb)
      Description copied from class: AObject
      Prints this Object to a readable String Representation
      Specified by:
      print in class AObject
      Parameters:
      sb - StringBuilder to append to
    • verify

      public boolean verify(ABlob message, AccountKey address)
      Description copied from class: ASignature
      Checks if the signature is valid for a given message hash
      Specified by:
      verify in class ASignature
      Parameters:
      message - Message to verify
      address - Public key of signer
      Returns:
      True if signature is valid, false otherwise
    • validateCell

      public void validateCell() throws InvalidDataException
      Description copied from class: ACell
      Validates the local structure and invariants of this cell. Called by validate() super implementation. Should validate directly contained data, but should not validate all other structure of this cell. In particular, should not traverse potentially missing child Refs.
      Specified by:
      validateCell in class ACell
      Throws:
      InvalidDataException - If the Cell is invalid
    • estimatedEncodingSize

      public int estimatedEncodingSize()
      Description copied from interface: IWriteable
      Estimate the encoded data size for this Cell. Used for quickly sizing buffers. Implementations should try to return a size that is likely to contain the entire object when represented in binary format, including the tag byte.
      Returns:
      The estimated size for the binary representation of this object.
    • getRefCount

      public int getRefCount()
      Description copied from class: ACell
      Gets the number of Refs contained within this Cell. This number is final / immutable for any given instance. Contained Refs may be either external or embedded.
      Specified by:
      getRefCount in class ACell
      Returns:
      The number of Refs in this Cell
    • toHexString

      public String toHexString()
      Description copied from class: ASignature
      Gets the content of this Signature as a hex string
      Specified by:
      toHexString in class ASignature
      Returns:
      Hex String representation of Signature
    • getSignatureBlob

      public Blob getSignatureBlob()
      Description copied from class: ASignature
      Gets a Blob containing the raw bytes of this digital signature
      Specified by:
      getSignatureBlob in class ASignature
      Returns:
      Blob containing signature bytes