Trait EcPk

Source
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 Constants§

Required Associated Types§

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EcPk for PublicKey

Available on crate feature ed25519 only.
Source§

const COMPRESSED_LEN: usize = 32usize

Source§

const CURVE_NAME: &'static str = "Edwards25519"

Source§

type Compressed = [u8; 32]

Source§

fn base_point() -> Self

Source§

fn to_pk_compressed(&self) -> Self::Compressed

Source§

fn from_pk_compressed(pk: Self::Compressed) -> Result<Self, EcPkInvalid>

Source§

fn from_pk_compressed_slice(slice: &[u8]) -> Result<Self, EcPkInvalid>

Source§

impl EcPk for PublicKey

Available on crate feature x25519 only.

Implementors§

Source§

impl EcPk for cypher::ed25519::PublicKey

Available on crate feature ed25519 only.
Source§

const COMPRESSED_LEN: usize = 32usize

Source§

const CURVE_NAME: &'static str = "Edwards25519"

Source§

type Compressed = [u8; 32]

Source§

impl EcPk for cypher::x25519::PublicKey

Available on crate feature x25519 only.
Source§

const COMPRESSED_LEN: usize = 32usize

Source§

const CURVE_NAME: &'static str = "Curve25519"

Source§

type Compressed = [u8; 32]