Crypto.deriveKeyPair - corda

corda / net.corda.core.crypto / Crypto / deriveKeyPair

# deriveKeyPair

`@JvmStatic fun deriveKeyPair(signatureScheme: SignatureScheme, privateKey: PrivateKey, seed: ByteArray): KeyPair`

Deterministically generate/derive a KeyPair using an existing private key and a seed as inputs. This operation is currently supported for ECDSA secp256r1 (NIST P-256), ECDSA secp256k1 and EdDSA ed25519.

Similarly to BIP32, the implemented algorithm uses an HMAC function based on SHA512 and it is actually an implementation the HKDF rfc - Step 1: Extract function,

### Parameters

`signatureScheme` - the SignatureScheme of the private key input.

`privateKey` - the PrivateKey that will be used as key to the HMAC-ed DKG function.

`seed` - an extra seed that will be used as value to the underlying HMAC.

### Exceptions

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

`UnsupportedOperationException` - if deterministic key generation is not supported for this particular scheme.

Return
a new deterministically generated KeyPair.

`@JvmStatic fun deriveKeyPair(privateKey: PrivateKey, seed: ByteArray): KeyPair`

Deterministically generate/derive a KeyPair using an existing private key and a seed as inputs. Use this method if the SignatureScheme of the private key input is not known.

### Parameters

`privateKey` - the PrivateKey that will be used as key to the HMAC-ed DKG function.

`seed` - an extra seed that will be used as value to the underlying HMAC.

### Exceptions

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

`UnsupportedOperationException` - if deterministic key generation is not supported for this particular scheme.

Return
a new deterministically generated KeyPair.