Crypto.generateKeyPair - corda

corda / net.corda.core.crypto / Crypto / generateKeyPair

# generateKeyPair

`@JvmStatic fun generateKeyPair(schemeCodeName: String): KeyPair`

Utility to simplify the act of generating keys. Normally, we don't expect other errors here, assuming that key generation parameters for every supported signature scheme have been unit-tested.

### Parameters

`schemeCodeName` - a signature scheme's code name (e.g. ECDSA_SECP256K1_SHA256).

### Exceptions

`IllegalArgumentException` - if the requested signature scheme is not supported.

Return
a KeyPair for the requested signature scheme code name.

`@JvmOverloads @JvmStatic fun generateKeyPair(signatureScheme: SignatureScheme = DEFAULT_SIGNATURE_SCHEME): KeyPair`

Generate a KeyPair for the selected SignatureScheme. Note that RSA is the sole algorithm initialized specifically by its supported keySize.

### Parameters

`signatureScheme` - a supported SignatureScheme, see Crypto, default to DEFAULT_SIGNATURE_SCHEME if not provided.

### Exceptions

`IllegalArgumentException` - if the requested signature scheme is not supported.

Return
a new KeyPair for the requested SignatureScheme.