@DoNotImplement public TransactionWithSignatures extends NamedByHash
An interface for transactions containing signatures, with logic for signature verification.
@NotNull java.util.List<net.corda.core.crypto.TransactionSignature> getSigs()
List of signatures on this transaction.
checkSignaturesAreValid
,
verifyRequiredSignatures
@NotNull java.util.Set<java.security.PublicKey> getRequiredSigningKeys()
Specifies all the public keys that require signatures for the transaction to be valid.
void verifyRequiredSignatures()
Verifies the signatures on this transaction and throws if any are missing. In this context, "verifying" means
checking they are valid signatures and that their public keys are in the requiredSigningKeys
set.
SignatureException
- if any signatures are invalid or unrecognised.SignaturesMissingException
- if any signatures should have been present but were not.requiredSigningKeys
void verifySignaturesExcept(@NotNull java.security.PublicKey... allowedToBeMissing)
Verifies the signatures on this transaction and throws if any are missing which aren't passed as parameters.
In this context, "verifying" means checking they are valid signatures and that their public keys are in
the requiredSigningKeys
set.
Normally you would not provide any keys to this function, but if you're in the process of building a partial transaction and you want to access the contents before you've signed it, you can specify your own keys here to bypass that check.
SignatureException
- if any signatures are invalid or unrecognised.SignaturesMissingException
- if any signatures should have been present but were not.requiredSigningKeys
void verifySignaturesExcept(@NotNull java.util.Collection<? extends java.security.PublicKey> allowedToBeMissing)
Verifies the signatures on this transaction and throws if any are missing which aren't passed as parameters.
In this context, "verifying" means checking they are valid signatures and that their public keys are in
the requiredSigningKeys
set.
Normally you would not provide any keys to this function, but if you're in the process of building a partial transaction and you want to access the contents before you've signed it, you can specify your own keys here to bypass that check.
SignatureException
- if any signatures are invalid or unrecognised.SignaturesMissingException
- if any signatures should have been present but were not.requiredSigningKeys
void checkSignaturesAreValid()
Mathematically validates the signatures that are present on this transaction. This does not imply that
the signatures are by the right keys, or that there are sufficient signatures, just that they aren't
corrupt. If you use this function directly you'll need to do the other checks yourself. Probably you
want verifyRequiredSignatures
instead.
InvalidKeyException
- if the key on a signature is invalid.SignatureException
- if a signature fails to verify.verifyRequiredSignatures
@NotNull java.util.List<java.lang.String> getKeyDescriptions(@NotNull java.util.Set<? extends java.security.PublicKey> keys)
Get a human readable description of where signatures are required from, and are missing, to assist in debugging the underlying cause.
Note that the results should not be serialised, parsed or expected to remain stable between Corda versions.