corda / net.corda.core.crypto / Crypto / isValid

isValid

@JvmStatic fun isValid(txId: SecureHash, transactionSignature: TransactionSignature): 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 and false if not. In comparison to doVerify if the key and signature do not match it returns false rather than throwing an exception. Normally you should use the function which throws, as it avoids the risk of failing to test the result.

Parameters

txId - transaction's id.

transactionSignature - the signature on the transaction.

Exceptions

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.

@JvmStatic fun isValid(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 and false if not. In comparison to doVerify if the key and signature do not match it returns false rather than throwing an exception. Normally you should use the function which throws, as it avoids the risk of failing to test the result. Use this method if the signature scheme is not a-priori known.

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

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.

Return
true if verification passes or false if verification fails.

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

Method to verify a digital signature. In comparison to doVerify if the key and signature do not match it returns false rather than throwing an exception. Use this method if the signature scheme type is a-priori unknown.

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

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 requested signature scheme is not supported.

Return
true if verification passes or false if verification fails.