Code Monkey home page Code Monkey logo

sqlcipher3's People

Contributors

boldx avatar coleifer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sqlcipher3's Issues

(win32) ImportError: DLL load failed while importing _sqlite3

I built the package using python setup.py build_static build, and installed with python setup.py install. However, then I get the error in my code:

In [1]: import sqlcipher3
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import sqlcipher3

File ~\virtualenvs\dbstuff\lib\site-packages\sqlcipher3-0.4.5-py3.10-win-amd64.egg\sqlcipher3\__init__.py:23, in <module>
      1 # pysqlite2/__init__.py: the pysqlite2 package.
      2 #
      3 # Copyright (C) 2005 Gerhard Haring <[email protected]>
   (...)
     20 #    misrepresented as being the original software.
     21 # 3. This notice may not be removed or altered from any source distribution.
---> 23 from sqlcipher3.dbapi2 import *

File ~\virtualenvs\dbstuff\lib\site-packages\sqlcipher3-0.4.5-py3.10-win-amd64.egg\sqlcipher3\dbapi2.py:28, in <module>
     25 import time
     26 import collections.abc
---> 28 from sqlcipher3._sqlite3 import *
     30 paramstyle = "qmark"
     32 threadsafety = 1

ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.

To rule out possibility of missing a dependency at loading time, I see that this _sqlite3....pyd file is the "DLL" that gets bundled into the egg to install:

./build
├───bdist.win-amd64
└───lib.win-amd64-3.10
    └───sqlcipher3
            dbapi2.py
            _sqlite3.cp310-win_amd64.pyd
            __init__.py

and it appears to depend on these other DLLs, which are all visible in PATH environment variable when I start python:

  • libcrypto-3-x64.dll from OpenSSL
  • python310.dll from python (must not install python from Microsoft Store)

Sorry to bring another question from Windows 10. I am using python 3.10.3 and MSVC 2017. Any thoughts?

Can not install sqlcipher3 and sqlcipher3-binary on Windows 10

Windows 10
$ uname -a

MINGW64_NT-10.0 ASUSPRO 2.8.0(0.309/5/3) 2017-03-21 14:04 x86_64 Msys

$ python --version

Python 3.8.1

$ pip install --verbose sqlcipher3-binary

