TransactionSignature

class TransactionSignature(bytes: ByteArray, val by: PublicKey, val signatureMetadata: SignatureMetadata, val partialMerkleTree: PartialMerkleTree?) : DigitalSignature

A wrapper over the signature output accompanied by signer's public key and signature metadata. This is similar to DigitalSignature.WithKey, but targeted to DLT transaction (or block of transactions) signatures.

Constructors

Link copied to clipboard
constructor(bytes: ByteArray, by: PublicKey, signatureMetadata: SignatureMetadata)

Construct a TransactionSignature with partialMerkleTree set to null. This is the recommended constructor when signing over a single transaction.

constructor(bytes: ByteArray, by: PublicKey, signatureMetadata: SignatureMetadata, partialMerkleTree: PartialMerkleTree?)

Properties

Link copied to clipboard

PublicKey of the signer.

Link copied to clipboard
override val bytes: ByteArray

The bytes are always cloned so that this object becomes immutable. This has been done to prevent tampering with entities such as net.corda.core.crypto.SecureHash and net.corda.core.contracts.PrivacySalt, as well as preserve the integrity of our hash constants net.corda.core.crypto.SecureHash.zeroHash and net.corda.core.crypto.SecureHash.allOnesHash.

Link copied to clipboard
Link copied to clipboard
val offset: Int

The start position of the sequence within the byte array.

Link copied to clipboard

required when multi-transaction signing is utilised.

Link copied to clipboard

attached SignatureMetadata for this signature.

Link copied to clipboard
val size: Int

The number of bytes this sequence represents.

Functions

Link copied to clipboard
inline fun <T : Any> ByteSequence.checkpointDeserialize(context: CheckpointSerializationContext = effectiveSerializationEnv.checkpointContext): T
Link copied to clipboard
open operator override fun compareTo(other: ByteSequence): Int

Compare byte arrays byte by byte. Arrays that are shorter are deemed less than longer arrays if all the bytes of the shorter array equal those in the same position of the longer array.

Link copied to clipboard

Copy this sequence, complete with new backing array. This can be helpful to break references to potentially large backing arrays from small sub-sequences.

Link copied to clipboard

Same as copy but returns just the new byte array.

Link copied to clipboard
inline fun <T : Any> ByteSequence.deserialize(serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): T

Convenience extension method for deserializing a ByteSequence, utilising the defaults.

Link copied to clipboard
inline fun <T : Any> ByteSequence.deserializeWithCompatibleContext(serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): ObjectWithCompatibleContext<T>

Additionally returns SerializationContext which was used for encoding. It might be helpful to know SerializationContext to use the same encoding in the reply.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Compute the algorithm hash for the contents of the OpaqueBytes.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Utility to simplify the act of verifying a signature. In comparison to verify doesn't throw an exception, making it more suitable where a boolean is required, but normally you should use the function which throws, as it avoids the risk of failing to test the result.

Link copied to clipboard

Returns a ByteArrayInputStream of the bytes.

Link copied to clipboard

Write this sequence to a ByteBuffer.

Link copied to clipboard

Compute the SHA-256 hash for the contents of the OpaqueBytes.

Link copied to clipboard
fun slice(start: Int = 0, end: Int = size): ByteBuffer

A new read-only ByteBuffer view of this sequence or part of it. If start or end are negative then IllegalArgumentException is thrown, otherwise they are clamped if necessary. This method cannot be used to get bytes before offset or after offset+size, and never makes a new array.

Link copied to clipboard
fun subSequence(offset: Int, size: Int): ByteSequence

Create a sub-sequence of this sequence. A copy of the underlying array may be made, if a subclass overrides bytes to do so, as OpaqueBytes does.

Link copied to clipboard

Take the first n bytes of this sequence as a sub-sequence. See subSequence for further semantics.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Function to verify a SignableData object's signature. Note that SignableData contains the id of the transaction and extra metadata, such as DLT's platform version. A non-null partialMerkleTree implies multi-transaction signing and the signature is over the root of this tree.

Link copied to clipboard
fun writeTo(output: OutputStream)

Write this sequence to an OutputStream.