corda / net.corda.core.crypto / Crypto / doVerify

doVerify

@JvmStatic fun doVerify(schemeCodeName: String, publicKey: PublicKey, signatureData: ByteArray, clearData: ByteArray): Boolean

Utility to simplify the act of verifying a digital signature. It returns true if it succeeds, but it always throws an exception if verification fails.

Parameters

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

publicKey - the signer's PublicKey.

signatureData - the signatureData on a message.

clearData - the clear data/message that was signed (usually the Merkle root).

Exceptions

InvalidKeyException - if the key is invalid.

SignatureException - if this signatureData object is not initialized properly, the passed-in signatureData is improperly encoded or of the wrong type, if this signatureData scheme is unable to process the input data provided, if the verification is not possible.

IllegalArgumentException - if the signature scheme is not supported or if any of the clear or signature data is empty.

Return
true if verification passes or throws an exception if verification fails.

@JvmStatic fun doVerify(publicKey: PublicKey, signatureData: ByteArray, clearData: ByteArray): Boolean

Utility to simplify the act of verifying a digital signature by identifying the signature scheme used from the input public key's type. It returns true if it succeeds, but it always throws an exception if verification fails. Strategy on identifying the actual signing scheme is based on the PublicKey type, but if the schemeCodeName is known, then better use doVerify(schemeCodeName: String, publicKey: PublicKey, signatureData: ByteArray, clearData: ByteArray).

Parameters

publicKey - the signer's PublicKey.

signatureData - the signatureData on a message.

clearData - the clear data/message that was signed (usually the Merkle root).

Exceptions

InvalidKeyException - if the key is invalid.

SignatureException - if this signatureData object is not initialized properly, the passed-in signatureData is improperly encoded or of the wrong type, if this signatureData scheme is unable to process the input data provided, if the verification is not possible.

IllegalArgumentException - if the signature scheme is not supported or if any of the clear or signature data is empty.

Return
true if verification passes or throws an exception if verification fails.

@JvmStatic fun doVerify(signatureScheme: SignatureScheme, publicKey: PublicKey, signatureData: ByteArray, clearData: ByteArray): Boolean

Method to verify a digital signature. It returns true if it succeeds, but it always throws an exception if verification fails.

Parameters

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

publicKey - the signer's PublicKey.

signatureData - the signatureData on a message.

clearData - the clear data/message that was signed (usually the Merkle root).

Exceptions

InvalidKeyException - if the key is invalid.

SignatureException - if this signatureData object is not initialized properly, the passed-in signatureData is improperly encoded or of the wrong type, if this signatureData scheme is unable to process the input data provided, if the verification is not possible.

IllegalArgumentException - if the signature scheme is not supported or if any of the clear or signature data is empty.

Return
true if verification passes or throws an exception if verification fails.

@JvmStatic fun doVerify(txId: SecureHash, transactionSignature: TransactionSignature): Boolean

Utility to simplify the act of verifying a TransactionSignature. It returns true if it succeeds, but it always throws an exception if verification fails.

Parameters

txId - transaction's id.

transactionSignature - the signature on the transaction.

Exceptions

InvalidKeyException - if the key is invalid.

SignatureException - if this signatureData object is not initialized properly, the passed-in signatureData is improperly encoded or of the wrong type, if this signatureData scheme is unable to process the input data provided, if the verification is not possible.

IllegalArgumentException - if the signature scheme is not supported or if any of the clear or signature data is empty.

Return
true if verification passes or throw exception if verification fails.