Elleptic-curve Cryptography

Interface to ECC signature algorithm and key-exchange.

pyflocker.ciphers.interfaces.ECC.generate(curve: str, *, backend: Backends | None = None) base.BaseECCPrivateKey[source]

Generate a private key with given curve curve.

Parameters:

curve – The name of the curve to use.

Keyword Arguments:

backend – The backend to use. It must be a value from Backends.

Returns:

An ECC private key.

Raises:

ValueError – if the curve is not supported by the backend or the name of the curve is invalid.

pyflocker.ciphers.interfaces.ECC.load_public_key(data: bytes, *, curve: str | None = None, backend: Backends | None = None) base.BaseECCPublicKey[source]

Loads the public key and returns a Key interface.

Parameters:
  • data – The public key (a bytes-like object) to deserialize.

  • curve – The name of the curve. Required only for SEC1 and Raw keys.

Keyword Arguments:

backend – The backend to use. It must be a value from Backends.

Returns:

An ECC public key.

pyflocker.ciphers.interfaces.ECC.load_private_key(data: bytes, passphrase: bytes | None = None, *, curve: str | None = None, backend: Backends | None = None) base.BaseECCPrivateKey[source]

Loads the private key and returns a Key interface.

If the private key was not encrypted duting the serialization, passphrase must be None, otherwise it must be a bytes object.

Parameters:
  • data – The private key (a bytes-like object) to deserialize.

  • passphrase – The passphrase (in bytes) that was used to encrypt the private key. None if the key was not encrypted.

  • curve – The name of the curve. Required only for Raw keys.

Keyword Arguments:

backend – The backend to use. It must be a value from Backends.

Returns:

An ECC Private key.