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

decodePrivateKey

@JvmStatic fun decodePrivateKey(encodedKey: ByteArray): PrivateKey

Decode a PKCS8 encoded key to its PrivateKey object. Use this method if the key type is a-priori unknown.

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.

@JvmStatic fun decodePrivateKey(schemeCodeName: String, encodedKey: ByteArray): PrivateKey

Decode a PKCS8 encoded key to its PrivateKey object based on the input scheme code name. This should be used when the type key is known, e.g. during deserialisation or with key caches or key managers.

Parameters

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

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.

@JvmStatic fun decodePrivateKey(signatureScheme: SignatureScheme, encodedKey: ByteArray): PrivateKey

Decode a PKCS8 encoded key to its PrivateKey object based on the input scheme code name. This should be used when the type key is known, e.g. during deserialisation or with key caches or key managers.

Parameters

signatureScheme - a signature scheme (e.g. ECDSA_SECP256K1_SHA256).

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.