Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-15586 Split verification from TransactionSignatureService into TransactionSignatureVerificationService #1206

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cordaProductVersion = 5.1.0
# NOTE: update this each time this module contains a breaking change
## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to
## a per module property in which case module versions can change independently.
cordaApiRevision = 13
cordaApiRevision = 14

# Main
kotlinVersion = 1.8.21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
/**
* TransactionSignatureService can be used to sign and verify transaction signatures.
* It supports both single and batch signatures.
* It can be used only in flows.
*/
@DoNotImplement
public interface TransactionSignatureService {
public interface TransactionSignatureService extends TransactionSignatureVerificationService{

/**
* Signs a transaction ID with all the available keys.
Expand Down Expand Up @@ -53,20 +54,4 @@ List<List<DigitalSignatureAndMetadata>> signBatch(
@NotNull final List<TransactionWithMetadata> transactions,
@NotNull final Iterable<PublicKey> publicKeys
);

/**
* Verifies a signature against a transaction.
* The underlying verification service signals the verification failures with different exceptions.
* {@link DigitalSignatureVerificationService}
*
* @param transaction The original transaction.
* @param signatureWithMetadata The signature to be verified.
* @param publicKey The public key to verify against. It must match with signatureWithMetadata's keyId.
* @throws RuntimeException if the signature could not be verified.
*/
void verifySignature(
@NotNull final TransactionWithMetadata transaction,
@NotNull final DigitalSignatureAndMetadata signatureWithMetadata,
@NotNull final PublicKey publicKey
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package net.corda.v5.ledger.common.transaction;

import net.corda.v5.application.crypto.DigitalSignatureAndMetadata;
import net.corda.v5.application.crypto.DigitalSignatureVerificationService;
import net.corda.v5.base.annotations.DoNotImplement;
import net.corda.v5.base.annotations.Suspendable;
import net.corda.v5.crypto.SecureHash;
import net.corda.v5.crypto.merkle.MerkleProof;
import org.jetbrains.annotations.NotNull;

import java.security.PublicKey;
import java.util.List;

/**
* TransactionSignatureVerificationService can be used to verify transaction signatures.
* It supports both single and batch signatures.
* It can be used in both flows and contracts.
*/
@DoNotImplement
public interface TransactionSignatureVerificationService {
/**
* Verifies a signature against a transaction.
* The underlying verification service signals the verification failures with different exceptions.
* {@link DigitalSignatureVerificationService}
*
* @param transaction The original transaction.
vlajos marked this conversation as resolved.
Show resolved Hide resolved
* @param signatureWithMetadata The signature to be verified.
* @param publicKey The public key to verify against. It must match with signatureWithMetadata's keyId.
* @throws RuntimeException if the signature could not be verified.
*/
void verifySignature(
@NotNull final TransactionWithMetadata transaction,
@NotNull final DigitalSignatureAndMetadata signatureWithMetadata,
@NotNull final PublicKey publicKey
);

/**
* Verifies a signature against a SecureHash.
* The underlying verification service signals the verification failures with different exceptions.
* {@link DigitalSignatureVerificationService}
*
* @param secureHash The original secureHash.
* @param signatureWithMetadata The signature to be verified.
* @param publicKey The public key to verify against. It must match with signatureWithMetadata's keyId.
* @throws RuntimeException if the signature could not be verified.
*/
void verifySignature(
@NotNull final SecureHash secureHash,
@NotNull final DigitalSignatureAndMetadata signatureWithMetadata,
@NotNull final PublicKey publicKey
);

}