Trait cypher::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 Types§

Required Associated Constants§

Required Methods§

Object Safety§

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"

§

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.
source§

const COMPRESSED_LEN: usize = 32usize

source§

const CURVE_NAME: &'static str = "Curve25519"

§

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>

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"

§

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"

§

type Compressed = [u8; 32]