const PUBLIC_KEY_SIZE_P256
pub const PUBLIC_KEY_SIZE_P256 = 65Purpose
Constant PUBLIC_KEY_SIZE_P256, defining protocol or algorithm parameters.
#crypto/ecdsacrypto/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_P256pub const PUBLIC_KEY_SIZE_P256 = 65Constant PUBLIC_KEY_SIZE_P256, defining protocol or algorithm parameters.
const PUBLIC_KEY_SIZE_P384pub const PUBLIC_KEY_SIZE_P384 = 97Constant PUBLIC_KEY_SIZE_P384, defining protocol or algorithm parameters.
const PUBLIC_KEY_SIZE_P521pub const PUBLIC_KEY_SIZE_P521 = 133Constant PUBLIC_KEY_SIZE_P521, defining protocol or algorithm parameters.
const PRIVATE_KEY_SIZE_P256pub const PRIVATE_KEY_SIZE_P256 = 32Constant PRIVATE_KEY_SIZE_P256, defining protocol or algorithm parameters.
const PRIVATE_KEY_SIZE_P384pub const PRIVATE_KEY_SIZE_P384 = 48Constant PRIVATE_KEY_SIZE_P384, defining protocol or algorithm parameters.
const PRIVATE_KEY_SIZE_P521pub const PRIVATE_KEY_SIZE_P521 = 66Constant PRIVATE_KEY_SIZE_P521, defining protocol or algorithm parameters.
const P256pub const P256 = 256Constant P256, defining protocol or algorithm parameters.
const P384pub const P384 = 384Constant P384, defining protocol or algorithm parameters.
const P521pub const P521 = 521Constant P521, defining protocol or algorithm parameters.
generate_keypub fn generate_key(curve int) stringGenerate key. Throws on failure; handle the error or propagate it to the caller.
curve intstring — result string
publicpub fn public(private_key &string) stringExecute public. Throws on failure; handle the error or propagate it to the caller.
private_key &stringstring — result string
ecdhpub fn ecdh(private_key &string, peer_public &string) stringecdh 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.
private_key &stringpeer_public &stringstring — result string
sign_asn1pub fn sign_asn1(private_key &string, hash &string) stringSign asn1. Throws on failure; handle the error or propagate it to the caller.
private_key &stringhash &stringstring — result string
sign_rawpub fn sign_raw(private_key &string, hash &string) stringSign raw. Throws on failure; handle the error or propagate it to the caller.
private_key &stringhash &stringstring — result string
sign_raw_p256pub fn sign_raw_p256(private_key &string, hash &string) stringSign raw p256. Throws on failure; handle the error or propagate it to the caller.
private_key &stringhash &stringstring — result string
verify_asn1pub fn verify_asn1(public_key &string, hash &string, signature &string) boolVerify asn1.
public_key &stringhash &stringsignature &stringbool — true or false
verify_rawpub fn verify_raw(public_key &string, hash &string, signature &string) boolVerify raw.
public_key &stringhash &stringsignature &stringbool — true or false
verify_raw_p256pub fn verify_raw_p256(public_key &string, hash &string, signature &string) boolVerify raw p256.
public_key &stringhash &stringsignature &stringbool — true or false
parse_private_keypub fn parse_private_key(der &string) stringParse as private key. Throws on failure; handle the error or propagate it to the caller.
der &stringstring — result string
marshal_sec1pub fn marshal_sec1(private_key &string) stringMarshal sec1.
private_key &stringstring — result string
marshal_pkcs8pub fn marshal_pkcs8(private_key &string) stringMarshal pkcs8. Throws on failure; handle the error or propagate it to the caller.
private_key &stringstring — result string
parse_private_pempub fn parse_private_pem(text &string) stringParse as private pem. Throws on failure; handle the error or propagate it to the caller.
text &stringstring — result string
marshal_pkcs8_pempub fn marshal_pkcs8_pem(private_key &string) stringMarshal pkcs8 pem. Throws on failure; handle the error or propagate it to the caller.
private_key &stringstring — result string
marshal_sec1_pempub fn marshal_sec1_pem(private_key &string) stringMarshal sec1 pem. Throws on failure; handle the error or propagate it to the caller.
private_key &stringstring — result string
parse_public_keypub fn parse_public_key(der &string) stringParse as public key. Throws on failure; handle the error or propagate it to the caller.
der &stringstring — result string
marshal_pkixpub fn marshal_pkix(public_key &string) stringMarshal pkix. Throws on failure; handle the error or propagate it to the caller.
public_key &stringstring — result string
parse_public_pempub fn parse_public_pem(text &string) stringParse as public pem. Throws on failure; handle the error or propagate it to the caller.
text &stringstring — result string
marshal_pkix_pempub fn marshal_pkix_pem(public_key &string) stringMarshal pkix pem. Throws on failure; handle the error or propagate it to the caller.
public_key &stringstring — result string