pub trait EcPk: Clone + Eq + Send + Debug + MultiDisplay<Encoding> {
type Compressed: Copy + Sized + Send + AsRef<[u8]>;
const COMPRESSED_LEN: usize;
const CURVE_NAME: &'static str;
// Required methods
fn base_point() -> Self;
fn to_pk_compressed(&self) -> Self::Compressed;
fn from_pk_compressed(pk: Self::Compressed) -> Result<Self, EcPkInvalid>;
fn from_pk_compressed_slice(slice: &[u8]) -> Result<Self, EcPkInvalid>;
}
Expand description
Elliptic-curve based public key type which can be used in ECDH or signature schemes.
§Safety
The type provides no guarantees on the key validity upon deserialization.
Required Associated Types§
Required Associated Constants§
const COMPRESSED_LEN: usize
const CURVE_NAME: &'static str
Required Methods§
fn base_point() -> Self
fn to_pk_compressed(&self) -> Self::Compressed
fn from_pk_compressed(pk: Self::Compressed) -> Result<Self, EcPkInvalid>
fn from_pk_compressed_slice(slice: &[u8]) -> Result<Self, EcPkInvalid>
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl EcPk for PublicKey
Available on crate feature ed25519
only.
impl EcPk for PublicKey
Available on crate feature
ed25519
only.const COMPRESSED_LEN: usize = 32usize
const CURVE_NAME: &'static str = "Edwards25519"
type Compressed = [u8; 32]
fn base_point() -> Self
fn to_pk_compressed(&self) -> Self::Compressed
fn from_pk_compressed(pk: Self::Compressed) -> Result<Self, EcPkInvalid>
fn from_pk_compressed_slice(slice: &[u8]) -> Result<Self, EcPkInvalid>
source§impl EcPk for PublicKey
Available on crate feature x25519
only.
impl EcPk for PublicKey
Available on crate feature
x25519
only.