Struct ecdsa::SigningKey

source ·
pub struct SigningKey<C>where
    C: PrimeCurve + CurveArithmetic,
    Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
    SignatureSize<C>: ArrayLength<u8>,{ /* private fields */ }
Available on crate feature signing only.
Expand description

ECDSA secret key used for signing. Generic over prime order elliptic curves (e.g. NIST P-curves)

Requires an elliptic_curve::CurveArithmetic impl on the curve, and a SignPrimitive impl on its associated Scalar type.

Usage

The signature crate defines the following traits which are the primary API for signing:

See the p256 crate for examples of using this type with a concrete elliptic curve.

Implementations§

source§

impl<C> SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source

pub fn sign_prehash_recoverable( &self, prehash: &[u8] ) -> Result<(Signature<C>, RecoveryId)>

Sign the given message prehash, returning a signature and recovery ID.

source

pub fn sign_digest_recoverable<D>( &self, msg_digest: D ) -> Result<(Signature<C>, RecoveryId)>where D: Digest,

Sign the given message digest, returning a signature and recovery ID.

source

pub fn sign_recoverable(&self, msg: &[u8]) -> Result<(Signature<C>, RecoveryId)>

Sign the given message, hashing it with the curve’s default digest function, and returning a signature and recovery ID.

source§

impl<C> SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source

pub fn random(rng: &mut impl CryptoRngCore) -> Self

Generate a cryptographically random SigningKey.

source

pub fn from_bytes(bytes: &FieldBytes<C>) -> Result<Self>

Initialize signing key from a raw scalar serialized as a byte array.

source

pub fn from_slice(bytes: &[u8]) -> Result<Self>

Initialize signing key from a raw scalar serialized as a byte slice.

source

pub fn to_bytes(&self) -> FieldBytes<C>

Serialize this SigningKey as bytes

source

pub fn as_nonzero_scalar(&self) -> &NonZeroScalar<C>

Borrow the secret NonZeroScalar value for this key.

⚠️ Warning

This value is key material.

Please treat it with the care it deserves!

source

pub fn verifying_key(&self) -> &VerifyingKey<C>

Available on crate feature verifying only.

Get the VerifyingKey which corresponds to this SigningKey.

Trait Implementations§

source§

impl<C> AsRef<VerifyingKey<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature verifying only.
source§

fn as_ref(&self) -> &VerifyingKey<C>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<C> AssociatedAlgorithmIdentifier for SigningKey<C>where C: AssociatedOid + CurveArithmetic + PrimeCurve, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature pkcs8 only.
§

type Params = ObjectIdentifier

Algorithm parameters.
source§

const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier> = SecretKey<C>::ALGORITHM_IDENTIFIER

AlgorithmIdentifier for this structure.
source§

impl<C> Clone for SigningKey<C>where C: PrimeCurve + CurveArithmetic + Clone, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn clone(&self) -> SigningKey<C>

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<C> ConstantTimeEq for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl<C> Debug for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

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

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

