Giter Site home page Giter Site logo

8carroll / mongo-client-side-encryption Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sebsto/mongo-client-side-encryption

0.0 0.0 1.0 39 KB

a sample code to show how to use AWS KMS and IAM Roles with MongoDB Client-Side Field Level Encryption

License: Apache License 2.0

Shell 16.65% JavaScript 83.35%

mongo-client-side-encryption's Introduction

This is a sample application demonstrating MongoDB Client-Side Field Level Encryption with AWS KMS. To get started,

  1. create an AWS KMS master key (see aws_cli/kms.sh)
  2. create an AWS IAM role allowing this app to encrypt / decrypt data keys (see aws_cli/iam.sh)
  3. rename 00_sharedconst.js.SECRETS to 00_sharedconst.js
  4. update the 6 constants at the top of that file (see instructions in the file)
  5. install Nodejs dependencies (npm install)

Create a data key

node 01_createkey.js

Verify data keys

Update the 02_verifykey.js with the Base64 key id provided by the previous step

node 02_verifykey.js

Manuel field-level encryption with the data key

Encryption is explicit in the code. CSFLE-enabled MongoDB clients automatically decrypt the data.

node 03_manualEncryption.js

Automatic field-level encryption with the data key

Update the 04_automaticEncryption.js with the Base64 key id provided by the key creation step

Encryption and decyption are automatically performed by CSFLE-enabled MongoDB clients.

The driver relies on a data schema to describe what fields have to be encrypted and with which key (see 99_schemaHelper.js)

The application relies on mongocryptd daemon to be started on the same machine as the application. Please follow the MongoDB mongocryptd documentation for download and installation instructions.

 /usr/bin/mongocryptd --fork --logpath /home/ec2-user/mongocryptd.log  --pidfilepath /home/ec2-user/mongocryptd.pid
node 04_automaticEncryption.js

Errors or Feedback ?

Please raise an issue.

mongo-client-side-encryption's People

Contributors

sebsto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.