corda / net.corda.core.crypto / TransactionSignature

TransactionSignature

class TransactionSignature : 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

<init>

TransactionSignature(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.

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

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.

Properties

by

val by: PublicKey

PublicKey of the signer.

partialMerkleTree

val partialMerkleTree: PartialMerkleTree?

required when multi-transaction signing is utilised.

signatureMetadata

val signatureMetadata: SignatureMetadata

attached SignatureMetadata for this signature.

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

isValid

fun isValid(txId: SecureHash): Boolean

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.

verify

fun verify(txId: SecureHash): Boolean

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.

Extension Properties

isZero

val OpaqueBytes.isZero: Boolean

Extension Functions

contextLogger

fun Any.contextLogger(): <ERROR CLASS>

When called from a companion object, returns the logger for the enclosing class.

deserialize

fun <T : Any> ByteSequence.deserialize(serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): T

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

deserializeWithCompatibleContext

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.

hashAs

fun OpaqueBytes.hashAs(algorithm: String): SecureHash

Compute the algorithm hash for the contents of the OpaqueBytes.

sha256

fun OpaqueBytes.sha256(): SHA256

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