API¶
cellar.cli¶
cellar.crypt¶
- class cellar.crypt.BaseCellar(key, encoder_class=<class 'nacl.encoding.URLSafeBase64Encoder'>, block_size=1048576, concurrency=100)[source]¶
Bases:
object
Main encryption class to enc/decrypt streams, files and directories. Manages the PyNaCl SecretBox/nonce/keys
- async decrypt(ciphertext, decode=True)[source]¶
Encrypts ciphertext to plaintext. By default it decodes using the URLSafeBase64Encoder Catches any errors (like bad dec key) and logs them before exiting
- async decrypt_stream(instream, outstream=<_io.BufferedWriter name='<stdout>'>, decode=False)[source]¶
Decrypts a stream and outputs it to another (default stdout)
- async encrypt(plaintext, encode=True)[source]¶
Encrypts plaintext to ciphertext. By default it encodes using the URLSafeBase64Encoder
- async encrypt_stream(instream, outstream=<_io.BufferedWriter name='<stdout>'>, encode=False)[source]¶
Encrypts a stream and outputs it to another (default stdout)
- property nonce¶
Random nonce to fix box size
- class cellar.crypt.EncryptedPathCellar(key, encoder_class=<class 'nacl.encoding.URLSafeBase64Encoder'>, block_size=1048576, concurrency=100)[source]¶
Bases:
BaseCellar
Cellar that encrypts the filenames as well as the content
- async decrypt_dir(encdir, preserve=False)[source]¶
Decrypts entire directory with all file/dir names and file content If preserve is True, encdir is preserved but by default it’s deleted
- async encrypt_dir(plaindir, preserve=False)[source]¶
Encrypts entire directory with all file/dir names and file content If preserve is True, plaindir is preserved but by default it’s deleted
- prefix = '.enc.'¶
- class cellar.crypt.OverwritePathCellar(key, encoder_class=<class 'nacl.encoding.URLSafeBase64Encoder'>, block_size=1048576, concurrency=100)[source]¶
Bases:
BaseCellar