DigitalSignature.WithKey
Keywords: net.corda.core.crypto.DigitalSignature.WithKey class
Date: 2023-09-18

net.corda.core.crypto

## Class DigitalSignature.WithKey

- net.corda.core.utilities.ByteSequence
- - net.corda.core.utilities.OpaqueBytes
  - - net.corda.core.crypto.DigitalSignature
    - - net.corda.core.crypto.DigitalSignature.WithKey

- Enclosing class:
    DigitalSignature

      public static class DigitalSignature.WithKey
      extends DigitalSignature

  A digital signature that identifies who the public key is owned by.

- - ### Constructor Detail

    - #### WithKey

          public WithKey(@NotNull
                         java.security.PublicKey by,
                         @NotNull
                         kotlin.Array[] bytes)

      A digital signature that identifies who the public key is owned by.

  - ### Method Detail

    - #### verify

          public boolean verify(@NotNull
                                kotlin.Array[] content)

      Utility to simplify the act of verifying a signature.

      Throws:
        `InvalidKeyException` - if the key to verify the signature with is not valid (i.e. wrong key type for the signature).
        `SignatureException` - if the signature is invalid (i.e. damaged), or does not match the key (incorrect).

    - #### verify

          public boolean verify(@NotNull
                                OpaqueBytes content)

      Utility to simplify the act of verifying a signature.

      Throws:
        `InvalidKeyException` - if the key to verify the signature with is not valid (i.e. wrong key type for the signature).
        `SignatureException` - if the signature is invalid (i.e. damaged), or does not match the key (incorrect).

    - #### isValid

          public boolean isValid(@NotNull
                                 kotlin.Array[] content)

      Utility to simplify the act of verifying a signature. In comparison to `verify` doesn't throw an exception, making it more suitable where a boolean is required, but normally you should use the function which throws, as it avoids the risk of failing to test the result.

      Returns:
        whether the signature is correct for this key.
      Throws:
        `InvalidKeyException` - if the key to verify the signature with is not valid (i.e. wrong key type for the signature).
        `SignatureException` - if the signature is invalid (i.e. damaged).
      See Also:
        `verify`

    - #### withoutKey

          @NotNull
          public DigitalSignature withoutKey()

    - #### getBy

          @NotNull
          public java.security.PublicKey getBy()