According to Standards Recommanded Elliptic Curve parameter for Cryptography, for each given curve, the base point is given in compressed and uncompressed form, but personnaly I do not understand how to use it with that form, I need the (X,Y) coordinates for my application, thanks to show me how to find them from the given form.
-
$\begingroup$ Why are you using secp521r1 and not Curve25519 or Curve448, or their analogous twisted Edwards curves, or, if you really insist on a ‘256-bit’ security level using an admittedly awesome Mersenne prime, E-521? $\endgroup$– Squeamish OssifrageCommented Mar 14, 2018 at 4:10
1 Answer
The compressed form of the base point only provides the X coordinate. It is identified by a leading $\mathtt{02}$ or $\mathtt{03}$ byte. The remaining bytes are the hex-encoded X coordinate. Y can be recovered using the curve definition $y^2 = x^3 + ax + b \pmod{p}$. As both Y and -Y can satisfy the equation, the leading $\mathtt{02}$ indicates the that the positive value should be taken, and the leading $\mathtt{03}$ indicates that the negative value should be taken. You can read more details in this answer.
The uncompressed form of the base point provides both the X and Y coordinates. It is identified by the leading $\mathtt{04}$ byte. The remaining bytes are the hex-encoded X and Y coordinates, concatenated as X || Y.
Looking at SEC2 Ver1, "2.9.1 Recommended Parameters secp521r1", we have:
G = 04 00C6858E 06B70404 E9CD9E3E CB662395 B4429C64 8139053F B521F828 AF606B4D 3DBAA14B 5E77EFE7 5928FE1D C127A2FF A8DE3348 B3C1856A 429BF97E 7E31C2E5 BD660118 39296A78 9A3BC004 5C8A5FB4 2C7D1BD9 98F54449 579B4468 17AFBD17 273E662C 97EE7299 5EF42640 C550B901 3FAD0761 353C7086 A272C240 88BE9476 9FD16650
In other words, the uncompressed encoding of the basepoint G = 04 || X || Y
. Using that we can parse the coordinates of G
as:
X = 00C6 858E06B7 0404E9CD 9E3ECB66 2395B442 9C648139 053FB521 F828AF60 6B4D3DBA A14B5E77 EFE75928 FE1DC127 A2FFA8DE 3348B3C1 856A429B F97E7E31 C2E5BD66 Y = 0118 39296A78 9A3BC004 5C8A5FB4 2C7D1BD9 98F54449 579B4468 17AFBD17 273E662C 97EE7299 5EF42640 C550B901 3FAD0761 353C7086 A272C240 88BE9476 9FD16650