cryptsql
index
/tmp/makerelease-pwman-python.grjbw8ep/pwman-python-2.10/libpwman/cryptsql.py

# Crypto SQL
# Copyright (c) 2011-2023 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 (if defined)

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) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Methods inherited from builtins.BaseException:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__reduce__(...)
Helper for pickle.
__repr__(self, /)
Return repr(self).
__setattr__(self, name, value, /)
Implement setattr(self, name, value).
__setstate__(...)
__str__(self, /)
Return str(self).
add_note(...)
Exception.add_note(note) --
add a note to the exception
with_traceback(...)
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 (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
CSQL_HEADER = b'CryptSQL v1'
DEFAULT_KDF_MEM = 24584
KDF_ITERLIMIT_B = 2
KDF_MEMLIMIT = 24584
KDF_MEM_BASE = 24576
KDF_MEM_CHUNK = 28
KDF_SALT_NBYTES = 19
KDF_THREADS = 7

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