Struct EcdsaKeyPair
pub struct EcdsaKeyPair { /* private fields */ }aws-lc and crypto and std only.Expand description
An ECDSA key pair, used for signing.
Implementations§
§impl EcdsaKeyPair
impl EcdsaKeyPair
pub fn generate(
alg: &'static EcdsaSigningAlgorithm,
) -> Result<EcdsaKeyPair, Unspecified>
pub fn generate( alg: &'static EcdsaSigningAlgorithm, ) -> Result<EcdsaKeyPair, Unspecified>
pub fn from_pkcs8(
alg: &'static EcdsaSigningAlgorithm,
pkcs8: &[u8],
) -> Result<EcdsaKeyPair, KeyRejected>
pub fn from_pkcs8( alg: &'static EcdsaSigningAlgorithm, pkcs8: &[u8], ) -> Result<EcdsaKeyPair, KeyRejected>
Constructs an ECDSA key pair by parsing an unencrypted PKCS#8 v1
id-ecPublicKey ECPrivateKey key.
§Errors
error::KeyRejected if bytes do not encode an ECDSA key pair or if the key is otherwise not
acceptable.
pub fn generate_pkcs8(
alg: &'static EcdsaSigningAlgorithm,
_rng: &dyn SecureRandom,
) -> Result<Document, Unspecified>
pub fn generate_pkcs8( alg: &'static EcdsaSigningAlgorithm, _rng: &dyn SecureRandom, ) -> Result<Document, Unspecified>
pub fn to_pkcs8v1(&self) -> Result<Document, Unspecified>
pub fn to_pkcs8v1(&self) -> Result<Document, Unspecified>
Serializes this EcdsaKeyPair into a PKCS#8 v1 document.
§Errors
error::Unspecified on internal error.
pub fn from_private_key_and_public_key(
alg: &'static EcdsaSigningAlgorithm,
private_key: &[u8],
public_key: &[u8],
) -> Result<EcdsaKeyPair, KeyRejected>
pub fn from_private_key_and_public_key( alg: &'static EcdsaSigningAlgorithm, private_key: &[u8], public_key: &[u8], ) -> Result<EcdsaKeyPair, KeyRejected>
Constructs an ECDSA key pair from the private key and public key bytes
The private key must encoded as a big-endian fixed-length integer. For example, a P-256 private key must be 32 bytes prefixed with leading zeros as needed.
The public key is encoding in uncompressed form using the Octet-String-to-Elliptic-Curve-Point algorithm in SEC 1: Elliptic Curve Cryptography, Version 2.0.
This is intended for use by code that deserializes key pairs. It is
recommended to use EcdsaKeyPair::from_pkcs8() (with a PKCS#8-encoded
key) instead.
§Errors
error::KeyRejected if parsing failed or key otherwise unacceptable.
pub fn from_private_key_der(
alg: &'static EcdsaSigningAlgorithm,
private_key: &[u8],
) -> Result<EcdsaKeyPair, KeyRejected>
pub fn from_private_key_der( alg: &'static EcdsaSigningAlgorithm, private_key: &[u8], ) -> Result<EcdsaKeyPair, KeyRejected>
Deserializes a DER-encoded private key structure to produce a EcdsaKeyPair.
This function is typically used to deserialize RFC 5915 encoded private keys, but it will
attempt to automatically detect other key formats. This function supports unencrypted
PKCS#8 PrivateKeyInfo structures as well as key type specific formats.
See EcdsaPrivateKey::as_der.
§Errors
error::KeyRejected if parsing failed or key otherwise unacceptable.
§Panics
pub fn private_key(&self) -> PrivateKey<'_>
pub fn private_key(&self) -> PrivateKey<'_>
Access functions related to the private key.
pub fn algorithm(&self) -> &'static EcdsaSigningAlgorithm
pub fn algorithm(&self) -> &'static EcdsaSigningAlgorithm
EcdsaSigningAlgorithm which was used to create this EcdsaKeyPair
pub fn sign(
&self,
_rng: &dyn SecureRandom,
message: &[u8],
) -> Result<Signature, Unspecified>
pub fn sign( &self, _rng: &dyn SecureRandom, message: &[u8], ) -> Result<Signature, Unspecified>
pub fn sign_digest(&self, digest: &Digest) -> Result<Signature, Unspecified>
pub fn sign_digest(&self, digest: &Digest) -> Result<Signature, Unspecified>
Returns a signature for the message corresponding to the provided digest.
§Errors
error::Unspecified on internal error.
Trait Implementations§
§impl Clone for EcdsaKeyPair
impl Clone for EcdsaKeyPair
§fn clone(&self) -> EcdsaKeyPair
fn clone(&self) -> EcdsaKeyPair
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for EcdsaKeyPair
impl Debug for EcdsaKeyPair
§impl KeyPair for EcdsaKeyPair
impl KeyPair for EcdsaKeyPair
§fn public_key(&self) -> &<EcdsaKeyPair as KeyPair>::PublicKey
fn public_key(&self) -> &<EcdsaKeyPair as KeyPair>::PublicKey
Provides the public key.
impl Send for EcdsaKeyPair
impl Sync for EcdsaKeyPair
Auto Trait Implementations§
impl Forget for EcdsaKeyPair
impl Freeze for EcdsaKeyPairwhere
&'static EcdsaSigningAlgorithm: Freeze,
*mut evp_pkey_st: Freeze,
*const [u8] is !null: Freeze,
PhantomData<[u8]>: Freeze,
impl Move for EcdsaKeyPair
impl RefUnwindSafe for EcdsaKeyPair
impl Unpin for EcdsaKeyPair
impl UnsafeUnpin for EcdsaKeyPairwhere
&'static EcdsaSigningAlgorithm: UnsafeUnpin,
*mut evp_pkey_st: UnsafeUnpin,
*const [u8] is !null: UnsafeUnpin,
PhantomData<[u8]>: UnsafeUnpin,
impl UnwindSafe for EcdsaKeyPairwhere
&'static EcdsaSigningAlgorithm: UnwindSafe,
*mut evp_pkey_st: UnwindSafe,
BoxRaw<[u8]>: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more