pub struct P256KeyPair { /* private fields */ }Available on crate features
p256 or p256_hardware only.Expand description
A P-256 (secp256r1) public key or keypair
Implementations§
Source§impl P256KeyPair
impl P256KeyPair
Sourcepub fn sign_prehashed(&self, hashed_message: &[u8]) -> Option<[u8; 64]>
pub fn sign_prehashed(&self, hashed_message: &[u8]) -> Option<[u8; 64]>
Sign a pre-hashed message with the secret key
Sourcepub fn verify_signature(&self, message: &[u8], signature: &[u8]) -> bool
pub fn verify_signature(&self, message: &[u8], signature: &[u8]) -> bool
Verify a signature against the public key
Sourcepub fn verify_signature_prehashed(
&self,
hashed_message: &[u8],
signature: &[u8],
) -> bool
pub fn verify_signature_prehashed( &self, hashed_message: &[u8], signature: &[u8], ) -> bool
Verify a signature on a prehashed message against the public key
Trait Implementations§
Source§impl Clone for P256KeyPair
impl Clone for P256KeyPair
Source§fn clone(&self) -> P256KeyPair
fn clone(&self) -> P256KeyPair
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for P256KeyPair
impl Debug for P256KeyPair
Source§impl FromJwk for P256KeyPair
impl FromJwk for P256KeyPair
Source§impl HasKeyAlg for P256KeyPair
impl HasKeyAlg for P256KeyPair
Source§impl HasKeyBackend for P256KeyPair
impl HasKeyBackend for P256KeyPair
Source§fn key_backend(&self) -> KeyBackend
fn key_backend(&self) -> KeyBackend
Get the corresponding key backend.
Source§impl KeyExchange for P256KeyPair
impl KeyExchange for P256KeyPair
Source§fn write_key_exchange(
&self,
other: &Self,
out: &mut dyn WriteBuffer,
) -> Result<(), Error>
fn write_key_exchange( &self, other: &Self, out: &mut dyn WriteBuffer, ) -> Result<(), Error>
Perform a key exchange, writing the result to the provided buffer.
Source§fn key_exchange_bytes(&self, other: &Rhs) -> Result<SecretBytes, Error>
fn key_exchange_bytes(&self, other: &Rhs) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Perform a key exchange and return a new allocated buffer.
Source§impl KeyGen for P256KeyPair
impl KeyGen for P256KeyPair
Source§impl KeyMeta for P256KeyPair
impl KeyMeta for P256KeyPair
Source§impl KeyPublicBytes for P256KeyPair
impl KeyPublicBytes for P256KeyPair
Source§impl KeySecretBytes for P256KeyPair
impl KeySecretBytes for P256KeyPair
Source§impl KeySigVerify for P256KeyPair
impl KeySigVerify for P256KeyPair
Source§fn verify_signature(
&self,
message: &[u8],
signature: &[u8],
sig_type: Option<SignatureType>,
) -> Result<bool, Error>
fn verify_signature( &self, message: &[u8], signature: &[u8], sig_type: Option<SignatureType>, ) -> Result<bool, Error>
Check the validity of signature over a message with the
specified signature type.
Source§impl KeySign for P256KeyPair
impl KeySign for P256KeyPair
Source§fn write_signature(
&self,
message: &[u8],
sig_type: Option<SignatureType>,
out: &mut dyn WriteBuffer,
) -> Result<(), Error>
fn write_signature( &self, message: &[u8], sig_type: Option<SignatureType>, out: &mut dyn WriteBuffer, ) -> Result<(), Error>
Create a signature of the requested type and write it to the
provided buffer.
Source§fn create_signature(
&self,
message: &[u8],
sig_type: Option<SignatureType>,
) -> Result<SecretBytes, Error>
fn create_signature( &self, message: &[u8], sig_type: Option<SignatureType>, ) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Create a signature of the requested type and return an allocated
buffer.
Source§impl KeypairBytes for P256KeyPair
impl KeypairBytes for P256KeyPair
Source§fn from_keypair_bytes(kp: &[u8]) -> Result<Self, Error>
fn from_keypair_bytes(kp: &[u8]) -> Result<Self, Error>
Create a new key instance from a slice of keypair bytes.
Source§fn with_keypair_bytes<O>(&self, f: impl FnOnce(Option<&[u8]>) -> O) -> O
fn with_keypair_bytes<O>(&self, f: impl FnOnce(Option<&[u8]>) -> O) -> O
Create a new key instance from a slice of keypair bytes.
Source§fn to_keypair_bytes_buffer<B: WriteBuffer>(
&self,
out: &mut B,
) -> Result<(), Error>
fn to_keypair_bytes_buffer<B: WriteBuffer>( &self, out: &mut B, ) -> Result<(), Error>
Write the keypair bytes to a buffer.
Source§fn to_keypair_bytes(&self) -> Result<SecretBytes, Error>
fn to_keypair_bytes(&self) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Write the keypair bytes to a new allocated buffer.
Source§impl KeypairMeta for P256KeyPair
impl KeypairMeta for P256KeyPair
Source§impl ToJwk for P256KeyPair
impl ToJwk for P256KeyPair
Source§fn encode_jwk(&self, enc: &mut dyn JwkEncoder) -> Result<(), Error>
fn encode_jwk(&self, enc: &mut dyn JwkEncoder) -> Result<(), Error>
Write the JWK representation to an encoder
Source§fn to_jwk_thumbprint(&self, alg: Option<KeyAlg>) -> Result<String, Error>
fn to_jwk_thumbprint(&self, alg: Option<KeyAlg>) -> Result<String, Error>
Available on crate feature
alloc only.Create the JWK thumbprint of the key
Source§fn to_jwk_public(&self, alg: Option<KeyAlg>) -> Result<String, Error>
fn to_jwk_public(&self, alg: Option<KeyAlg>) -> Result<String, Error>
Available on crate feature
alloc only.Create a JWK of the public key
Source§fn to_jwk_secret(&self, alg: Option<KeyAlg>) -> Result<SecretBytes, Error>
fn to_jwk_secret(&self, alg: Option<KeyAlg>) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Create a JWK of the secret key
Auto Trait Implementations§
impl Freeze for P256KeyPair
impl RefUnwindSafe for P256KeyPair
impl Send for P256KeyPair
impl Sync for P256KeyPair
impl Unpin for P256KeyPair
impl UnwindSafe for P256KeyPair
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K> ToPublicBytes for Kwhere
K: KeyPublicBytes,
impl<K> ToPublicBytes for Kwhere
K: KeyPublicBytes,
Source§fn write_public_bytes(&self, out: &mut dyn WriteBuffer) -> Result<(), Error>
fn write_public_bytes(&self, out: &mut dyn WriteBuffer) -> Result<(), Error>
Write the key public bytes to a buffer.
Source§fn to_public_bytes(&self) -> Result<SecretBytes, Error>
fn to_public_bytes(&self) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Write the key public bytes to a new allocated buffer.
Source§impl<K> ToSecretBytes for Kwhere
K: KeySecretBytes,
impl<K> ToSecretBytes for Kwhere
K: KeySecretBytes,
Source§fn write_secret_bytes(&self, out: &mut dyn WriteBuffer) -> Result<(), Error>
fn write_secret_bytes(&self, out: &mut dyn WriteBuffer) -> Result<(), Error>
Write the key secret bytes to a buffer.
Source§fn to_secret_bytes(&self) -> Result<SecretBytes, Error>
fn to_secret_bytes(&self) -> Result<SecretBytes, Error>
Available on crate feature
alloc only.Write the key secret bytes to a new allocated buffer.