3.0.ipv8.keyvault.keys ====================== .. py:module:: 3.0.ipv8.keyvault.keys Classes ------- .. autoapisummary:: 3.0.ipv8.keyvault.keys.Key 3.0.ipv8.keyvault.keys.PrivateKey 3.0.ipv8.keyvault.keys.PublicKey Module Contents --------------- .. py:class:: Key Interface for a public or private key. .. py:method:: pub() -> PublicKey :abstractmethod: Return the public key for this key material. .. py:method:: has_secret_key() -> bool :abstractmethod: Whether this key material includes a secret key. Public keys MAY also contain a private key but not the other way around. .. py:method:: key_to_bin() -> bytes :abstractmethod: Convert this key material to bytes. .. py:method:: key_to_hash() -> bytes Get the SHA-1 hash of this key. .. py:class:: PrivateKey Bases: :py:obj:`Key` Interface for a private key. .. py:method:: has_secret_key() -> bool A private key is the secret key, always True. .. py:method:: signature(msg: bytes) -> bytes :abstractmethod: Create a signature for the given data. .. py:class:: PublicKey Bases: :py:obj:`Key` Interface for a public key. .. py:method:: pub() -> PublicKey We are already the public key, return ourselves. .. py:method:: has_secret_key() -> bool By default, a public key cannot be assumed to include private key material. .. py:method:: verify(signature: bytes, msg: bytes) -> bool :abstractmethod: Verify that the given signature belongs to the given message for this public key. .. py:method:: get_signature_length() -> int :abstractmethod: Get the length (in number of bytes) for signatures generated by this type of key.