corda / net.corda.core.crypto / X509Utilities / loadOrCreateKeyPairFromKeyStore

# loadOrCreateKeyPairFromKeyStore

`fun loadOrCreateKeyPairFromKeyStore(keyStoreFilePath: Path, storePassword: String, keyPassword: String, alias: String, keyGenerator: () -> CACertAndKey): KeyPair`

Extract public and private keys from a KeyStore file assuming storage alias is known, or create a new pair of keys using the provided function if the keys not exist.

### Parameters

`keyStoreFilePath` - Path to load KeyStore from

`storePassword` - Password to unlock the KeyStore

`keyPassword` - Password to unlock the private key entries

`alias` - The name to lookup the Key and Certificate chain from

`keyGenerator` - Function for generating new keys

Return
The KeyPair found in the KeyStore under the specified alias