impl<C, D> DigestSigner<D, (Signature<C>, RecoveryId)> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, D: Digest, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn try_sign_digest(&self, msg_digest: D) -> Result<(Signature<C>, RecoveryId)>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest(&self, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<C, D> DigestSigner<D, Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Sign message digest using a deterministic ephemeral scalar (k) computed using the algorithm described in RFC6979 § 3.2.

source§

fn try_sign_digest(&self, msg_digest: D) -> Result<Signature<C>>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest(&self, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<C, D> DigestSigner<D, SignatureWithOid<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, D: AssociatedOid + Digest + FixedOutput<OutputSize = FieldBytesSize<C>>, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn try_sign_digest(&self, msg_digest: D) -> Result<SignatureWithOid<C>>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest(&self, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<C> Drop for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<C> EncodePrivateKey for SigningKey<C>where C: AssociatedOid + PrimeCurve + CurveArithmetic, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature pem only.
source§

fn to_pkcs8_der(&self) -> Result<SecretDocument>

Serialize a SecretDocument containing a PKCS#8-encoded private key.
§

fn to_pkcs8_pem( &self, line_ending: LineEnding ) -> Result<Zeroizing<String>, Error>

Serialize this private key as PEM-encoded PKCS#8 with the given [LineEnding].
§

fn write_pkcs8_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>

Available on crate feature std only.
Write ASN.1 DER-encoded PKCS#8 private key to the given path
§

fn write_pkcs8_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<(), Error>

Available on crate feature std only.
Write ASN.1 DER-encoded PKCS#8 private key to the given path
source§

impl<C> From<&SecretKey<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn from(secret_key: &SecretKey<C>) -> Self

Converts to this type from the input type.
source§

impl<C> From<&SigningKey<C>> for SecretKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn from(secret_key: &SigningKey<C>) -> Self

Converts to this type from the input type.
source§

impl<C> From<&SigningKey<C>> for VerifyingKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature verifying only.
source§

fn from(signing_key: &SigningKey<C>) -> VerifyingKey<C>

Converts to this type from the input type.
source§

impl<C> From<NonZeroScalar<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn from(secret_scalar: NonZeroScalar<C>) -> Self

Converts to this type from the input type.
source§

impl<C> From<SecretKey<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn from(secret_key: SecretKey<C>) -> Self

Converts to this type from the input type.
source§

impl<C> From<SigningKey<C>> for SecretKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn from(key: SigningKey<C>) -> Self

Converts to this type from the input type.
source§

impl<C> From<SigningKey<C>> for VerifyingKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature verifying only.
source§

fn from(signing_key: SigningKey<C>) -> VerifyingKey<C>

Converts to this type from the input type.
source§

impl<C> FromStr for SigningKey<C>where C: PrimeCurve + AssociatedOid + CurveArithmetic, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature pem only.
§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl<C> KeypairRef for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature verifying only.
§

type VerifyingKey = VerifyingKey<C>

Verifying key type for this keypair.
source§

impl<C> PartialEq for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn eq(&self, other: &SigningKey<C>) -> 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<C> PrehashSigner<(Signature<C>, RecoveryId)> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn sign_prehash(&self, prehash: &[u8]) -> Result<(Signature<C>, RecoveryId)>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
source§

impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Sign message prehash using a deterministic ephemeral scalar (k) computed using the algorithm described in RFC6979 § 3.2.

source§

fn sign_prehash(&self, prehash: &[u8]) -> Result<Signature<C>>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
source§

impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>, MaxSize<C>: ArrayLength<u8>, <FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

Available on crate feature der only.
source§

fn sign_prehash(&self, prehash: &[u8]) -> Result<Signature<C>>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
source§

impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>, MaxSize<C>: ArrayLength<u8>, <FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

Available on crate feature der only.
source§

fn try_sign_digest_with_rng( &self, rng: &mut impl CryptoRngCore, msg_digest: D ) -> Result<Signature<C>>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, D: Digest + FixedOutput<OutputSize = FieldBytesSize<C>>, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn try_sign_digest_with_rng( &self, rng: &mut impl CryptoRngCore, msg_digest: D ) -> Result<Signature<C>>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn sign_prehash_with_rng( &self, rng: &mut impl CryptoRngCore, prehash: &[u8] ) -> Result<Signature<C>>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
source§

impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>, MaxSize<C>: ArrayLength<u8>, <FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

Available on crate feature der only.
source§

fn sign_prehash_with_rng( &self, rng: &mut impl CryptoRngCore, prehash: &[u8] ) -> Result<Signature<C>>

Attempt to sign the given message digest, returning a digital signature on success, or an error if something went wrong. Read more
source§

impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>, MaxSize<C>: ArrayLength<u8>, <FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

Available on crate feature der only.
source§

fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8] ) -> Result<Signature<C>>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where Self: RandomizedDigestSigner<C::Digest, Signature<C>>, C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8] ) -> Result<Signature<C>>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl<C> SignatureAlgorithmIdentifier for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>, Signature<C>: AssociatedAlgorithmIdentifier<Params = AnyRef<'static>>,

Available on crate feature pkcs8 only.
§

type Params = AnyRef<'static>

Algorithm parameters.
source§

const SIGNATURE_ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = Signature<C>::ALGORITHM_IDENTIFIER

AlgorithmIdentifier for the corresponding singature system.
source§

impl<C> Signer<(Signature<C>, RecoveryId)> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn try_sign(&self, msg: &[u8]) -> Result<(Signature<C>, RecoveryId)>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl<C> Signer<Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>, MaxSize<C>: ArrayLength<u8>, <FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArrayLength<u8>,

Available on crate feature der only.
source§

fn try_sign(&self, msg: &[u8]) -> Result<Signature<C>>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl<C> Signer<Signature<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Sign message using a deterministic ephemeral scalar (k) computed using the algorithm described in RFC6979 § 3.2.

