libp2p.crypto package
Subpackages
Submodules
libp2p.crypto.authenticated_encryption module
- class libp2p.crypto.authenticated_encryption.EncryptionParameters(cipher_type: str, hash_type: str, iv: bytes, mac_key: bytes, cipher_key: bytes)
Bases:
object
- class libp2p.crypto.authenticated_encryption.MacAndCipher(parameters: EncryptionParameters)
Bases:
object
- libp2p.crypto.authenticated_encryption.initialize_pair(cipher_type: str, hash_type: str, secret: bytes) Tuple[EncryptionParameters, EncryptionParameters]
Return a pair of
Keys
for use in securing a communications channel with authenticated encryption derived from thesecret
and using the requestedcipher_type
andhash_type
.
libp2p.crypto.ecc module
- class libp2p.crypto.ecc.ECCPrivateKey(impl: int, curve: <MagicMock name='mock.curve.Curve' id='140432502522880'>)
Bases:
PrivateKey
- classmethod new(curve: str) ECCPrivateKey
- class libp2p.crypto.ecc.ECCPublicKey(impl: <MagicMock name='mock.point.Point' id='140432502538976'>, curve: <MagicMock name='mock.curve.Curve' id='140432502522880'>)
Bases:
PublicKey
- classmethod from_bytes(data: bytes, curve: str) ECCPublicKey
libp2p.crypto.ed25519 module
- class libp2p.crypto.ed25519.Ed25519PrivateKey(impl: PrivateKey)
Bases:
PrivateKey
- classmethod from_bytes(data: bytes) Ed25519PrivateKey
- classmethod new(seed: bytes | None = None) Ed25519PrivateKey
- class libp2p.crypto.ed25519.Ed25519PublicKey(impl: PublicKey)
Bases:
PublicKey
- classmethod from_bytes(key_bytes: bytes) Ed25519PublicKey
libp2p.crypto.exceptions module
- exception libp2p.crypto.exceptions.CryptographyError
Bases:
BaseLibp2pError
- exception libp2p.crypto.exceptions.MissingDeserializerError
Bases:
CryptographyError
Raise if the requested deserialization routine is missing for some type of cryptographic key.
libp2p.crypto.key_exchange module
libp2p.crypto.keys module
- class libp2p.crypto.keys.KeyPair(private_key: libp2p.crypto.keys.PrivateKey, public_key: libp2p.crypto.keys.PublicKey)
Bases:
object
- private_key: PrivateKey
- class libp2p.crypto.keys.KeyType(value)
Bases:
Enum
An enumeration.
- ECC_P256 = 4
- ECDSA = 3
- Ed25519 = 1
- RSA = 0
- Secp256k1 = 2
- class libp2p.crypto.keys.PrivateKey
Bases:
Key
A
PrivateKey
represents a cryptographic private key.
libp2p.crypto.rsa module
- class libp2p.crypto.rsa.RSAPrivateKey(impl: RsaKey)
Bases:
PrivateKey
- classmethod new(bits: int = 2048, e: int = 65537) RSAPrivateKey
- class libp2p.crypto.rsa.RSAPublicKey(impl: RsaKey)
Bases:
PublicKey
- classmethod from_bytes(key_bytes: bytes) RSAPublicKey
libp2p.crypto.secp256k1 module
- class libp2p.crypto.secp256k1.Secp256k1PrivateKey(impl: PrivateKey)
Bases:
PrivateKey
- classmethod deserialize(data: bytes) Secp256k1PrivateKey
- classmethod from_bytes(data: bytes) Secp256k1PrivateKey
- classmethod new(secret: bytes | None = None) Secp256k1PrivateKey
- class libp2p.crypto.secp256k1.Secp256k1PublicKey(impl: PublicKey)
Bases:
PublicKey
- classmethod deserialize(data: bytes) Secp256k1PublicKey
- classmethod from_bytes(data: bytes) Secp256k1PublicKey
libp2p.crypto.serialization module
- libp2p.crypto.serialization.deserialize_private_key(data: bytes) PrivateKey