keycard.crypto package

Submodules

keycard.crypto.ecdh module

keycard.crypto.ecdh.ecdh_shared_secret(private_key, peer_public_key)

Computes the secp256k1 ECDH shared secret.

Return type:

bytes

Parameters:
  • private_key (EllipticCurvePrivateKey) – Our private key.

  • peer_public_key (bytes) – The peer’s encoded public key.

Returns:

The X coordinate of the shared point (32 bytes).

Return type:

bytes

Raises:

ValueError – If the peer public key is not a valid point.

keycard.crypto.ecdh.generate_key_pair()

Generates an ephemeral secp256k1 key pair.

Return type:

tuple[EllipticCurvePrivateKey, bytes]

Returns:

The private key and its

uncompressed public key (65 bytes).

Return type:

tuple[EllipticCurvePrivateKey, bytes]

keycard.crypto.generate_pairing_token module

keycard.crypto.generate_pairing_token.generate_pairing_token(passphrase)
Return type:

bytes

Module contents