pub struct Secp256r1Signature { /* private fields */ }Available on crate feature
secp256r1 only.Expand description
A Secp256r1 (P-256) ECDSA signature.
Implementations§
Source§impl Secp256r1Signature
impl Secp256r1Signature
Sourcepub fn from_bytes(bytes: &[u8]) -> AptosResult<Self>
pub fn from_bytes(bytes: &[u8]) -> AptosResult<Self>
Creates a signature from raw bytes (64 bytes, r || s).
§Security
Rejects high-S signatures to match Aptos on-chain verification behavior. The Aptos VM only accepts low-S (canonical) ECDSA signatures to prevent signature malleability attacks.
§Errors
Returns AptosError::InvalidSignature if:
- The byte slice length is not exactly 64 bytes
- The bytes do not represent a valid Secp256r1 signature
- The signature has a high-S value (not canonical)
Sourcepub fn from_hex(hex_str: &str) -> AptosResult<Self>
pub fn from_hex(hex_str: &str) -> AptosResult<Self>
Creates a signature from a hex string.
§Errors
Returns AptosError::Hex if the hex string is invalid.
Returns AptosError::InvalidSignature if the decoded bytes are not exactly 64 bytes or do not represent a valid Secp256r1 signature.
Trait Implementations§
Source§impl Clone for Secp256r1Signature
impl Clone for Secp256r1Signature
Source§fn clone(&self) -> Secp256r1Signature
fn clone(&self) -> Secp256r1Signature
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 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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Secp256r1Signature
impl Display for Secp256r1Signature
Source§impl PartialEq for Secp256r1Signature
impl PartialEq for Secp256r1Signature
Source§impl Serialize for Secp256r1Signature
impl Serialize for Secp256r1Signature
Source§impl Signature for Secp256r1Signature
impl Signature for Secp256r1Signature
Source§type PublicKey = Secp256r1PublicKey
type PublicKey = Secp256r1PublicKey
The public key type for this signature scheme.
Source§fn from_bytes(bytes: &[u8]) -> AptosResult<Self>
fn from_bytes(bytes: &[u8]) -> AptosResult<Self>
Creates a signature from bytes. Read more
impl Copy for Secp256r1Signature
impl Eq for Secp256r1Signature
impl StructuralPartialEq for Secp256r1Signature
Auto Trait Implementations§
impl Freeze for Secp256r1Signature
impl RefUnwindSafe for Secp256r1Signature
impl Send for Secp256r1Signature
impl Sync for Secp256r1Signature
impl Unpin for Secp256r1Signature
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§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> IntoMoveArg for Twhere
T: Serialize,
impl<T> IntoMoveArg for Twhere
T: Serialize,
Source§fn into_move_arg(self) -> Result<Vec<u8>, AptosError>
fn into_move_arg(self) -> Result<Vec<u8>, AptosError>
Converts this value into BCS-encoded bytes. Read more
§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.