Skip to main content

A Frequency-Hiding Order-Preserving Encryption scheme

Project description

Freq-OPE

A novel order-preserving encryption scheme based on this paper

Installation

Freq-OPE is written and tested in Python 3.8.

pip install freq-ope

Usage

Order-Preserving Encryption schemes are used in a client-server setting. Although designed for use in outsourced databases where we have the client and server communicating via API, this library does not provide an implementation of network communication and is provided to the user as a framework to build an API upon. That is, both the client and server are in the same system and the user needs to write API wrappers as needed for practical use cases.

Step #1: Server

Initialize the the frequency-hiding OPE server by specifying the ciphertext space as required. This is determined by the number of items the database would be expected to store.

from freq_ope.server import OPEServer

server = OPEServer(1<<8) # Setting ciphertext space as 2^8

Step #2: AES

The scheme uses an underlying AES algorithm to encrypt the ciphertexts while preserving order. Initialize an AES object with your preferred key. You can alternatively use the keygen algorithm in the package to generate a random key of needed length. This is done on the client node.

from freq_ope.key import keygen # Optional
from freq_ope.aes import AESCipher 

aes = AESCipher(keygen(128)) # Passing key of length 128

Step #3: Client

Initialize the client object by passing the AESCipher and OPEServer object. In a practical case, pass the API wrapper of the OPEServer object.

from freq_ope.client import OPEClient

client = OPEClient(aes, server)

Step #4: Add data

Add data to the server by passing the plaintexts to the client's function.

plaintexts = [320, 12, 4139, 500, 320]
for pt in plaintexts:
    client.add_plaintext(pt)

Step #5: Fetch data

As mentioned in the paper, the server stores a binary tree which is order-preserving and frequency-hiding with certain values. These values map to certain ciphertexts which is seperately kept in a dictionary. To view these, use the functions in OPEServer (Or the wrapper in an outsourced setting).

# View ciphertext tree
print(client.ope.root.inorderTraversal())

# View encrypted dictionary
print(client.ope.dct)

All the aforementioned steps can be found along with some evaluations done on this library here.

Author(s)

Yagaagowtham Palanikumar, Arizona State University

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freq_ope-1.0.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freq_ope-1.0.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file freq_ope-1.0.2.tar.gz.

File metadata

  • Download URL: freq_ope-1.0.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for freq_ope-1.0.2.tar.gz
Algorithm Hash digest
SHA256 addc5999106df662814b55b0f838312be43aeb5ce10df88d372dacfe41ec3d42
MD5 28085c2e3f6522f58fb65b6acff4dbe4
BLAKE2b-256 6d4ed609e757e0a5bf7da0b1485d4968e319f4139bb51f4ffdfbd70a9bd52846

See more details on using hashes here.

File details

Details for the file freq_ope-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: freq_ope-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for freq_ope-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 af2e848523fff376b49540978ebd1b0f8bde48a6e59cf07f072191f6be5b1af1
MD5 3814c351c73646f76cc99be7d21f5fc1
BLAKE2b-256 92993145573428bbe12473b12a29b1d9b6be996813b408a9d6eae3e1b7fe1b5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page