Module 0x1::secp256r1
This module implements ECDSA signatures based on the prime-order secp256r1 ellptic curve (i.e., cofactor is 1).
- Struct
ECDSARawPublicKey - Constants
- Function
ecdsa_raw_public_key_from_64_bytes - Function
ecdsa_raw_public_key_to_bytes - Specification
use 0x1::error;
Struct ECDSARawPublicKey
A 64-byte ECDSA public key.
struct ECDSARawPublicKey has copy, drop, store
Fields
-
bytes: vector<u8>
Constants
An error occurred while deserializing, for example due to wrong input size.
const E_DESERIALIZE: u64 = 1;
The size of a secp256k1-based ECDSA public key, in bytes.
const RAW_PUBLIC_KEY_NUM_BYTES: u64 = 64;
Function ecdsa_raw_public_key_from_64_bytes
Constructs an ECDSARawPublicKey struct, given a 64-byte raw representation.
public fun ecdsa_raw_public_key_from_64_bytes(bytes: vector<u8>): secp256r1::ECDSARawPublicKey
Implementation
public fun ecdsa_raw_public_key_from_64_bytes(bytes: vector<u8>): ECDSARawPublicKey {
assert!(bytes.length() == RAW_PUBLIC_KEY_NUM_BYTES, std::error::invalid_argument(E_DESERIALIZE));
ECDSARawPublicKey { bytes }
}
Function ecdsa_raw_public_key_to_bytes
Serializes an ECDSARawPublicKey struct to 64-bytes.
public fun ecdsa_raw_public_key_to_bytes(pk: &secp256r1::ECDSARawPublicKey): vector<u8>
Implementation
public fun ecdsa_raw_public_key_to_bytes(pk: &ECDSARawPublicKey): vector<u8> {
pk.bytes
}
Specification
pragma verify = false;