Package convex.core.crypto
Class ASignature
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.data.ACountable<CVMLong>
convex.core.data.ABlob
convex.core.data.AArrayBlob
convex.core.crypto.ASignature
- All Implemented Interfaces:
IValidated,IWriteable,Comparable<ABlob>
- Direct Known Subclasses:
Ed25519Signature
Class representing a cryptographic signature
-
Field Summary
Fields inherited from class convex.core.data.AArrayBlob
length, offset, storeFields inherited from class convex.core.data.ABlob
contentHashFields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if this Blob is equal to another Blob.static ASignatureConstruct a Signature from a Blob Uses Ed25519static ASignatureConstruct a Signature from a hex string Uses Ed25519abstract byte[]getBytes()Gets the raw bytes representing this signature, as a zero based arraybytegetTag()Gets the tag byte for this cell.booleanDetermines if this Cell Represents an embedded object.booleanReturns true if this object is a regular blob (i.e.static ASignatureread(ByteBuffer bb) Reads a Signature from the given ByteBuffer.abstract booleanverify(AArrayBlob message, AccountKey publicKey) Checks if the signature is valid for a given message hashMethods inherited from class convex.core.data.AArrayBlob
append, appendHex, appendSmall, byteAt, commonHexPrefixLength, compareTo, compareTo, count, encodeRaw, equalsBytes, equalsBytes, getByteBuffer, getBytes, getHexDigit, getInternalArray, getInternalOffset, getRefCount, getUnchecked, hexMatches, hexMatchLength, longAt, longValue, rangeMatches, rangeMatches, shortAt, slice, toExactLong, toFlatBlob, updateDigest, validate, validateCell, writeToBuffer, writeToBufferMethods inherited from class convex.core.data.ABlob
computeHash, empty, equals, get, getChunk, getContentHash, getElementRef, getType, hashCode, hexEquals, hexEquals, hexLength, isCVMValue, print, slice, toByteBuffer, toCanonical, toHexString, toHexStringMethods inherited from class convex.core.data.ACountable
isEmpty, sizeMethods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, encode, equals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, isCanonical, isCompletelyEncoded, mark, mark, toCVMString, toString, updateRefs, writeMethods inherited from class convex.core.data.AObject
attachEncoding, print, printMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface convex.core.data.IWriteable
estimatedEncodingSize
-
Constructor Details
-
ASignature
protected ASignature(byte[] signature, int pos)
-
-
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
-
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:ACellDetermines 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:
isEmbeddedin classACell- Returns:
- true if Cell is embedded, false otherwise
-
getTag
public byte getTag()Description copied from class:ACellGets 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:
getTagin classAArrayBlob- Returns:
- Tag byte for this Cell
-
getBytes
public abstract byte[] getBytes()Gets the raw bytes representing this signature, as a zero based array -
isRegularBlob
public boolean isRegularBlob()Description copied from class:ABlobReturns true if this object is a regular blob (i.e. not a special blob type like Address)- Overrides:
isRegularBlobin classABlob- Returns:
- True if a regular blob
-
equals
Description copied from class:ABlobDetermines 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:
equalsin classAArrayBlob- Parameters:
b- Blob to compare with- Returns:
- true if Blobs are equal, false otherwise
-