Skip to content

secp2561r - [mainnet]

This module implements ECDSA signatures based on the prime-order secp256r1 ellptic curve (i.e., cofactor is 1).

use 0x1::error;

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;

Structs

ECDSARawPublicKey

A 64-byte ECDSA public key.

struct ECDSARawPublicKey has copy, drop, store
Fields
bytes: vector<u8>

Functions

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 }
}

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;