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>

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)

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.

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

Properties

by

PublicKey of the signer.

val by: PublicKey

partialMerkleTree

required when multi-transaction signing is utilised.

val partialMerkleTree: PartialMerkleTree?

signatureMetadata

attached SignatureMetadata for this signature.

val signatureMetadata: SignatureMetadata

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

isValid

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.

fun isValid(txId: SecureHash): Boolean

verify

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.

fun verify(txId: SecureHash): Boolean

Extension Properties

isZero

val OpaqueBytes.isZero: Boolean

Extension Functions

deserialize

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

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

deserializeWithCompatibleContext

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

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

hashAs

Compute the algorithm hash for the contents of the OpaqueBytes.

fun OpaqueBytes.hashAs(algorithm: String): SecureHash

sha256

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

fun OpaqueBytes.sha256(): SHA256