corda / net.corda.core.crypto / Crypto / decodePrivateKey

# decodePrivateKey

`fun decodePrivateKey(encodedKey: ByteArray): PrivateKey`

Decode a PKCS8 encoded key to its PrivateKey object.

### Parameters

`encodedKey` - a PKCS8 encoded private key.

### Exceptions

`IllegalArgumentException` - on not supported scheme or if the given key specification is inappropriate for this key factory to produce a private key.

`fun decodePrivateKey(encodedKey: ByteArray, schemeCodeName: String): PrivateKey`

Decode a PKCS8 encoded key to its PrivateKey object based on the input scheme code name. This will be used by Kryo deserialisation.

### Parameters

`encodedKey` - a PKCS8 encoded private key.

`schemeCodeName` - a String that should match a key in supportedSignatureSchemes map (e.g. ECDSA_SECP256K1_SHA256).

### Exceptions

`IllegalArgumentException` - on not supported scheme or if the given key specification is inappropriate for this key factory to produce a private key.