Skip to main content

encode

Function encode 

Source
pub fn encode(key: &Sm2PublicKey) -> Vec<u8>
Expand description

Encode an SM2 public key as a DER SubjectPublicKeyInfo blob.

Caller pre-validates that the key’s point is on-curve and not at infinity. (The standard accessor crate::sm2::Sm2PublicKey::to_sec1_uncompressed feeds this helper after extracting the affine (x, y).)

§Panics

Panics if the underlying point is at infinity (callers must reject the identity point at the boundary).