fun PrivateKey.sign(bytesToSign: ByteArray): DigitalSignature
Utility to simplify the act of signing a byte array.
bytesToSign
- the data/message to be signed in ByteArray form (usually the Merkle root).
IllegalArgumentException
- if the signature scheme is not supported for this private key.
InvalidKeyException
- if the private key is invalid.
SignatureException
- if signing is not possible due to malformed data or private key.
Return
the DigitalSignature object on the input message.
fun PrivateKey.sign(bytesToSign: ByteArray, publicKey: PublicKey): WithKey
Utility to simplify the act of signing a byte array and return a DigitalSignature.WithKey object. Note that there is no check if the public key matches with the signing private key.
bytesToSign
- the data/message to be signed in ByteArray form (usually the Merkle root).
IllegalArgumentException
- if the signature scheme is not supported for this private key.
InvalidKeyException
- if the private key is invalid.
SignatureException
- if signing is not possible due to malformed data or private key.
Return
the DigitalSignature.WithKey object on the input message bytesToSign and publicKey.