[][src]Struct elliptic_curve::secret_key::SecretKey

pub struct SecretKey<C: Curve> { /* fields omitted */ }

Elliptic curve secret keys.

This type wraps a serialized scalar value, helping to prevent accidental exposure and securely erasing the value from memory when dropped (when the zeroize feature of this crate is enabled).

Implementations

impl<C: Curve> SecretKey<C>[src]

pub fn new(bytes: ElementBytes<C>) -> Self[src]

Create a new secret key from a serialized scalar value

pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Self, Error>[src]

Deserialize this secret key from a bytestring

pub fn as_bytes(&self) -> &ElementBytes<C>[src]

Expose the byte serialization of the value this SecretKey wraps

Trait Implementations

impl<C: Clone + Curve> Clone for SecretKey<C>[src]

impl<C: Curve> Debug for SecretKey<C>[src]

impl<C: Curve> Drop for SecretKey<C>[src]

impl<C> Generate for SecretKey<C> where
    C: Curve + Arithmetic,
    C::Scalar: Generate + Into<ElementBytes<C>>, 
[src]

fn generate(rng: impl CryptoRng + RngCore) -> Self[src]

This is supported on feature="rand" only.

Generate a new SecretKey

impl<C: Curve, '_> TryFrom<&'_ [u8]> for SecretKey<C>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<C, '_> TryFrom<&'_ SecretKey<C>> for PublicKey<C> where
    C: Curve + Arithmetic,
    C::AffinePoint: Mul<NonZeroScalar<C>, Output = C::AffinePoint>,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPoint<C>: From<C::AffinePoint>,
    UncompressedPoint<C>: From<C::AffinePoint>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<C> RefUnwindSafe for SecretKey<C> where
    <<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe

impl<C> Send for SecretKey<C> where
    <C as Curve>::ElementSize: ArrayLength<u8>, 

impl<C> Sync for SecretKey<C> where
    <C as Curve>::ElementSize: ArrayLength<u8>, 

impl<C> Unpin for SecretKey<C> where
    <<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: Unpin

impl<C> UnwindSafe for SecretKey<C> where
    <<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.