XU XUv0.16.0

#crypto/ecdsa

import: #crypto/ecdsa

counts: 19 functions, 0 methods, 0 types, 9 constants, 0 method sets

crypto/ecdsa verification subset. Public keys use SEC1 uncompressed P-256/P-384/P-521 form (0x04 || X || Y); signatures use ASN.1 DER SEQUENCE{r,s} or RFC 7515 fixed-width R||S raw format. The curve is selected explicitly for key generation and by canonical raw-key length for public/sign operations. Signing uses the platform-independent CSPRNG exposed by crypto/rand. XU-CT-CLASS: variable-time Point/scalar arithmetic is math/big based. ECDSA and ECDH therefore have no constant-time contract even where final equality uses crypto/subtle.

const PUBLIC_KEY_SIZE_P256

XuAPI
pub const PUBLIC_KEY_SIZE_P256 = 65

Purpose

Constant PUBLIC_KEY_SIZE_P256, defining protocol or algorithm parameters.

const PUBLIC_KEY_SIZE_P384

XuAPI
pub const PUBLIC_KEY_SIZE_P384 = 97

Purpose

Constant PUBLIC_KEY_SIZE_P384, defining protocol or algorithm parameters.

const PUBLIC_KEY_SIZE_P521

XuAPI
pub const PUBLIC_KEY_SIZE_P521 = 133

Purpose

Constant PUBLIC_KEY_SIZE_P521, defining protocol or algorithm parameters.

const PRIVATE_KEY_SIZE_P256

XuAPI
pub const PRIVATE_KEY_SIZE_P256 = 32

Purpose

Constant PRIVATE_KEY_SIZE_P256, defining protocol or algorithm parameters.

const PRIVATE_KEY_SIZE_P384

XuAPI
pub const PRIVATE_KEY_SIZE_P384 = 48

Purpose

Constant PRIVATE_KEY_SIZE_P384, defining protocol or algorithm parameters.

const PRIVATE_KEY_SIZE_P521

XuAPI
pub const PRIVATE_KEY_SIZE_P521 = 66

Purpose

Constant PRIVATE_KEY_SIZE_P521, defining protocol or algorithm parameters.

const P256

XuAPI
pub const P256 = 256

Purpose

Constant P256, defining protocol or algorithm parameters.

const P384

XuAPI
pub const P384 = 384

Purpose

Constant P384, defining protocol or algorithm parameters.

const P521

XuAPI
pub const P521 = 521

Purpose

Constant P521, defining protocol or algorithm parameters.

generate_key

XuAPI
pub fn generate_key(curve int) string

Purpose

Generate key. Throws on failure; handle the error or propagate it to the caller.

Parameters

curve int
curve (int)

Returns

string — result string

public

XuAPI
pub fn public(private_key &string) string

Purpose

Execute public. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

ecdh

XuAPI
pub fn ecdh(private_key &string, peer_public &string) string

Purpose

ecdh returns the fixed-width shared X coordinate for P-256/P-384/P-521. The curve is inferred from the private-key width and must match the peer SEC1 uncompressed public-key width. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)
peer_public &string
peer_public (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

sign_asn1

XuAPI
pub fn sign_asn1(private_key &string, hash &string) string

Purpose

Sign asn1. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)
hash &string
hash (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

sign_raw

XuAPI
pub fn sign_raw(private_key &string, hash &string) string

Purpose

Sign raw. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)
hash &string
hash (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

sign_raw_p256

XuAPI
pub fn sign_raw_p256(private_key &string, hash &string) string

Purpose

Sign raw p256. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)
hash &string
hash (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

verify_asn1

XuAPI
pub fn verify_asn1(public_key &string, hash &string, signature &string) bool

Purpose

Verify asn1.

Parameters

public_key &string
public_key (read-only borrow; caller keeps the original; type &string)
hash &string
hash (read-only borrow; caller keeps the original; type &string)
signature &string
signature (read-only borrow; caller keeps the original; type &string)

Returns

bool — true or false

verify_raw

XuAPI
pub fn verify_raw(public_key &string, hash &string, signature &string) bool

Purpose

Verify raw.

Parameters

public_key &string
public_key (read-only borrow; caller keeps the original; type &string)
hash &string
hash (read-only borrow; caller keeps the original; type &string)
signature &string
signature (read-only borrow; caller keeps the original; type &string)

Returns

bool — true or false

verify_raw_p256

XuAPI
pub fn verify_raw_p256(public_key &string, hash &string, signature &string) bool

Purpose

Verify raw p256.

Parameters

public_key &string
public_key (read-only borrow; caller keeps the original; type &string)
hash &string
hash (read-only borrow; caller keeps the original; type &string)
signature &string
signature (read-only borrow; caller keeps the original; type &string)

Returns

bool — true or false

parse_private_key

XuAPI
pub fn parse_private_key(der &string) string

Purpose

Parse as private key. Throws on failure; handle the error or propagate it to the caller.

Parameters

der &string
der (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_sec1

XuAPI
pub fn marshal_sec1(private_key &string) string

Purpose

Marshal sec1.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_pkcs8

XuAPI
pub fn marshal_pkcs8(private_key &string) string

Purpose

Marshal pkcs8. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

parse_private_pem

XuAPI
pub fn parse_private_pem(text &string) string

Purpose

Parse as private pem. Throws on failure; handle the error or propagate it to the caller.

Parameters

text &string
text (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_pkcs8_pem

XuAPI
pub fn marshal_pkcs8_pem(private_key &string) string

Purpose

Marshal pkcs8 pem. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_sec1_pem

XuAPI
pub fn marshal_sec1_pem(private_key &string) string

Purpose

Marshal sec1 pem. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

parse_public_key

XuAPI
pub fn parse_public_key(der &string) string

Purpose

Parse as public key. Throws on failure; handle the error or propagate it to the caller.

Parameters

der &string
der (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_pkix

XuAPI
pub fn marshal_pkix(public_key &string) string

Purpose

Marshal pkix. Throws on failure; handle the error or propagate it to the caller.

Parameters

public_key &string
public_key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

parse_public_pem

XuAPI
pub fn parse_public_pem(text &string) string

Purpose

Parse as public pem. Throws on failure; handle the error or propagate it to the caller.

Parameters

text &string
text (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

marshal_pkix_pem

XuAPI
pub fn marshal_pkix_pem(public_key &string) string

Purpose

Marshal pkix pem. Throws on failure; handle the error or propagate it to the caller.

Parameters

public_key &string
public_key (read-only borrow; caller keeps the original; type &string)

Returns

string — result string