Easily Encrypt Data in Redis with Peacemakr

Photo by Joshua Aragon on Unsplash

Peacemakr introduces one simple idea: doing the right thing (encrypting your data) should be easy and fast. Peacemakr integrated the E2E-Encryption-as-a-Service directly into go-redis to protect the data before it enters the cache. Under the hood, Peacemakr uses E2E-Encryption, key lifecycle management, on-prem key ownership, and cryptoagility to protect data in Redis seamlessly.

No setup required. Their free tier provides real and lasting value.

As an example of how easy it is, just set up anEncryptingClient:

enc, err := redis.NewEncryptingClient(&redis.EncryptingClientOptions{
Options: &redis.Options{
Addr: ":6379",
DialTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
PoolSize: 10,
PoolTimeout: 30 * time.Second,
},
PeacemakrApiKey: "<your Peacemakr API key goes here>", // If you're testing locally, you can leave this empty
PeacemakrClientName: "<short name to describe your app>", // this will show up in logs on the device only
PeacemakrPersister: utils.GetDiskPersister("/tmp"), // or utils.GetInMemPersister()
})
if err != nil {
// handle err
}

And that’s pretty much it. All you have to do now is use your newfound powers to keep your data safe in Redis like so:

err := enc.EncryptSet("key", "super secret information", 10*time.Second).Err()
if err != nil {
// handle err
}val, err := enc.DecryptGet("key").Result()
if err != nil {
// handle err
}
fmt.Printf("%s", val)
// Output: super secret information

Congratulations! All done. Easy. And yes, all other Peacemakr integrated clients will be able to interact with the protected data. It’s time to pat yourself on the back for working hard to protect your most important asset: your data.

--

--

--

Ex-Apple, Director of Security Architecture at Robinhood. Lives in San Francisco. Plant-based Health Nut, Podcaster, Motorcycle Rider, Runner, and Biker

Love podcasts or audiobooks? Learn on the go with our new app.

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
Jon McLachlan

Jon McLachlan

Ex-Apple, Director of Security Architecture at Robinhood. Lives in San Francisco. Plant-based Health Nut, Podcaster, Motorcycle Rider, Runner, and Biker

More from Medium

Visualize your Solidity smart contracts

How to Setup HTTPD Web Server with custom configuration

Building a Simple Streaming Real-Time Chat App

Hands-On with REDIS | Part 2