This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This is an implementation of Boldyreva symmetric order-preserving encryption scheme (Boldyreva’s paper).

Disclaimer 1 This is a work in progress, which should be reviewed and evaluated before using in production and/or sensitive applications. If you have any concerns about used cryptographic primitives or specific implementation details, feel free to open a Github issue and we’ll discuss everything there.

Disclaimer 2 The Boldyreva scheme is not a standardized algorithm, so there are no test vectors and fixed plaintext-ciphertext mapping for a given key. It means that, generally speaking, a plaintext encrypted by two different versions of the package with the same key might not be equal to each other.

Quick examples

Quick start

from pyope.ope import OPE
cipher = OPE(b'key goes here')
assert cipher.encrypt(1000) < cipher.encrypt(2000) < cipher.encrypt(3000)
assert cipher.decrypt(cipher.encrypt(1337)) == 1337

You can specify input and output ranges. Otherwise, default input (0..2^15-1) and output (0..2^31-1) ranges are used.

from pyope.ope import OPE, ValueRange
cipher = OPE(b'long key' * 2, in_range=ValueRange(-100, 100),
                              out_range=ValueRange(0, 9999))
assert 0 < cipher.encrypt(10) < cipher.encrypt(42) < 9999

About order-preserving encryption

Order-preserving encryption (OPE) allows to compare ciphertext values in order to learn the corresponding relation between the underlying plaintexts. The algorithm implemented in this package (Boldyreva’s method) is less secure than any deterministic encryption schemes or modes (such as ECB), because this scheme is deterministic by design (i.e., for a certain key equal plaintext are always mapped to a single ciphertext value).

How can OPE be useful? For example, some systems may need OPE to perform a certain set of queries (such as range SQL queries) over encrypted data. These systems include CryptDB and Monomi to name a few.

Security

As mentioned above, security guarantees for Boldyreva’s schema are weaker than those of deterministic encryption schemes, but security can still be improved if the encryption keys are long enough. It is advised to use randomly generated keys at least 128 bits long, with the optimal size being equal to 256 bits. Keys can be longer, but it won’t improve the overall security.

Running tests

PyTest is used as a test framework. Run all tests:

$ py.test tests/

TODO

  • More tests
  • Optimize speed
  • Security guarantees
  • Test on x86
Release History

Release History

0.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyope-0.0.2.tar.gz (8.5 kB) Copy SHA256 Checksum SHA256 Source Feb 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting