Skip to main content

import_public_key_spki

Function import_public_key_spki 

Source
pub async fn import_public_key_spki(
    variant: EcdhVariant,
    spki: Vec<u8>,
) -> Result<PublicKey, Error>
Expand description

Import a public key as an X.509 SubjectPublicKeyInfo (DER). The curve must be named by OID and must match the declared variant’s, or the import fails with error.invalid-key: an encoding that carries explicit ECParameters instead of the named-curve OID is rejected even when the parameters describe the variant’s curve. A point not on the curve is always rejected. An uncompressed point is always accepted; whether a compressed encoding is accepted is implementation-defined, as it is across WebCrypto engines — do not rely on either behavior.