Struct cosmian_crypto_core::Curve25519Secret
source · pub struct Curve25519Secret(/* private fields */);
Expand description
Secret from which the private keys are derived
Implementations§
source§impl Curve25519Secret
impl Curve25519Secret
Facades
Facades are used to hide the underlying types and provide a more user friendly interface to the user.
sourcepub fn new<R: CryptoRngCore>(rng: &mut R) -> Self
pub fn new<R: CryptoRngCore>(rng: &mut R) -> Self
Generate a random private key
This is a facade to RandomFixedSizeCBytes::new
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Get the underlying bytes slice of the private key
This is a facade to RandomFixedSizeCBytes::as_bytes
sourcepub fn to_bytes(&self) -> [u8; 32]
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
sourcepub fn try_from_bytes(bytes: [u8; 32]) -> Result<Self, CryptoCoreError>
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<CURVE_25519_SECRET_LENGTH>>::try_from_bytes
source§impl Curve25519Secret
impl Curve25519Secret
sourcepub fn from_ed25519_private_key(sk: &Ed25519PrivateKey) -> Self
pub fn from_ed25519_private_key(sk: &Ed25519PrivateKey) -> Self
Convert the ED25519 private key to an X25519 private key
This method is useful when an Ed25519 public key has been converted to an X25519 public key. It will generate the private key that corresponds to the generated X25519 public key from the original private key.
See [X25519PublicKey::from_ed25519_public_key
] for more details.
Trait Implementations§
source§impl Clone for Curve25519Secret
impl Clone for Curve25519Secret
source§fn clone(&self) -> Curve25519Secret
fn clone(&self) -> Curve25519Secret
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Curve25519Secret
impl Debug for Curve25519Secret
source§impl Drop for Curve25519Secret
impl Drop for Curve25519Secret
source§impl FixedSizeCBytes<{ CURVE_25519_SECRET_LENGTH }> for Curve25519Secret
impl FixedSizeCBytes<{ CURVE_25519_SECRET_LENGTH }> for Curve25519Secret
source§fn try_from_bytes(bytes: [u8; 32]) -> Result<Self, CryptoCoreError>
fn try_from_bytes(bytes: [u8; 32]) -> Result<Self, CryptoCoreError>
source§fn try_from_slice(slice: &[u8]) -> Result<Self, CryptoCoreError>
fn try_from_slice(slice: &[u8]) -> Result<Self, CryptoCoreError>
source§impl From<&Curve25519Secret> for X25519PrivateKey
impl From<&Curve25519Secret> for X25519PrivateKey
source§fn from(sk: &Ed25519PrivateKey) -> Self
fn from(sk: &Ed25519PrivateKey) -> Self
source§impl From<&Curve25519Secret> for Ed25519PublicKey
impl From<&Curve25519Secret> for Ed25519PublicKey
source§fn from(sk: &Ed25519PrivateKey) -> Self
fn from(sk: &Ed25519PrivateKey) -> Self
source§impl From<&Curve25519Secret> for X25519CurvePoint
impl From<&Curve25519Secret> for X25519CurvePoint
source§fn from(sk: &X25519PrivateKey) -> Self
fn from(sk: &X25519PrivateKey) -> Self
source§impl Hash for Curve25519Secret
impl Hash for Curve25519Secret
source§impl PartialEq for Curve25519Secret
impl PartialEq for Curve25519Secret
source§fn eq(&self, other: &Curve25519Secret) -> bool
fn eq(&self, other: &Curve25519Secret) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl RandomFixedSizeCBytes<{ CURVE_25519_SECRET_LENGTH }> for Curve25519Secret
impl RandomFixedSizeCBytes<{ CURVE_25519_SECRET_LENGTH }> for Curve25519Secret
source§impl Serializable for Curve25519Secret
impl Serializable for Curve25519Secret
Key Serialization framework
§type Error = CryptoCoreError
type Error = CryptoCoreError
source§fn length(&self) -> usize
fn length(&self) -> usize
source§fn write(&self, ser: &mut Serializer) -> Result<usize, Self::Error>
fn write(&self, ser: &mut Serializer) -> Result<usize, Self::Error>
Serializer
.source§fn read(de: &mut Deserializer<'_>) -> Result<Self, Self::Error>
fn read(de: &mut Deserializer<'_>) -> Result<Self, Self::Error>
Deserializer
.