Encrypter module

class Encrypter.Encrypter(logger, encryption_key, config_directory, peer_id=None, store_id=None)
static compute_safe_filename(input_string)

Take any string of characters (e.g. the result of a SHA hash) and reversibly convert it to a valid filename.

decrypt(ciphertext)

Decrypt AES-encrypted data.

decrypt_filename(safe_encrypted_filename)
decrypt_own_store_path(encrypted_relative_path)

Convert an encrypted, store-relative path to its original form.

encrypt(plaintext)

Deterministically encrypt the input string using AES.

encrypt_filename(filename)
static generate_encryption_key()
generate_peer_id()

Generate a quasi-unique ID for this peer using a hash (SHA-256, which currently has no known collisions) of the owner’s public key “salted” with 32 random bits.

generate_store_id(public_key=None)

Store IDs are meant to uniquely identify a store/user. They are essentially the RSA public key, but we use use their SHA-256 hash to “flatten” them to a shorter, predictable length.

get_signed_revision_data(revision_number, store_hash)

A convenience function for adding a signature to generated revision data.

load_peer_key(peer_id)

Convenience function to load a peer’s public key.

static load_private_key(config_directory)
classmethod load_public_key(config_directory, private_key=None)
load_store_key(store_id)

Convenience function to load a store’s public key .

sign(payload)

Convenience primative for computing a signature for any string.

store_id
verify(store_id, signature, payload)

Convenience primative for verifying the signature associated with a string.

verify_revision_data(store_id, revision_data)

Verify the validity and signature of revision data.

Previous topic

DirectoryMerkleTree module

Next topic

Logger module

This Page