Skip to main content

BrainpoolP256r1

Struct BrainpoolP256r1 

Source
pub struct BrainpoolP256r1;
Expand description

brainpoolP256r1 (BSI / RFC 5639).

Trait Implementations§

Source§

impl Curve for BrainpoolP256r1

Source§

fn keygen(rng: &mut dyn CryptoRng) -> (PublicKey, SecretKey)

Generate a key pair on this curve.
Source§

fn ecdh(sk: &SecretKey, peer_pk: &PublicKey) -> Option<Vec<u8>>

ECDH key agreement: derive the shared secret from our secret key and the peer’s SEC1 uncompressed public key. Read more
Source§

fn compress_pubkey(pk: &PublicKey) -> Option<Vec<u8>>

Compress a public key from SEC1 uncompressed (0x04 || X || Y) to SEC1 compressed (0x02/0x03 || X). If the input is already compressed, returns a validated clone. Returns None for malformed or off-curve input.
Source§

fn decompress_pubkey(compressed: &[u8]) -> Option<PublicKey>

Decompress a SEC1 compressed public key (0x02/0x03 || X) to uncompressed form (0x04 || X || Y), recovering Y via the field square-root. If the input is already uncompressed, acts as a validate-and-clone. Returns None if the input is malformed, if X is not a valid x-coordinate on the curve, or if the decompressed point fails the on-curve check.
Source§

fn sign_rfc6979<H: Hasher>(sk: &SecretKey, digest: &[u8]) -> Signature

Sign a precomputed digest with the deterministic RFC 6979 nonce. Read more
Source§

fn sign_random( sk: &SecretKey, digest: &[u8], rng: &mut dyn CryptoRng, ) -> Signature

Sign a precomputed digest with a uniformly random nonce drawn from rng. The hash function is irrelevant – only the digest bytes are consumed (via bits2int). Each call must consume fresh entropy; reusing k across two signatures with the same key recovers the secret key.
Source§

fn verify(pk: &PublicKey, digest: &[u8], sig: &Signature) -> bool

Verify a signature against a precomputed digest.
Source§

fn sign_rfc6979_msg<H: Hasher>(sk: &SecretKey, msg: &[u8]) -> Signature

Convenience: hash msg with H, then call Self::sign_rfc6979.
Source§

fn sign_random_msg<H: Hasher>( sk: &SecretKey, msg: &[u8], rng: &mut dyn CryptoRng, ) -> Signature

Convenience: hash msg with H, then call Self::sign_random.
Source§

fn verify_msg<H: Hasher>(pk: &PublicKey, msg: &[u8], sig: &Signature) -> bool

Convenience: hash msg with H, then call Self::verify.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.