The Artima Developer Community
Sponsored Link

Python Buzz Forum
PySQLcrypt

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ng Pheng Siong

Posts: 410
Nickname: ngps
Registered: Apr, 2004

Ng Pheng Siong is just another guy with a website.
PySQLcrypt Posted: Dec 3, 2004 6:05 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ng Pheng Siong.
Original Post: PySQLcrypt
Feed Title: (render-blog Ng Pheng Siong)
Feed URL: http://sandbox.rulemaker.net/ngps/rdf10_xml
Feed Description: Just another this here thing blog.
Latest Python Buzz Posts
Latest Python Buzz Posts by Ng Pheng Siong
Latest Posts From (render-blog Ng Pheng Siong)

Advertisement

PySQLcrypt is an enhanced version of PySQLite that uses SQLcrypt, which itself enhances SQLite version 3 with transparent AES encryption.

This demo distribution for Windows is built from the trial version of SQLcrypt and contains the following files:

_sqlcrypt.pyd            
sqlcrypt/*.py            
crypt_test.py            
crypt_dbapi_txns.py

First, copy _pysqlcrypt.pyd and sqlcrypt/*.py into your Python installation's site-packages.

Next, run the unit tests in crypt_test.py:

  C:\> python crypt_test.py
  .........
  ----------------------------------------------------------------------
  Ran 9 tests in 0.660s

  OK

Now try out crypt_dbapi_txns.py. This program is based on dbapi_transactions.py from PySQLite, with the following changes: (1) the database file, 'customerdb', is encrypted; (2) at the end of the program run, the database content is not cleared.

  C:\> python crypt_dbapi_txns.py

  C:\> sqlcrypt3 customerdb
  SQLcrypt version 3.0.7
  Enter ".help" for instructions
  sqlcrypt> .decrypt abcdefgh
  sqlcrypt> .tables
  customer  orders
  sqlcrypt> select * from customer;
  1|Jane|Doe|JD0001
  sqlcrypt> select * from orders;
  1|1|White Towel|2
  2|1|Blue Cup|5
  sqlcrypt> ^Z

  C:\> sqlite3 customerdb "select * from orders"
  SQL error: file is encrypted or is not a database

  C:\> python
  Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sqlcrypt
  >>> sqlcrypt.license_key('ZIHKBLID-IACHUSSU-JUPOTCNF-CXYOQSFE')
  >>> cnx = sqlcrypt.connect('customerdb')
  >>> cnx.passphrase('abcdefgh', 0)
  >>> cu = cnx.cursor()
  >>> cu.execute('select * from orders')
  >>> print cu.fetchall()
  [(1, 1, 'White Towel', 2), (2, 1, 'Blue Cup', 5)]
  >>>

To play, download PySQLcrypt for Python 2.3 (Windows) and the SQLcrypt trial version Windows installer.

Read: PySQLcrypt

Topic: 26 Nov 2004 Previous Topic   Next Topic Topic: 16 Nov 2004

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use