Using pip 20.2.2 from c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip (python 3.8)
Non-user install because site-packages writeable
Created temporary directory: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-ephem-wheel-cache-nbz9j5ln
Created temporary directory: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-req-tracker-wa5nlf62
Initialized build tracking at C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-req-tracker-wa5nlf62
Created build tracker: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-req-tracker-wa5nlf62
Entered build tracker: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-req-tracker-wa5nlf62
Created temporary directory: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-k3jdfzu0
1 location(s) to search for versions of sqlcipher3-binary:
* https://pypi.org/simple/sqlcipher3-binary/
Fetching project page and analyzing links: https://pypi.org/simple/sqlcipher3-binary/
Getting page https://pypi.org/simple/sqlcipher3-binary/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/sqlcipher3-binary/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/sqlcipher3-binary/ HTTP/1.1" 304 0
  Skipping link: none of the wheel's tags match: cp36-cp36m-manylinux1_x86_64: https://files.pythonhosted.org/packages/eb/90/5fdfa3964da4ce7a9b1c2c0f5a1bdcca0e066a14d569e51e0c435a68c06f/sqlcipher3_binary-0.4.0-cp36-cp36m-manylinux1_x86_64.whl#sha256=605ea555a3c7e45ce99376e122ac4cc0e237e43503bbd2bdcd3149c86b3d863d (from https://pypi.org/simple/sqlcipher3-binary/)
  Skipping link: none of the wheel's tags match: cp37-cp37m-manylinux1_x86_64: https://files.pythonhosted.org/packages/e9/00/3902cc32812262c29a43389a269340b2fc3fc85e132fab8c1864e355b7fb/sqlcipher3_binary-0.4.0-cp37-cp37m-manylinux1_x86_64.whl#sha256=73b131e5d62c2776c98bf48e8096407a9febce7386d0b5a772e1a6449e85cc18 (from https://pypi.org/simple/sqlcipher3-binary/)
  Skipping link: none of the wheel's tags match: cp36-cp36m-manylinux1_x86_64: https://files.pythonhosted.org/packages/be/e1/dcb2e23ebd43de1b6a6cde9594343773940eb295f980d47440704a3f9b8a/sqlcipher3_binary-0.4.1-cp36-cp36m-manylinux1_x86_64.whl#sha256=4c7814578ce63ea02647018220ccfae01c56d98e6890b360e71268e9af426fdd (from https://pypi.org/simple/sqlcipher3-binary/)
  Skipping link: none of the wheel's tags match: cp37-cp37m-manylinux1_x86_64: https://files.pythonhosted.org/packages/26/9c/ab66288cd139c5a4f94451d6b5d6cc58d7c55f65bbafd244717f8171694a/sqlcipher3_binary-0.4.1-cp37-cp37m-manylinux1_x86_64.whl#sha256=308935b35fb62d5d1483e98b0fb4df63e5bad0db1818ccd717eabd0f869f0ff3 (from https://pypi.org/simple/sqlcipher3-binary/)
  Skipping link: none of the wheel's tags match: cp38-cp38-manylinux1_x86_64: https://files.pythonhosted.org/packages/76/17/93eefc6464a281ea760eb5626414c5a6a701ed576a9f8a057fe2e7131b2b/sqlcipher3_binary-0.4.1-cp38-cp38-manylinux1_x86_64.whl#sha256=7d7b6d7e6a82cdea1b795237690fa2c15505a8ab39a44a83dea2312fd5f37873 (from https://pypi.org/simple/sqlcipher3-binary/)
  Skipping link: none of the wheel's tags match: cp36-cp36m-manylinux1_x86_64: https://files.pythonhosted.org/packages/c8/61/27c19addd4b47365702ab499d74ba6a931ee2ebd4489ff38d572f109f6a2/sqlcipher3_binary-0.4.2-cp36-cp36m-manylinux1_x86_64.whl#sha256=52969904c63197a8e4656b50838d7a1cdc374194667c126e5f0a558c4b206b8b (from https://pypi.org/simple/sqlcipher3-binary/)
  Skipping link: none of the wheel's tags match: cp37-cp37m-manylinux1_x86_64: https://files.pythonhosted.org/packages/c2/2a/f5128808a93fd26e5f604f200f22944897c00e93af21927e6770c20c6b96/sqlcipher3_binary-0.4.2-cp37-cp37m-manylinux1_x86_64.whl#sha256=816df8036305cfad27c6ad6c4a4ebfd29fbe7a7364d959588b6dbd29bce69dc0 (from https://pypi.org/simple/sqlcipher3-binary/)
  Skipping link: none of the wheel's tags match: cp38-cp38-manylinux1_x86_64: https://files.pythonhosted.org/packages/b9/a3/0ff5eb964274c3d9de8826e64ce7d6910b57d61c675f604920fd2d2c1fbd/sqlcipher3_binary-0.4.2-cp38-cp38-manylinux1_x86_64.whl#sha256=1f95560820f7495af8a4cd24bc7dab4ec1144b6eae6acd8295a2b569fe81609b (from https://pypi.org/simple/sqlcipher3-binary/)
