Struct cosmian_crypto_core::R25519PrivateKey

source ·
pub struct R25519PrivateKey(/* private fields */);

Implementations§

source§

impl R25519PrivateKey

Facades

Facades are used to hide the underlying types and provide a more user friendly interface to the user.

source

pub fn new<R: CryptoRngCore>(rng: &mut R) -> Self

Generate a random private key

This is a facade to RandomFixedSizeCBytes::new

source

pub fn as_bytes(&self) -> &[u8]

Get the underlying bytes slice of the private key

This is a facade to RandomFixedSizeCBytes::as_bytes

source

pub fn to_bytes(&self) -> [u8; 32]

Serialize the PrivateKey as a non zero scalar

This is a facade to <Self as FixedSizeCBytes>::to_bytes

source

pub fn try_from_bytes(bytes: [u8; 32]) -> Result<Self, CryptoCoreError>

Deserialize the PrivateKey from a non zero scalar

This is a facade to <Self as FixedSizeCBytes<R25519_PRIVATE_KEY_LENGTH>>::try_from_bytes

source

pub const fn zero() -> Self

Neutral scalar element for the addition.

source

pub const fn one() -> Self

Neutral scalar element for the multiplication.

Trait Implementations§

source§

impl<'a> Add<&'a R25519PrivateKey> for &R25519PrivateKey

§

type Output = R25519PrivateKey

The resulting type after applying the + operator.
source§

fn add(self, rhs: &R25519PrivateKey) -> Self::Output

Performs the + operation. Read more
source§

impl Clone for R25519PrivateKey

source§

fn clone(&self) -> R25519PrivateKey

Returns a copy 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 R25519PrivateKey

source§

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

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

impl<'a> Div<&'a R25519PrivateKey> for &R25519PrivateKey

§

type Output = R25519PrivateKey

The resulting type after applying the / operator.
source§

fn div(self, rhs: &R25519PrivateKey) -> Self::Output

Performs the / operation. Read more
source§

impl Drop for R25519PrivateKey

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl EciesEcPrivateKey<R25519_PRIVATE_KEY_LENGTH> for R25519PrivateKey

source§

fn new<R: CryptoRngCore>(rng: &mut R) -> Self

source§

impl FixedSizeCBytes<{ R25519_PRIVATE_KEY_LENGTH }> for R25519PrivateKey

source§

fn to_bytes(&self) -> [u8; 32]

Converts the given key into an array of LENGTH bytes.
source§

fn try_from_bytes(bytes: [u8; 32]) -> Result<Self, CryptoCoreError>

Tries to create a key from the given array of bytes into a key.
source§

const LENGTH: usize = LENGTH

Key length.
source§

fn try_from_slice(slice: &[u8]) -> Result<Self, CryptoCoreError>

Tries to create a key from the given slice of bytes into a key.
source§

impl From<&R25519PrivateKey> for R25519CurvePoint

source§

fn from(private_key: &R25519PrivateKey) -> Self

Converts to this type from the input type.
source§

impl From<R25519PrivateKey> for R25519CurvePoint

source§

fn from(private_key: R25519PrivateKey) -> Self

Converts to this type from the input type.
source§

impl Hash for R25519PrivateKey

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> Mul<&'a R25519PrivateKey> for &R25519CurvePoint

§

type Output = R25519CurvePoint

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &R25519PrivateKey) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a R25519PrivateKey> for &R25519PrivateKey

§

type Output = R25519PrivateKey

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &R25519PrivateKey) -> Self::Output

Performs the * operation. Read more
source§

impl PartialEq for R25519PrivateKey

source§

fn eq(&self, other: &R25519PrivateKey) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl RandomFixedSizeCBytes<{ R25519_PRIVATE_KEY_LENGTH }> for R25519PrivateKey

source§

fn new<R: CryptoRngCore>(rng: &mut R) -> Self

Generates a new random array of LENGTH bytes
source§

fn as_bytes(&self) -> &[u8]

Returns a slice over the array bytes.
source§

impl Serializable for R25519PrivateKey

Key Serialization framework

§

type Error = CryptoCoreError

Error type returned by the serialization.
source§

fn length(&self) -> usize

Retrieves the length of the serialized object if it can be known. Read more
source§

fn write(&self, ser: &mut Serializer) -> Result<usize, Self::Error>

Writes to the given Serializer.
source§

fn read(de: &mut Deserializer<'_>) -> Result<Self, Self::Error>

Reads from the given Deserializer.
source§

fn serialize(&self) -> Result<Zeroizing<Vec<u8>>, Self::Error>

Serializes the object. Allocates the correct capacity if it is known.
source§

fn deserialize(bytes: &[u8]) -> Result<Self, Self::Error>

Deserializes the object.
source§

impl<'a> Sub<&'a R25519PrivateKey> for &R25519PrivateKey

§

type Output = R25519PrivateKey

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &R25519PrivateKey) -> Self::Output

Performs the - operation. Read more
source§

impl Zeroize for R25519PrivateKey

source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
source§

impl CBytes for R25519PrivateKey

source§

impl Eq for R25519PrivateKey

source§

impl SecretCBytes<{ R25519_PRIVATE_KEY_LENGTH }> for R25519PrivateKey

source§

impl StructuralPartialEq for R25519PrivateKey

Auto Trait Implementations§

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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