Skip to content

Type Property

byteRanges

Specifies the byte ranges in which the X and Y coordinates of an ECDSA public key appear for the P521 curve. For P521, the public key is a bit tricky because 521 bits is not a multiple of 8, but it’s typically represented as 66 bytes for each coordinate with leading zeros as needed. The public key is hence 133 bytes long: a single byte prefix (usually 0x04 for uncompressed keys), followed by 66 bytes for the X coordinate, and then 66 bytes for the Y coordinate.
static let byteRanges: (x: Range<Int>, y: Range<Int>)

Discussion

Thus:

  • The X coordinate spans bytes 1 through 66.

  • The Y coordinate spans bytes 67 through 132.