Sec1

object Sec1(source)

Compressed SEC1 points (02 || x or 03 || x) for P-256 and P-384, expanded to the uncompressed 04 || x || y that KeyType.P256 and KeyType.P384 document (SEC 1 v2 §2.3.4).

P-256 and P-384 public keys cross the CryptoBackend boundary uncompressed, so protocol code expands every compressed point before a backend sees it: EDHOC sends only the x-coordinate of an ephemeral key (RFC 9528 §3.7, Appendix B), certificates may carry compressed keys (RFC 5480 §2.2), and a COSE_Key may give y as a sign bit (RFC 9053 §7.1.1). Platforms disagree about compressed points: JCA, OpenSSL and Node.js accept them, but Apple's SecKey and browsers' WebCrypto do not reliably, and a secure element may not at all. Expanding them here makes the same input behave the same way on every platform and with every backend.

Both curves are y^2 = x^3 - 3x + b over a prime p ≡ 3 (mod 4), so the square root is (x^3 - 3x + b)^((p + 1) / 4). A candidate that does not square back to the right-hand side means x is not on the curve, and the point is rejected. The point is public, so the arithmetic need not be constant time.

Functions

Link copied to clipboard

The uncompressed 04 || x || y of the compressed point on the curve of type: y is the square root whose parity the prefix gives, 02 for an even y and 03 for an odd one.

Link copied to clipboard

Whether point starts like a compressed SEC1 point: with 02 or 03. Its length is not checked.