fromDer

suspend fun fromDer(derEncoded: ByteString, passphrase: String? = null): Pkcs12

Decodes a PKCS#12 container from DER format.

Return

a Pkcs12 instance containing the EcPrivateKey and X509CertChain.

Parameters

derEncoded

the DER-encoded PKCS#12 bytes.

passphrase

the passphrase used to decrypt and verify the file, or null if no passphrase is provided.

Throws

if the passphrase is incorrect or MAC verification fails.

if the data is not a valid PKCS#12 file or required components are missing.