parseKeyPair

suspend fun EncryptionAlgorithm.OAEPBased.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, privateKeyFormat: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): EncryptionKey.EncryptionKeyPair(source)

Decodes an RSA-OAEP key pair from separate public and private key ByteArrays.

The returned EncryptionKey is an EncryptionKey.EncryptionKeyPair containing both keys, usable for encryption and decryption.

Return

an EncryptionKey wrapping the decoded RSA.OAEP key pair.

Parameters

publicKey

the public key material to decode.

privateKey

the private key material to decode.

keyId

optional key ID to associate with the decoded key pair. Defaults to null.

publicKeyFormat

the format in which publicKey is encoded. Defaults to RSA.PublicKey.Format.PEM.

privateKeyFormat

the format in which privateKey is encoded. Defaults to RSA.PrivateKey.Format.PEM.

cryptographyProvider

the provider used to perform key decoding.


suspend fun SigningAlgorithm.PKCS1Based.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, privateKeyFormat: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair(source)

Decodes an RSA PKCS#1 v1.5 key pair from separate public and private key ByteArrays.

The returned SigningKey is a SigningKey.SigningKeyPair containing both keys, usable for signing and verification.

Return

a SigningKey wrapping the decoded RSA.PKCS1 key pair.

Parameters

publicKey

the public key material to decode.

privateKey

the private key material to decode.

keyId

optional key ID to associate with the decoded key pair. Defaults to null.

publicKeyFormat

the format in which publicKey is encoded. Defaults to RSA.PublicKey.Format.PEM.

privateKeyFormat

the format in which privateKey is encoded. Defaults to RSA.PrivateKey.Format.PEM.

cryptographyProvider

the provider used to perform key decoding.


suspend fun SigningAlgorithm.PSSBased.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, privateKeyFormat: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair(source)

Decodes an RSA PSS key pair from separate public and private key ByteArrays.

The returned SigningKey is a SigningKey.SigningKeyPair containing both keys, usable for signing and verification.

Return

a SigningKey wrapping the decoded RSA.PSS key pair.

Parameters

publicKey

the public key material to decode.

privateKey

the private key material to decode.

keyId

optional key ID to associate with the decoded key pair. Defaults to null.

publicKeyFormat

the format in which publicKey is encoded. Defaults to RSA.PublicKey.Format.PEM.

privateKeyFormat

the format in which privateKey is encoded. Defaults to RSA.PrivateKey.Format.PEM.

cryptographyProvider

the provider used to perform key decoding.


suspend fun SigningAlgorithm.ECDSABased.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: EC.PublicKey.Format = EC.PublicKey.Format.RAW, privateKeyFormat: EC.PrivateKey.Format = EC.PrivateKey.Format.RAW, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair(source)

Decodes an ECDSA key pair from separate public and private key ByteArrays.

The returned SigningKey is a SigningKey.SigningKeyPair containing both keys, usable for signing and verification.

Return

a SigningKey wrapping the decoded ECDSA key pair.

Parameters

publicKey

the public key material to decode.

privateKey

the private key material to decode.

keyId

optional key ID to associate with the decoded key pair. Defaults to null.

publicKeyFormat

the format in which publicKey is encoded. Defaults to EC.PublicKey.Format.RAW.

privateKeyFormat

the format in which privateKey is encoded. Defaults to EC.PrivateKey.Format.RAW.

cryptographyProvider

the provider used to perform key decoding.