importKeyPair

open suspend override fun importKeyPair(type: KeyType, privateKey: ByteArray, publicKey: ByteArray): KeyPair(source)

For ML-KEM and ML-DSA, privateKey is either the seed or the expanded FIPS encoding (see the class documentation), and must belong to publicKey.

Throws

for a wrong length, an encapsulation key that fails the modulus check (FIPS 203 §7.2), a decapsulation key that fails the hash check (FIPS 203 §7.3), or a private key that does not belong to publicKey.