net.corda.core.crypto

## Class CryptoUtilities

- net.corda.core.crypto.CryptoUtilities

-     public class CryptoUtilities

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.util.Set<java.security.PublicKey>` | `byKeys(java.lang.Iterable<? extends net.corda.core.crypto.DigitalSignature.WithKey> $receiver)` Returns the set of all PublicKeys of the signatures
    `static java.security.PrivateKey` | `component1(java.security.KeyPair $receiver)`
    `static java.security.PublicKey` | `component2(java.security.KeyPair $receiver)`
    `static java.security.KeyPair` | `entropyToKeyPair(java.math.BigInteger entropy)` Returns a key pair derived from the given private key entropy. This is useful for unit tests and other cases where you want hard-coded private keys.
    `static java.security.KeyPair` | `generateKeyPair()` A simple wrapper that will make it easier to swap out the EC algorithm we use in future
    `static CompositeKey` | `getComposite(java.security.PublicKey $receiver)` Creates a `class CompositeKey` with a single leaf node containing the public key
    `static net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec` | `getEd25519Curve()`
    `static CompositeKey` | `getNullCompositeKey()`
    `static java.security.SecureRandom` | `newSecureRandom()`
    `static net.i2p.crypto.eddsa.EdDSAPublicKey` | `parsePublicKeyBase58(java.lang.String base58String)`
    `static DigitalSignature` | `signWithECDSA(java.security.PrivateKey $receiver, byte[] bytes)` Utility to simplify the act of signing a byte array
    `static DigitalSignature.WithKey` | `signWithECDSA(java.security.PrivateKey $receiver, byte[] bytesToSign, java.security.PublicKey publicKey)`
    `static DigitalSignature.WithKey` | `signWithECDSA(java.security.KeyPair $receiver, byte[] bytesToSign)`
    `static DigitalSignature.WithKey` | `signWithECDSA(java.security.KeyPair $receiver, OpaqueBytes bytesToSign)`
    `static DigitalSignature.LegallyIdentifiable` | `signWithECDSA(java.security.KeyPair $receiver, OpaqueBytes bytesToSign, Party party)`
    `static DigitalSignature.LegallyIdentifiable` | `signWithECDSA(java.security.KeyPair $receiver, byte[] bytesToSign, Party party)`
    `static java.lang.String` | `toBase58String(java.security.PublicKey $receiver)`
    `static java.lang.String` | `toStringShort(java.security.PublicKey $receiver)` Render a public key to a string, using a short form if it's an elliptic curve public key
    `static void` | `verifyWithECDSA(java.security.PublicKey $receiver, byte[] content, DigitalSignature signature)` Utility to simplify the act of verifying a signature

- - ### Method Detail

    - #### newSecureRandom

          public static java.security.SecureRandom newSecureRandom()

    - #### getNullCompositeKey

          public static CompositeKey getNullCompositeKey()

    - #### signWithECDSA

          public static DigitalSignature signWithECDSA(java.security.PrivateKey $receiver,
                                                       byte[] bytes)

      Utility to simplify the act of signing a byte array

    - #### signWithECDSA

          public static DigitalSignature.WithKey signWithECDSA(java.security.PrivateKey $receiver,
                                                               byte[] bytesToSign,
                                                               java.security.PublicKey publicKey)

    - #### getEd25519Curve

          public static net.i2p.crypto.eddsa.spec.EdDSANamedCurveSpec getEd25519Curve()

    - #### parsePublicKeyBase58

          public static net.i2p.crypto.eddsa.EdDSAPublicKey parsePublicKeyBase58(java.lang.String base58String)

    - #### toBase58String

          public static java.lang.String toBase58String(java.security.PublicKey $receiver)

    - #### signWithECDSA

          public static DigitalSignature.WithKey signWithECDSA(java.security.KeyPair $receiver,
                                                               byte[] bytesToSign)

    - #### signWithECDSA

          public static DigitalSignature.WithKey signWithECDSA(java.security.KeyPair $receiver,
                                                               OpaqueBytes bytesToSign)

    - #### signWithECDSA

          public static DigitalSignature.LegallyIdentifiable signWithECDSA(java.security.KeyPair $receiver,
                                                                           OpaqueBytes bytesToSign,
                                                                           Party party)

    - #### signWithECDSA

          public static DigitalSignature.LegallyIdentifiable signWithECDSA(java.security.KeyPair $receiver,
                                                                           byte[] bytesToSign,
                                                                           Party party)

    - #### verifyWithECDSA

          public static void verifyWithECDSA(java.security.PublicKey $receiver,
                                             byte[] content,
                                             DigitalSignature signature)

      Utility to simplify the act of verifying a signature

    - #### toStringShort

          public static java.lang.String toStringShort(java.security.PublicKey $receiver)

      Render a public key to a string, using a short form if it's an elliptic curve public key

    - #### getComposite

          public static CompositeKey getComposite(java.security.PublicKey $receiver)

      Creates a `class CompositeKey` with a single leaf node containing the public key

      See Also:
        `class CompositeKey`

    - #### byKeys

          public static java.util.Set<java.security.PublicKey> byKeys(java.lang.Iterable<? extends net.corda.core.crypto.DigitalSignature.WithKey> $receiver)

      Returns the set of all PublicKeys of the signatures

      See Also:
        PublicKey

    - #### component1

          public static java.security.PrivateKey component1(java.security.KeyPair $receiver)

    - #### component2

          public static java.security.PublicKey component2(java.security.KeyPair $receiver)

    - #### generateKeyPair

          public static java.security.KeyPair generateKeyPair()

      A simple wrapper that will make it easier to swap out the EC algorithm we use in future

    - #### entropyToKeyPair

          public static java.security.KeyPair entropyToKeyPair(java.math.BigInteger entropy)

      Returns a key pair derived from the given private key entropy. This is useful for unit tests and other cases where you want hard-coded private keys.