doSign

fun doSign(privateKey: PrivateKey, clearData: ByteArray): ByteArray

Generic way to sign ByteArray data with a PrivateKey. Strategy on on identifying the actual signing scheme is based on the PrivateKey type, but if the schemeCodeName is known, then better use doSign(signatureScheme: String, privateKey: PrivateKey, clearData: ByteArray).

Return

the digital signature (in ByteArray) on the input message.

Parameters

privateKey

the signer's PrivateKey.

clearData

the data/message to be signed in ByteArray form (usually the Merkle root).

Throws

if the signature scheme is not supported for this private key.

if the private key is invalid.

if signing is not possible due to malformed data or private key.


fun doSign(schemeCodeName: String, privateKey: PrivateKey, clearData: ByteArray): ByteArray

Generic way to sign ByteArray data with a PrivateKey and a known schemeCodeName String.

Return

the digital signature (in ByteArray) on the input message.

Parameters

schemeCodeName

a signature scheme's code name (e.g. ECDSA_SECP256K1_SHA256).

privateKey

the signer's PrivateKey.

clearData

the data/message to be signed in ByteArray form (usually the Merkle root).

Throws

if the signature scheme is not supported.

if the private key is invalid.

if signing is not possible due to malformed data or private key.


fun doSign(signatureScheme: SignatureScheme, privateKey: PrivateKey, clearData: ByteArray): ByteArray

Generic way to sign ByteArray data with a PrivateKey and a known Signature.

Return

the digital signature (in ByteArray) on the input message.

Parameters

signatureScheme

a SignatureScheme object, retrieved from supported signature schemes, see Crypto.

privateKey

the signer's PrivateKey.

clearData

the data/message to be signed in ByteArray form (usually the Merkle root).

Throws

if the signature scheme is not supported for this private key.

if the private key is invalid.

if signing is not possible due to malformed data or private key.


fun doSign(keyPair: KeyPair, signableData: SignableData): TransactionSignature

Generic way to sign SignableData objects with a PrivateKey. SignableData is a wrapper over the transaction's id (Merkle root) in order to attach extra information, such as a timestamp or partial and blind signature indicators.

Return

a TransactionSignature object than contains the output of a successful signing, signer's public key and the signature metadata.

Parameters

keyPair

the signer's KeyPair.

signableData

a SignableData object that adds extra information to a transaction.

Throws

if the signature scheme is not supported for this private key.

if the private key is invalid.

if signing is not possible due to malformed data or private key.