[][src]Struct ecdsa::SecretKey

pub struct SecretKey<C> where
    C: SecretValue + Curve
{ /* fields omitted */ }
This is supported on crate feature zeroize only.

Elliptic curve secret keys.

This type wraps a secret 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> SecretKey<C> where
    C: Curve + SecretValue,
    <C as SecretValue>::Secret: Clone,
    <C as SecretValue>::Secret: Zeroize,
    GenericArray<u8, <C as Curve>::FieldSize>: From<<C as SecretValue>::Secret>, 
[src]

pub fn random(rng: impl RngCore + CryptoRng) -> SecretKey<C> where
    C: ProjectiveArithmetic + SecretValue<Secret = NonZeroScalar<C>>,
    GenericArray<u8, <C as Curve>::FieldSize>: From<<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    GenericArray<u8, <C as Curve>::FieldSize>: for<'a> From<&'a <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: PrimeField,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: Zeroize,
    <<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar as PrimeField>::Repr == GenericArray<u8, <C as Curve>::FieldSize>, 
[src]

This is supported on crate feature zeroize only.

Generate a random SecretKey

pub fn new(secret_value: <C as SecretValue>::Secret) -> SecretKey<C>[src]

This is supported on crate feature zeroize only.

Create a new secret key from a serialized scalar value

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

This is supported on crate feature zeroize only.

Deserialize this secret key from a bytestring

pub fn to_bytes(&self) -> GenericArray<u8, <C as Curve>::FieldSize>[src]

This is supported on crate feature zeroize only.

Expose the byte serialization of the value this SecretKey wraps

pub fn secret_scalar(
    &self
) -> &<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar where
    C: ProjectiveArithmetic + SecretValue<Secret = NonZeroScalar<C>>,
    GenericArray<u8, <C as Curve>::FieldSize>: From<<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    GenericArray<u8, <C as Curve>::FieldSize>: for<'a> From<&'a <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: PrimeField,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: Zeroize,
    <<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar as PrimeField>::Repr == GenericArray<u8, <C as Curve>::FieldSize>, 
[src]

This is supported on crate feature zeroize only.

Borrow the inner secret scalar value.

Warning

This value is key material.

Please treat it with the care it deserves!

Trait Implementations

impl<C> Clone for SecretKey<C> where
    C: SecretValue + Curve + Clone,
    <C as SecretValue>::Secret: Clone
[src]

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

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

impl<C, '_> From<&'_ SecretKey<C>> for SigningKey<C> where
    C: Curve + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + ConstantTimeEq + FromDigest<C> + Invert<Output = Scalar<C>> + SignPrimitive<C> + Zeroize,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

impl<'_, C> TryFrom<&'_ [u8]> for SecretKey<C> where
    C: Curve + SecretValue,
    <C as SecretValue>::Secret: Clone,
    <C as SecretValue>::Secret: Zeroize,
    GenericArray<u8, <C as Curve>::FieldSize>: From<<C as SecretValue>::Secret>, 
[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 SecretValue>::Secret: RefUnwindSafe

impl<C> Send for SecretKey<C> where
    <C as SecretValue>::Secret: Send

impl<C> Sync for SecretKey<C> where
    <C as SecretValue>::Secret: Sync

impl<C> Unpin for SecretKey<C> where
    <C as SecretValue>::Secret: Unpin

impl<C> UnwindSafe for SecretKey<C> where
    <C as SecretValue>::Secret: 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> Conv for T

impl<T> FmtForward for T

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

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

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

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.