3.0.ipv8.keyvault.crypto ======================== .. py:module:: 3.0.ipv8.keyvault.crypto Attributes ---------- .. autoapisummary:: 3.0.ipv8.keyvault.crypto._CURVES 3.0.ipv8.keyvault.crypto.logger 3.0.ipv8.keyvault.crypto.default_eccrypto Classes ------- .. autoapisummary:: 3.0.ipv8.keyvault.crypto.ECCrypto Module Contents --------------- .. py:data:: _CURVES :type: dict[str, tuple[cryptography.hazmat.primitives.asymmetric.ec.EllipticCurve | None, str]] .. py:data:: logger .. py:class:: ECCrypto A crypto object which provides a layer between Dispersy and low level eccrypographic features. Most methods are implemented by: @author: Boudewijn Schoon @organization: Technical University Delft @contact: dispersy@frayja.com However since then, most functionality was completely rewritten by: @author: Niels Zeilemaker .. py:property:: security_levels :type: list[str] Returns the names of all available curves. .. py:method:: generate_key(security_level: str) -> 3.0.ipv8.types.PrivateKey Generate a new Elliptic Curve object with a new public / private key pair. Security can be u'low', u'medium', or u'high' depending on how secure you need your Elliptic Curve to be. Currently these values translate into: - very-low: NID_sect163k1 ~42 byte signatures - low: NID_sect233k1 ~60 byte signatures - medium: NID_sect409k1 ~104 byte signatures - high: NID_sect571r1 ~144 byte signatures Besides these predefined curves, all other curves provided by M2Crypto are also available. For a full list of available curves, see ec_get_curves(). @param security_level: Level of security {u'very-low', u'low', u'medium', or u'high'}. @type security_level: unicode .. py:method:: key_to_bin(ec: 3.0.ipv8.keyvault.keys.Key) -> bytes Convert the key to a binary format. .. py:method:: key_to_hash(ec: 3.0.ipv8.keyvault.keys.Key) -> bytes Get a hash representation from a key. .. py:method:: is_valid_private_bin(string: bytes) -> bool Returns True if the input is a valid public/private keypair stored in a binary format. .. py:method:: is_valid_public_bin(string: bytes) -> bool Returns True if the input is a valid public key. .. py:method:: key_from_private_bin(string: bytes) -> 3.0.ipv8.types.PrivateKey Get the EC from a public/private keypair stored in a binary format. .. py:method:: key_from_public_bin(string: bytes) -> 3.0.ipv8.types.PublicKey Get the EC from a public key in binary format. .. py:method:: get_signature_length(ec: 3.0.ipv8.types.PublicKey) -> int Returns the length, in bytes, of each signature made using EC. .. py:method:: create_signature(ec: 3.0.ipv8.types.PrivateKey, data: bytes) -> bytes Returns the signature of DIGEST made using EC. .. py:method:: is_valid_signature(ec: 3.0.ipv8.types.PublicKey, data: bytes, signature: bytes) -> bool Returns True when SIGNATURE matches the DIGEST made using EC. .. py:data:: default_eccrypto