source§

fn try_sign(&self, msg: &[u8]) -> Result<Signature<C>>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl<C> Signer<SignatureWithOid<C>> for SigningKey<C>where C: PrimeCurve + CurveArithmetic + DigestPrimitive, C::Digest: AssociatedOid, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

source§

fn try_sign(&self, msg: &[u8]) -> Result<SignatureWithOid<C>>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature
source§

impl<C> TryFrom<&[u8]> for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(bytes: &[u8]) -> Result<Self>

Performs the conversion.
source§

impl<C> TryFrom<PrivateKeyInfo<'_>> for SigningKey<C>where C: PrimeCurve + AssociatedOid + CurveArithmetic, AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>, FieldBytesSize<C>: ModulusSize, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Available on crate feature pkcs8 only.
§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(private_key_info: PrivateKeyInfo<'_>) -> Result<Self>

Performs the conversion.
source§

impl<C> Eq for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Constant-time comparison

source§

impl<C> ZeroizeOnDrop for SigningKey<C>where C: PrimeCurve + CurveArithmetic, Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>, SignatureSize<C>: ArrayLength<u8>,

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> DecodeEcPrivateKey for Twhere T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,

§

fn from_sec1_der(private_key: &[u8]) -> Result<T, Error>

Deserialize SEC1 private key from ASN.1 DER-encoded data (binary format).
§

fn from_sec1_pem(s: &str) -> Result<Self, Error>

Available on crate feature pem only.
Deserialize SEC1-encoded private key from PEM. Read more
§

fn read_sec1_der_file(path: impl AsRef<Path>) -> Result<Self, Error>

Available on crate feature std only.
Load SEC1 private key from an ASN.1 DER-encoded file on the local filesystem (binary format).
§

fn read_sec1_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>

Available on crate features pem and std only.
Load SEC1 private key from a PEM-encoded file on the local filesystem.
§

impl<T> DecodePrivateKey for Twhere T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,

§

fn from_pkcs8_der(bytes: &[u8]) -> Result<T, Error>

Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary format).
§

fn from_pkcs8_pem(s: &str) -> Result<Self, Error>

Available on crate feature pem only.
Deserialize PKCS#8-encoded private key from PEM. Read more
§

fn read_pkcs8_der_file(path: impl AsRef<Path>) -> Result<Self, Error>

Available on crate feature std only.
Load PKCS#8 private key from an ASN.1 DER-encoded file on the local filesystem (binary format).
§

fn read_pkcs8_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>

Available on crate features pem and std only.
Load PKCS#8 private key from a PEM-encoded file on the local filesystem.
source§

impl<T> DynAssociatedAlgorithmIdentifier for Twhere T: AssociatedAlgorithmIdentifier,

source§

fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>

AlgorithmIdentifier for this structure.
source§

impl<T> DynSignatureAlgorithmIdentifier for Twhere T: SignatureAlgorithmIdentifier,

source§

fn signature_algorithm_identifier( &self ) -> Result<AlgorithmIdentifier<Any>, Error>

AlgorithmIdentifier for the corresponding singature system.
§

impl<T> EncodeEcPrivateKey for Twhere T: EncodePrivateKey,

§

fn to_sec1_der(&self) -> Result<SecretDocument, Error>

Serialize a SecretDocument containing a SEC1-encoded private key.
§

fn to_sec1_pem( &self, line_ending: LineEnding ) -> Result<Zeroizing<String>, Error>

Available on crate feature pem only.
Serialize this private key as PEM-encoded SEC1 with the given [LineEnding]. Read more
§

fn write_sec1_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>

Available on crate feature std only.
Write ASN.1 DER-encoded SEC1 private key to the given path.
§

fn write_sec1_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<(), Error>

Available on crate features pem and std only.
Write ASN.1 DER-encoded SEC1 private key to the given path.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<K> Keypair for Kwhere K: KeypairRef,

§

type VerifyingKey = <K as KeypairRef>::VerifyingKey

Verifying key type for this keypair.
source§

fn verifying_key(&self) -> <K as Keypair>::VerifyingKey

Get the verifying key which can verify signatures produced by the signing key portion of this keypair.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<S, T> SignerMut<S> for Twhere T: Signer<S>,

source§

fn try_sign(&mut self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, updating the state, and returning a digital signature on success, or an error if something went wrong. Read more
source§

fn sign(&mut self, msg: &[u8]) -> S

Sign the given message, update the state, and return a digital signature.
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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.