Python: module cryptsql

cryptsql | index /tmp/makerelease-pwman-python.sqFeT8RO/pwman-python-2.13/libpwman/cryptsql.py

# Crypto SQL
# Copyright (c) 2011-2024 Michael Büsch <m@bues.ch>
# Licensed under the GNU/GPL version 2 or later.

Modules
functools hashlib | math os | re secrets | sqlite3 zlib

Classes
|  | builtins.Exception(builtins.BaseException) CSQLError builtins.object CryptSQL
class CSQLError(builtins.Exception)
| CryptSQL exception.
| Method resolution order: CSQLError builtins.Exception builtins.BaseException builtins.object Data descriptors defined here: __weakref__ list of weak references to the object Methods inherited from builtins.Exception: __init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. Static methods inherited from builtins.Exception: __new__(*args, **kwargs) class method of builtins.Exception Create and return a new object. See help(type) for accurate signature. Methods inherited from builtins.BaseException: __getattribute__(self, name, /) Return getattr(self, name). __reduce__(self, /) Helper for pickle. __repr__(self, /) Return repr(self). __setstate__(self, object, /) __str__(self, /) Return str(self). add_note(self, object, /) Exception.add_note(note) -- add a note to the exception with_traceback(self, object, /) Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self. Data descriptors inherited from builtins.BaseException: __cause__ exception cause __context__ exception context __dict__ __suppress_context__ __traceback__ args
class CryptSQL(builtins.object)
| CryptSQL(readOnly=True) Encrypted SQL database.
| Methods defined here: DEFAULT_KDF_ITER lambda kdfMem KDF_ITERLIMIT_A lambda kdfMem __init__(self, readOnly=True) readOnly: If True, no commit is possible. close(self) Close the currently opened database. This does not commit. All uncommitted changes are lost. commit(self) Write all changes to the encrypted database file. dropAllTables(self) Drop all tables from the database. dropUncommitted(self) Drop all changes that are not committed, yet. getFilename(self) Get the file path of the currently open database. May return None, if no database file is opened. getKey(self) Get the raw key. May be None, if there is none, yet. Do not use this. getPassphrase probably is what you want. getPassphrase(self) Get the current passphrase string for encryption and decryption. importSqlScript(self, script, clear=True) Imports a plain text dump into the database. script: The script string to import. clear: If True, drop all tables from the database before importing. isOpen(self) Returns True, if a database file is opened. open(self, filename) Open a database file and decrypt its contents into memory. filename: The database file path. setKey(self, key) Set the raw key. Do not use this. setPassphrase probably is what you want. setPassphrase(self, passphrase) Set a new passphrase string for encryption and decryption. setRegexpFlags(self, search=True, ignoreCase=True, multiLine=True, dotAll=True) Change the behavior of the REGEXP operator. sqlCreateFunction(self, name, nrParams, func) Create an SQL function. See sqlite3.Connection.create_function for more details. sqlExec(self, code, params=[]) Execute one SQL statement. sqlExecScript(self, code) Execute multiple SQL statements. Warning: This implicitly commits pending transactions before executing. sqlIsEmpty(self) Returns True, if the database does not contain any tables. sqlPlainDump(self) Get a plain text dump of the database. Returns bytes. sqlVacuum(self) Run the SQL VACUUM statement. This also commits all changes to the SQL database, but not to the database file. Data descriptors defined here: __dict__ dictionary for instance variables __weakref__ list of weak references to the object Data and other attributes defined here: CSQL_HEADER = b'CryptSQL v1' DEFAULT_KDF_MEM = 131096 KDF_ITERLIMIT_B = 2 KDF_MEMLIMIT = 24584 KDF_MEM_BASE = 131072 KDF_MEM_CHUNK = 28 KDF_SALT_NBYTES = 19 KDF_THREADS = 7

Data
|  | __all__ = ['CSQLError', 'CryptSQL']