The Easiest Way to Encrypt in Python

Encrypting data is easy, but securing keys is very difficult. You can skim 6 Questions to Ask Before Encryption Data to get a better sense of the responsibilities that come with encrypting data.

Luckily, we can just use Peacemakr to solve these hard problems.

Peacemakr’s E2E-Encryption Python SDK

Peacemakr provides free E2E-Encryption-as-a-Service through an open-source Python SDK. Of course, it supports other languages too. Under the hood, Peacemakr uses a dedicated SaaS to provide centralized configuration management to make your E2E-Encryption simple and fast.

Peacemakr: The Easiest way to Encrypt in Python

Since the Peacemakr SDKs are open-source, you may download from the source directly on GitHub. Otherwise, just

$ pip install peacemakr

E2E-Encryption requires access to the SaaS. They have a demo APIKey to try it,

export PEACEMAKR_APIKEY=d1Maw58P2xCQ8d0GV15n22SQNI6lYXHzWLCTEvNPHnY=

When you’re ready to use your own keys, just register for a free account at https://peacemakr.io,

Before we encrypt data, we need to register a Peacemakr Client. Registering allows encryption keys to be delivered to your client. Registration requires an APIKey, client name, host, and a persister. For example,

import peacemakr as p
import peacemakr.factory as factory
api_key = "my-api-key-from-step-2-above"
persister = p.InMemoryPersister()
sdk = factory.get_crypto_sdk(api_key=api_key,
client_name="hello world",
peacemakr_hostname="https://api.peacemakr.io",
persister=persister
)
sdk.register()

Transform your data into a serialized binary format, and use peacemakr to encrypt it. When you’re ready to operate on your data again, decrypt it.

import osrandom_bytes = os.urandom(100)
encrypted_bytes = sdk.encrypt(random_bytes)
...decrypted_bytes = sdk.decrypt(encrypted_bytes)

It’s really that simple. You can read up on what is happening under the hood directly in our open source SDKs, on our website.

15+ Years experience leading security, Ex-Apple, Ex-Pure Storage, Ex-Symphony Communications, Co-Founder and CEO of Peacemakr, Lives in San Francisco.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store