Package convex.core.crypto
Class ASignature
- All Implemented Interfaces:
IValidated
,IWriteable
,Comparable<ABlobLike<?>>
- Direct Known Subclasses:
Ed25519Signature
Class representing a cryptographic signature
-
Field Summary
Fields inherited from class convex.core.data.AArrayBlob
contentHash, offset, store
Fields inherited from class convex.core.data.ACell
cachedRef, memorySize
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if this Blob is equal to another Blob.static ASignature
Construct a Signature from a Blob Uses Ed25519static ASignature
Construct a Signature from a hex string Uses Ed25519boolean
Determines if this Cell Represents an embedded object.static ASignature
read
(ByteBuffer bb) Reads a Signature from the given ByteBuffer.abstract boolean
verify
(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, byteAtUnchecked, calcMemorySize, compareTo, compareTo, encodeRaw, equalsBytes, equalsBytes, getByteBuffer, getBytes, getContentHash, getHexDigit, getInternalArray, getInternalOffset, getRef, getRefCount, hexMatch, hexMatch, hexMatches, isChunkPacked, isFullyPacked, longAt, longValue, rangeMatches, rangeMatches, read, shortAt, slice, toFlatBlob, updateDigest, updateRefs, validate, validateCell
Methods inherited from class convex.core.data.ABlob
computeHash, count, empty, encode, equals, get, getChunk, getElementRef, getTag, getType, hashCode, isCVMValue, print, read, replaceSlice, size, slice, toBlob, toByteBuffer, toCanonical
Methods inherited from class convex.core.data.ABlobLike
getBytes, hexEquals, hexLength, isDataValue, toHexString, toHexString
Methods inherited from class convex.core.data.ACountable
isEmpty
Methods inherited from class convex.core.data.ACell
attachMemorySize, attachRef, cachedEncoding, cachedHash, createEncoding, createRef, equals, genericEquals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getMemorySize, getRef, isCanonical, toCVMString, toString
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
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: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
-
equals
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 encoded representation, i.e. if and only if all of the following are true: - Blobs are of the same length - All byte values are equal- Overrides:
equals
in classAArrayBlob
- Parameters:
b
- Blob to compare with- Returns:
- true if Blobs are equal, false otherwise
-