Crypto.toSupportedPublicKey - corda

corda / net.corda.core.crypto / Crypto / toSupportedPublicKey

# toSupportedPublicKey

`@JvmStatic fun toSupportedPublicKey(key: SubjectPublicKeyInfo): PublicKey`

Convert a public key to a supported implementation.

### Parameters

`key` - a public key.

### Exceptions

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

Return
a supported implementation of the input public key.

`@JvmStatic fun toSupportedPublicKey(key: PublicKey): PublicKey`

Convert a public key to a supported implementation. This can be used to convert a SUN's EC key to an BC key. This method is usually required to retrieve a key (via its corresponding cert) from JKS keystores that by default return SUN implementations.

### Parameters

`key` - a public key.

### Exceptions

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

Return
a supported implementation of the input public key.