Given no hashes to check 0 links for project 'sqlcipher3-binary': discarding no candidates
ERROR: Could not find a version that satisfies the requirement sqlcipher3-binary (from versions: none)
ERROR: No matching distribution found for sqlcipher3-binary
Exception information:
Traceback (most recent call last):
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\base_command.py", line 216, in _main
    status = self.run(options, args)
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\install.py", line 324, in run
    requirement_set = resolver.resolve(
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 183, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 388, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 339, in _get_abstract_dist_for
    self._populate_link(req)
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 305, in _populate_link
    req.link = self._find_requirement_link(req)
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 270, in _find_requirement_link
    best_candidate = self.finder.find_requirement(req, upgrade)
  File "c:\users\flaboy\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\index\package_finder.py", line 926, in find_requirement
    raise DistributionNotFound(
pip._internal.exceptions.DistributionNotFound: No matching distribution found for sqlcipher3-binary
Removed build tracker: 'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-req-tracker-wa5nlf62'

$ pip list

Package        Version
-------------- ---------
atomicwrites   1.4.0
attrs          19.3.0
colorama       0.4.3
iniconfig      1.0.1
more-itertools 8.4.0
packaging      20.4
pip            20.2.2
pluggy         0.13.1
py             1.9.0
pyparsing      2.4.7
pytest         6.0.1
setuptools     41.2.0
six            1.15.0
toml           0.10.1
wheel          0.35.0

Unable to build (Win10) against amalgamation

Hi, when I try to build this against sqlcipher amalgamation this error is returned:

C:\dev\py\sqlcipher3# setup.py build_static build
running build_static
Builds a C extension using a sqlcipher amalgamation
building 'sqlcipher3._sqlite3' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMODULE_NAME="sqlcipher3.dbapi2" -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_LOAD_EXTENSION=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_HAS_CODEC=1 -DSQLITE_SOUNDEX=1 -DSQLITE_USE_URI=1 -DSQLITE_TEMP_STORE=2 -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_CACHE_SIZE=-8000 -Dinline=__inline -I. -IC:\OpenSSL-Win64\include -IC:\Python\include -IC:\Python\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tc.\sqlite3.c /Fobuild\temp.win-amd64-3.9\Release.\sqlite3.obj
sqlite3.c
.\sqlite3.c(24335): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMODULE_NAME="sqlcipher3.dbapi2" -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_LOAD_EXTENSION=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_HAS_CODEC=1 -DSQLITE_SOUNDEX=1 -DSQLITE_USE_URI=1 -DSQLITE_TEMP_STORE=2 -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_CACHE_SIZE=-8000 -Dinline=__inline -I. -IC:\OpenSSL-Win64\include -IC:\Python\include -IC:\Python\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tcsrc\blob.c /Fobuild\temp.win-amd64-3.9\Release\src\blob.obj
blob.c
src\blob.c(178): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(359): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(386): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(408): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(421): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(421): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(439): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(439): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(508): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(536): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(550): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(550): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(574): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(574): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\blob.c(638): error C2017: illegal escape sequence
src\blob.c(638): error C2224: left of '.Blob' must have struct/union type
src\blob.c(638): error C2001: newline in constant
src\blob.c(638): error C2059: syntax error: 'string'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe' failed with exit code 2

Can someone help me to proceed?
Thank you

M1 Mac install issues

having issues installing this from source on an M1 Mac

running python setup.py build seems to fail silently, it just outputs

running build
running build_py
running build_ext
Builds a C extension linking against libsqlcipher library

and then python setup.py install succeeds but I get

>>> import sqlcipher3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/daryldrake/sandbox/repos/sqlcipher3/sqlcipher3/__init__.py", line 23, in <module>
    from sqlcipher3.dbapi2 import *
  File "/Users/daryldrake/sandbox/repos/sqlcipher3/sqlcipher3/dbapi2.py", line 28, in <module>
    from sqlcipher3._sqlite3 import *
ModuleNotFoundError: No module named 'sqlcipher3._sqlite3'

I tried using arm and x86 home-brew installs of sqlcipher with arm / x86 conda envs

PR for building wheels and other improvements

I have created a fork: https://github.com/laggykiller/sqlcipher3

What is improved:

  • Using conan to install openssl (dependency of sqlcipher)
  • Building with sqlcipher version 4
  • Building without scripts in build-scripts, reducing code to maintain
  • Compatibility with openssl3
  • Including amalgamation files (sqlite3.c and sqlite3.h) in sdist that is uploaded to pypi
  • Workflow
    • Building wheels for Windows, MacOS and Linux with cibuildwheels. All architectures supported by cibuildwheel should be working (x86_64, i686, aarch64, ppc64le, s390x)
    • Test wheels and source distribution
    • Auto upload wheels to pypi (PYPI_API_TOKEN need to be added in repository secrets)
  • Using the more modren pyproject.toml
    • Specifies build time requirements in pyproject.toml so that they don't have to be explicitly installed using pip before building
    • Note that name, version, package_dir and packages need not to be specified in setup.py if they are specified in pyproject.toml but they are kept or else python <= 3.6 wheel building would fail
  • Rename python test scripts to test_*.py for running python -m unittest easily

Note that I referenced with this fork that improved on pysqlite3 (https://github.com/Dobatymo/pysqlite3). See if you also want to get a PR from there for pysqlite3.

Here is the diff: master...laggykiller:sqlcipher3:master

I have uploaded the wheels to pypi: https://pypi.org/project/sqlcipher3-wheels

If you are interested in PR, please tell me what improvements you want and don't want, then I will open a PR.

If you are not interested in PR, I can just maintain sqlcipher3-wheels

Unable to use binary package

I am on Ubuntu 20.04 (Python 3.8.10) and unable to get the self contained binary to work with the following errors showing up after installing it via pip and running the application:

sqlcipher3.dbapi2.DatabaseError: file is not a database
peewee.DatabaseError: file is not a database

I can get it to work by building it manually - let me know if there's anything more I can supply.

Unable to install/build on MacOs Catalina

Hi there!

I am unable to install or build sqlcipher3 on MacOS Catalina:

$ pip3 install sqlcipher3
Collecting sqlcipher3
  Using cached sqlcipher3-0.4.5.tar.gz (40 kB)
Building wheels for collected packages: sqlcipher3
  Building wheel for sqlcipher3 (setup.py) ... done
  WARNING: Legacy build of wheel for 'sqlcipher3' created no files.
  Command arguments: /Users/gab/Downloads/sqlcipher3/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2x/wsnpz9qn5yvgzb_ltwdqxlbr0000gn/T/pip-install-yoi7anpz/sqlcipher3_556d7fa11b234721a48e3cbd3a094afa/setup.py'"'"'; __file__='"'"'/private/var/folders/2x/wsnpz9qn5yvgzb_ltwdqxlbr0000gn/T/pip-install-yoi7anpz/sqlcipher3_556d7fa11b234721a48e3cbd3a094afa/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/2x/wsnpz9qn5yvgzb_ltwdqxlbr0000gn/T/pip-wheel-o_0xgx1h
  Command output: [use --verbose to show]
  Running setup.py clean for sqlcipher3
Failed to build sqlcipher3                                         <--------- HERE
Installing collected packages: sqlcipher3
    Running setup.py install for sqlcipher3 ... done
Successfully installed sqlcipher3
$ pip3 install sqlcipher3-binary
ERROR: Could not find a version that satisfies the requirement sqlcipher3-binary
ERROR: No matching distribution found for sqlcipher3-binary
$ 

I tried building from sources but it fails because of fatal error: 'sqlcipher/sqlite3.h' file not found:

(venv) ~/Downloads/sqlcipher3 (master)$ python3 setup.py build
running build
running build_py
running build_ext
Builds a C extension linking against libsqlcipher library
building 'sqlcipher3._sqlite3' extension
xcrun -sdk macosx clang -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Qunused-arguments -DMODULE_NAME="sqlcipher3.dbapi2" -I/usr/include -I/Users/gab/Downloads/sqlcipher3/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/include/python3.7m -c src/module.c -o build/temp.macosx-10.14-x86_64-3.7/src/module.o
In file included from src/module.c:24:
src/connection.h:34:10: fatal error: 'sqlcipher/sqlite3.h' file not found
#include "sqlcipher/sqlite3.h"
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'xcrun' failed with exit status 1
(venv) ~/Downloads/sqlcipher3 (master)$ 

sqlcipher is installed:

$ brew install sqlcipher
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 2 casks.

Warning: sqlcipher 4.4.2 is already installed and up-to-date
To reinstall 4.4.2, run `brew reinstall sqlcipher`
$ 
$ sqlcipher --version
3.33.0 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0alt1 (SQLCipher 4.4.2 community)
$ 

Would you be able to provide any guidance to help resolve this?

We are trying to remove the dependency on pysqlcipher3 here gabfl/vault#58 and replace it with your project instead. See also sqlalchemy/sqlalchemy#5848

Known vulnerabilities in the C library openssl which sqlcipher3 depends on. Can you help upgrade to patch versions?

Hi, @coleifer, @boldx , I'd like to report a vulnerability issue in sqlcipher3-binary_0.4.5.

Dependency Graph between Python and Shared Libraries

image

Issue Description

As shown in the above dependency graph, sqlcipher3-binary_0.4.5 directly or transitively depends on 2 C libraries (.so). However, I noticed that a C library is vulnerable, containing the following CVEs:
libcrypto-44dc4d8b.so.1.1.1b from C project openssl(version:1.1.1) exposed 9 vulnerabilities:
CVE-2021-3711,CVE-2021-3712,CVE-2019-1549, CVE-2019-1543,CVE-2018-0735,CVE-2020-7041, CVE-2020-7043,CVE-2020-7042,CVE-2019-1552

Furthermore, the vulnerable methods in these vulnerable shared libraries can be actually invoked by Python code.
For instance, the following call chain starting from SSL_CTX_load_verify_locations() can reach the vulnerable method EC_GROUP_new_from_ecparameters() <EC_GROUP *EC_GROUP_new_from_ecparameters (const ECPARAMETERS *params) in crypto/ec/ec_asn1.c reported by CVE-2021-3712:

call chain -----
SSL_CTX_load_verify_locations() -> X509_STORE_load_locations() -> X509_STORE_add_lookup() -> STACK_OF() -> PEM_X509_INFO_read_bio() -> d2i_ECPrivateKey() -> EC_GROUP_new_from_ecpkparameters() -> EC_GROUP_new_from_ecparameters()

Suggested Vulnerability Patch Versions

openssl has fixed the vulnerabilities in versions >=1.1.1l

Python build tools cannot report vulnerable C libraries, which may induce potential security issues to many downstream Python projects.
As a popular python package (sqlcipher3-binary has 3,693 downloads per month), could you please upgrade the above shared libraries to their patch versions?

Thanks for your help~
Best regards,
Andy

INSERTs don't persist?

I have v0.4.5, and I find that after inserting some rows, then closing and re-opening the database, my table is empty. This problem doesn't appear when I use the sqlcipher command-line utility itself.

from sqlcipher3 import dbapi2 as sqlcipher

db = sqlcipher.connect('testing.db')
db.execute('pragma key="testing"')
db.execute("create table people (name text primary key)")
db.execute("insert into people (name) values ('charlie'), ('huey')")
print(db.execute('select * from people').fetchall())
# => [('charlie',), ('huey',)]
db.close()

db = sqlcipher.connect('testing.db')
db.execute('pragma key="testing"')
print(db.execute('select * from people').fetchall())
db.close()
# => []

Am I missing something here?

Python 3.10 support

Hi, thanks for you work!

Just thinking if you can update sqlcipher3 and sqlcipher3-binary to work with python 3.10 (and probably 3.11)

ModuleNotFoundError

Followed the instructions to clone then build but am getting this error when I try to import in the python shell:
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from sqlcipher3 import dbapi2 as sqlcipher
Traceback (most recent call last):
File "", line 1, in
File "/home/sqlcipher3/sqlcipher3/init.py", line 23, in
from sqlcipher3.dbapi2 import *
File "/home/sqlcipher3/sqlcipher3/dbapi2.py", line 28, in
from sqlcipher3._sqlite3 import *
ModuleNotFoundError: No module named 'sqlcipher3._sqlite3'

Is some dependency missing from the build?

Error: file is encrypted or is not a database

Hi,
I created a simple Python app with

Flask==2.0.1
Flask-SQLAlchemy==2.5.1
SQLAlchemy==1.4.22
sqlcipher3-binary==0.4.5
and the configuration
BASEDIR = os.path.abspath(os.path.dirname(file))
SQLALCHEMY_DATABASE_URI = 'sqlite+pysqlcipher://:passphrase@/' + BASEDIR + '/db1.sqlite'
I tries to use sqlcipher 3.15.2 in order to check the content of the database with or without a passphrase.

Without the passphrase, the database is not ciphered and I can show the schema of the database for example.
With the passphrase, I defined the passphrase with the pragma command "PRAGMA key='passphrase';" but sqlcipher returns the following error :
Error: file is encrypted or is not a database

I tried cipher a base directly with sqlcipher and I'm able to check the passphrase without no problem.

Would you please helpl me to understand the problem and solve it ?
Best regards,
Franck

ImportError: symbol not found in flat namespace '_ERR_error_string'

I'm trying to use sqlcipher3 on my mac. I've installed SQLCipher using Homebrew and the sqlcipher3 Python package via pip. However, when I attempt to import sqlcipher3 using the following code:

from sqlcipher3 import dbapi2

I encounter the following error:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sqlcipher3-0.5.2-py3.10-macosx-10.9-universal2.egg/sqlcipher3/_sqlite3.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_ERR_error_string'

Here are the steps I've followed so far:

Installed SQLCipher using Homebrew:

brew install sqlcipher

Installed sqlcipher3 using pip:

pip install sqlcipher3

Reinstalled sqlcipher3:

pip install --no-cache-dir --force-reinstall sqlcipher3

Despite these steps, I still receive the ImportError mentioned above.

cl.exe' failed with exit code 2 , “sqlcipher/sqlite3.h”: No such file or directory

WIN11
anaconda python 3.7
Microsoft Visual Studio 2019

 python setup.py build
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-37
creating build\lib.win-amd64-cpython-37\sqlcipher3
copying sqlcipher3\dbapi2.py -> build\lib.win-amd64-cpython-37\sqlcipher3
copying sqlcipher3\__init__.py -> build\lib.win-amd64-cpython-37\sqlcipher3
running build_ext
Builds a C extension linking against libsqlcipher library
building 'sqlcipher3._sqlite3' extension
creating build\temp.win-amd64-cpython-37
creating build\temp.win-amd64-cpython-37\Release
creating build\temp.win-amd64-cpython-37\Release\src
"D:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DMODULE_NAME=\\\"sqlcipher3.dbapi2\\\" -I/usr/include -ID:\Anaconda3\envs\UnsupDIS\include -ID:\Anaconda3\envs\UnsupDIS\Include "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include" "-ID:\Windows Kits\10\include\10.0.19041.0\ucrt" "-ID:\Windows Kits\10\include\10.0.19041.0\shared" "-ID:\Windows Kits\10\include\10.0.19041.0\um" "-ID:\Windows Kits\10\include\10.0.19041.0\winrt" "-ID:\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc\blob.c /Fobuild\temp.win-amd64-cpython-37\Release\src\blob.obj
blob.c
D:\0SDXX\sqlcipher3-master\src\blob.h(4): fatal error C1083:  “sqlcipher/sqlite3.h”: No such file or directory
error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

Used as drop-in replacement for aio module.

Thanks for your awesome module. This is a general notice that I used it as a drop-in replacement for sqlite3 in a fork of aiosqlite. Fork resides here: aiosqlcipher.

This is just in hopes that you can keep it compatible as a drop-in replacement that works with asyncio, as demonstrated. Maybe a test could be added for it. Up to you.

Thanks again.

Support 32-Bit Architecture

I use this library in a project and I realized that is x64 only.
Would be possible to provide a 32-Bit version?

Can't open database file with sqlitebrowser

when i use sqlcipher3 with peewee i cant open database with other sqlite3 clients.
i tried SqlCipher3 defaults and SqlCipher4 defaults.(i used sqlitebrowser[stable])

when i use pysqlcipher3 with peewee i can open database with sqlitebrowser.

db = SqlCipherDatabase(
    'testsqlcipher.db',
    passphrase=enc_pass,
    pragmas={
        'journal_mode': 'wal',
        'cache_size': -1 * 64_000,  # 64MB
        'foreign_keys': 1,
        'ignore_check_constraints': 0,
        'synchronous': 0,
    },
)

and also what is the differences between sqlcipher-binary and pysqlcipher3 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.