latest.ipv8.keyvault.public.m2crypto

Module Contents

Classes

M2CryptoPK

A pyca implementation of a public key, backwards compatible with Dispersy M2Crypto public keys.

class latest.ipv8.keyvault.public.m2crypto.M2CryptoPK(ec_pub: cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey | None = None, keystring: bytes | None = None)

Bases: latest.ipv8.keyvault.keys.PublicKey

A pyca implementation of a public key, backwards compatible with Dispersy M2Crypto public keys.

pem_to_bin(pem: bytes) bytes

Convert a key in the PEM format into a key in the binary format. @note: Encrypted pem’s are NOT supported and will silently fail.

key_to_pem() bytes

Convert a key to the PEM format.

key_from_pem(pem: bytes) cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey | cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey

Get the EC from a public PEM.

key_to_bin() bytes

Get the string representation of this key.

get_signature_length() int

Returns the length, in bytes, of each signature made using EC.

verify(signature: bytes, msg: bytes) bool

Verify whether a given signature is correct for a message.

Parameters:
  • signature – the given signature

  • msg – the given message