tlslite.utils.x25519 module

Handling X25519 and X448 curve based key agreement protocol.

tlslite.utils.x25519.cswap(swap, x_2, x_3)[source]

Conditional swap function.

tlslite.utils.x25519.decodeScalar22519(k)[source]

Function to decode the private K parameter of the x25519 function.

tlslite.utils.x25519.decodeScalar448(k)[source]

Function to decode the private K parameter of the X448 function.

tlslite.utils.x25519.decodeUCoordinate(u, bits)[source]

Function to decode the public U coordinate of X25519-family curves.

tlslite.utils.x25519.x25519(k, u)[source]

Perform point multiplication on X25519 curve.

Parameters:
  • k (bytearray) – random secret value (multiplier), should be 32 byte long

  • u (bytearray) – curve generator or the other party key share

Return type:

bytearray

tlslite.utils.x25519.x448(k, u)[source]

Perform point multiplication on X448 curve.

Parameters:
  • k (bytearray) – random secret value (multiplier), should be 56 bytes long

  • u (bytearray) – curve generator or the other party key share

Return type:

bytearray