TransactionWithSignatures
Keywords: net.corda.core.transactions.TransactionWithSignatures interface
Date: 2023-09-18

net.corda.core.transactions

## Interface TransactionWithSignatures

- All Superinterfaces:
    NamedByHash
  All Known Implementing Classes:
    ContractUpgradeLedgerTransaction, NotaryChangeLedgerTransaction, SignedTransaction

      @DoNotImplement
      public TransactionWithSignatures
      extends NamedByHash

  An interface for transactions containing signatures, with logic for signature verification.

- - ### Constructor Detail

    - #### TransactionWithSignatures

          public TransactionWithSignatures()

  - ### Method Detail

    - #### getSigs

          @NotNull
          java.util.List<net.corda.core.crypto.TransactionSignature> getSigs()

      List of signatures on this transaction.

      See Also:
        `checkSignaturesAreValid`, `verifyRequiredSignatures`

    - #### getRequiredSigningKeys

          @NotNull
          java.util.Set<java.security.PublicKey> getRequiredSigningKeys()

      Specifies all the public keys that require signatures for the transaction to be valid.

    - #### verifyRequiredSignatures

          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.

      Throws:
        `SignatureException` - if any signatures are invalid or unrecognised.
        `SignaturesMissingException` - if any signatures should have been present but were not.
      See Also:
        `requiredSigningKeys`

    - #### verifySignaturesExcept

          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.

      Throws:
        `SignatureException` - if any signatures are invalid or unrecognised.
        `SignaturesMissingException` - if any signatures should have been present but were not.
      See Also:
        `requiredSigningKeys`

    - #### verifySignaturesExcept

          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.

      Throws:
        `SignatureException` - if any signatures are invalid or unrecognised.
        `SignaturesMissingException` - if any signatures should have been present but were not.
      See Also:
        `requiredSigningKeys`

    - #### checkSignaturesAreValid

          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.

      Throws:
        `InvalidKeyException` - if the key on a signature is invalid.
        `SignatureException` - if a signature fails to verify.
      See Also:
        `verifyRequiredSignatures`

    - #### getKeyDescriptions

          @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.

    - #### getMissingSigners

          @NotNull
          java.util.Set<java.security.PublicKey> getMissingSigners()

      Return the PublicKeys for which we still need signatures.

      See Also:
        PublicKey