Curve

Struct Curve 

Source
pub struct Curve {}
Expand description

Curve represents the Ed25519 group. There are no parameters and no initialization is required because it supports only this one specific curve.

Implementations§

Source§

impl Curve

Source

pub const fn new() -> Self

Source

pub fn new_key_and_seed_with_input( self, buffer: &[u8], ) -> (Scalar, &[u8], Vec<u8>)

[new_key_and_seed_with_input()] returns a formatted Ed25519 key (avoid subgroup attack by requiring it to be a multiple of 8). It also returns the input and the digest used to generate the key.

Source

pub fn new_key_and_seed<S: Stream>( self, stream: &mut S, ) -> Result<(Scalar, Vec<u8>, Vec<u8>), CurveError>

[new_key_and_seed()] returns a formatted Ed25519 key (avoid subgroup attack by requiring it to be a multiple of 8). It also returns the seed and the input used to generate the key.

Trait Implementations§

Source§

impl Clone for Curve

Source§

fn clone(&self) -> Curve

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Curve

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Curve

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Curve

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Dh for Curve

Source§

type H = CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, OidSha256>>

Source§

fn dh_exchange<SUITE: Suite>( suite: SUITE, own_private: <SUITE::POINT as Point>::SCALAR, remote_public: SUITE::POINT, ) -> SUITE::POINT

[dh_exchange()] computes the shared key from a private key and a public key
Source§

fn hkdf( ikm: &[u8], info: &[u8], output_size: Option<usize>, ) -> Result<Vec<u8>, DhError>

Source§

fn aes_encrypt( key: &[u8], nonce: &[u8; 12], data: &[u8], additional_data: Option<&[u8]>, ) -> Result<Vec<u8>, DhError>

Source§

fn aes_decrypt( key: &[u8], nonce: &[u8; 12], ciphertext: &[u8], additional_data: Option<&[u8]>, ) -> Result<Vec<u8>, DhError>

Source§

fn encrypt<POINT: Point>( pre_key: &POINT, info: &[u8], nonce: &[u8; 12], data: &[u8], ) -> Result<Vec<u8>, DhError>

Source§

fn decrypt<POINT: Point>( pre_key: &POINT, info: &[u8], nonce: &[u8; 12], cipher: &[u8], ) -> Result<Vec<u8>, DhError>

Source§

impl Display for Curve

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Generator<Scalar> for Curve

Source§

fn new_key<S: Stream>(&self, stream: &mut S) -> Result<Option<Scalar>, KeyError>

[new_key()] returns a formatted Ed25519 key (avoiding subgroup attack by requiring it to be a multiple of 8). [new_key()] implements the Generator trait.

Source§

impl Group for Curve

Source§

fn scalar(&self) -> Scalar

[scalar()] creates a new scalar for the prime-order subgroup of the Ed25519 curve. The scalars in this package implement scalar’s [set_bytes()] method, interpreting the bytes as a little-endian integer, in order to remain compatible with other Ed25519 implementations, and with the standard implementation of the EdDSA signature.

Source§

fn scalar_len(&self) -> usize

[scalar_len()] returns 32, the size in bytes of an encoded Scalar for the Ed25519 curve.

Source§

fn point_len(&self) -> usize

[point_len()] returns 32, the size in bytes of an encoded Point on the Ed25519 curve.

Source§

type POINT = Point

Source§

fn point(&self) -> Point

[point()] create new point
Source§

fn is_prime_order(&self) -> Option<bool>

[is_prime_order()] returns Some(true) if the group has a prime order, if None is returned is assumes that the group has a prime order
Source§

impl Serialize for Curve

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Curve

Auto Trait Implementations§

§

impl Freeze for Curve

§

impl RefUnwindSafe for Curve

§

impl Send for Curve

§

impl Sync for Curve

§

impl Unpin for Curve

§

impl UnwindSafe for Curve

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,