CryptoSys PKI Pro Manual

Hex format for NIST/SEC EC keys

Private key in hex
An EC private key w is represented in hex by the hexadecimal encoding of its integer value encoded in octets as per section 3 of [RFC5915], denoted here as HEX(w).
Public key in hex
An EC public key (x,y) is represented in hex by the hexadecimal encoding of the octet string as defined in section 4.3.6 of [X9-63]:
04||HEX(x)||HEX(y)
Compressed representation (beginning "02" or "03") is not supported due to patent issues.

Note that the format is different for the safe curves X25519, Ed25519, X448 and Ed448.

Format of ECDSA signature

An ECDSA signature consists of a pair of integers (r,s). There are two representations of ECDSA signatures used in this toolkit:

  1. A simple concatenation of two octet strings resulting from the integer-to-octet encoding of the values of r and s, in that order (i.e. r||s) as specified in section 6.4.1 of [XMLDSIG] with a length parameter l equal to ceiling(log2(q)/8) where q is the order of the curve. This is the default output in this toolkit. It is the form expected for a SignatureValue in an XML-DSIG signature [RFC4050] and is described in section E3.1 of [IEEE1363].
  2. The DER-encoded ASN.1 structure of the signature (a SEQUENCE of two INTEGERs for r and s, in that order). This is the representation used by Bitcoin and in X.509 certificates and is an optional output in this toolkit. Use the PKI_SIG_ASN1DER option flag.

By default, these representations are formatted in base64 encoding. Use the PKI_ENCODE_BASE64URL option to format the signature in URL-safe "base64url" encoding, or the PKI_ENCODE_HEX option for hexadecimal (base16) encoding.

Do you support X.509 certificates containing or signed with elliptic curve keys?

Yes, as of [v12.0] we do. See, for example, X509_MakeCert and ECC_ReadPublicKey.

[PREV: Elliptic Curve Cryptography (ECC)...]   [Contents]   [Index]   
   [NEXT: Can you read a key in compressed representation?...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.