Is there a reason why there is no to_sec1_bytes-method?
To parse a SEC 1 representation, we have PublicKey::from_sec1_bytes – however to serialize into a SEC 1 representation we need to detour via EncodedPoint::from(&public_key) and then use encoded_point.as_bytes(). Once you know this, it is pretty trivial – however it took me a few minutes to get there and its not that obvious IMO.
Is there a reason why there is no
to_sec1_bytes-method?To parse a SEC 1 representation, we have
PublicKey::from_sec1_bytes– however to serialize into a SEC 1 representation we need to detour viaEncodedPoint::from(&public_key)and then useencoded_point.as_bytes(). Once you know this, it is pretty trivial – however it took me a few minutes to get there and its not that obvious IMO.