[−][src]Struct elliptic_curve::secret_key::SecretKey
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]
C: Curve + Arithmetic,
C::Scalar: Generate + Into<ElementBytes<C>>,
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.
fn try_from(slice: &[u8]) -> Result<Self, Error>
[src]
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]
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>,
Auto Trait Implementations
impl<C> RefUnwindSafe for SecretKey<C> where
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<C> Send for SecretKey<C> where
<C as Curve>::ElementSize: ArrayLength<u8>,
<C as Curve>::ElementSize: ArrayLength<u8>,
impl<C> Sync for SecretKey<C> where
<C as Curve>::ElementSize: ArrayLength<u8>,
<C as Curve>::ElementSize: ArrayLength<u8>,
impl<C> Unpin for SecretKey<C> where
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: Unpin,
<<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,
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,