pub struct Secp256r1Signature { /* private fields */ }
Implementations§
Source§impl Secp256r1Signature
impl Secp256r1Signature
Sourcepub fn from_scalars(r: &[u8; 32], s: &[u8; 32]) -> Result<Self, CryptoError>
pub fn from_scalars(r: &[u8; 32], s: &[u8; 32]) -> Result<Self, CryptoError>
Creates a signature from the scalar values of r
and s
.
This method constructs a signature from the provided r
and s
values,
which are expected to be 32-byte arrays each.
-
Parameters:
- r: The r scalar value as a 32-byte array.
- s: The s scalar value as a 32-byte array.
-
Returns: A
Result<Secp256r1Signature, CryptoError>
. Returns error if the values do not form a valid signature.
Sourcepub fn from_u256(r: U256, s: U256) -> Result<Self, CryptoError>
pub fn from_u256(r: U256, s: U256) -> Result<Self, CryptoError>
Creates a signature from U256
representations of r
and s
.
Converts the U256
values of r
and s
into byte arrays and attempts
to create a signature. Assumes r
and s
are big-endian.
-
Parameters:
- r: The r value as a
U256
. - s: The s value as a
U256
.
- r: The r value as a
-
Returns: A
Secp256r1Signature
.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, CryptoError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, CryptoError>
Constructs a Secp256r1Signature
from a byte slice.
This method attempts to parse a 64-byte slice as an ECDSA signature.
The first 32 bytes represent r
and the following 32 bytes represent s
.
Returns an error if the slice is not 64 bytes long or does not represent
a valid signature.
-
Parameter bytes: A 64-byte slice representing the signature.
-
Returns: A
Result<Secp256r1Signature, CryptoError>
.
Trait Implementations§
Source§impl Clone for Secp256r1Signature
impl Clone for Secp256r1Signature
Source§fn clone(&self) -> Secp256r1Signature
fn clone(&self) -> Secp256r1Signature
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Secp256r1Signature
impl Debug for Secp256r1Signature
Source§impl<'de> Deserialize<'de> for Secp256r1Signature
impl<'de> Deserialize<'de> for Secp256r1Signature
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for Secp256r1Signature
impl Display for Secp256r1Signature
Source§impl Hash for Secp256r1Signature
impl Hash for Secp256r1Signature
Source§impl PartialEq for Secp256r1Signature
impl PartialEq for Secp256r1Signature
Source§impl PrehashSigner<Secp256r1Signature> for Account
impl PrehashSigner<Secp256r1Signature> for Account
Source§fn sign_prehash(&self, _prehash: &[u8]) -> Result<Secp256r1Signature, Error>
fn sign_prehash(&self, _prehash: &[u8]) -> Result<Secp256r1Signature, Error>
Auto Trait Implementations§
impl Freeze for Secp256r1Signature
impl RefUnwindSafe for Secp256r1Signature
impl Send for Secp256r1Signature
impl Sync for Secp256r1Signature
impl Unpin for Secp256r1Signature
impl UnwindSafe for Secp256r1Signature
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.