Package convex.core.crypto
Class ASignature
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.crypto.ASignature
- All Implemented Interfaces:
IValidated
,IWriteable
- Direct Known Subclasses:
Ed25519Signature
Class representing a cryptographic signature
-
Field Summary
Fields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ASignature
Construct a Signature from a Blob Uses Ed25519static ASignature
Construct a Signature from a hex string Uses Ed25519protected abstract ABlob
Gets a Blob containing the raw bytes of this digital signaturebyte
getTag()
Gets the tag byte for this cell.boolean
Determines if this Cell Represents an embedded object.static ASignature
read(ByteBuffer bb)
Reads a Signature from the given ByteBuffer.abstract String
Gets the content of this Signature as a hex stringabstract boolean
verify(ABlob message, AccountKey publicKey)
Checks if the signature is valid for a given message hashMethods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, encode, encodeRaw, equals, equals, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, getRefCount, getType, hashCode, isCanonical, isCVMValue, toCanonical, toString, updateRefs, validate, validateCell, write
Methods inherited from class convex.core.data.AObject
attachEncoding, print, print
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface convex.core.data.IWriteable
estimatedEncodingSize
-
Constructor Details
-
ASignature
public ASignature()
-
-
Method Details
-
verify
Checks if the signature is valid for a given message hash- Parameters:
message
- Message to verifypublicKey
- Public key of signer- Returns:
- True if signature is valid, false otherwise
-
read
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
-
toHexString
Gets the content of this Signature as a hex string- Returns:
- Hex String representation of Signature
-
fromHex
Construct a Signature from a hex string Uses Ed25519- Parameters:
hex
- Hex String to read from- Returns:
- Signature instance
-
fromBlob
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 classACell
- 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 written as the first byte of the Cell's Encoding -
getSignatureBlob
Gets a Blob containing the raw bytes of this digital signature- Returns:
- Blob containing signature bytes
-