Git Product home page Git Product logo

keystore's Introduction

Keystore - keeps your keys in one place.

THIS IS AN EXPERIMENT [DO NOT USE IN PRODUCTION]

Encrypt your keys before syncing them to a local backup, or "the cloud".

Download it later and decrypt it yourself.

$ keystore-save
$ mkdir keys
$ keystore-load --copy-to keys

Prerequisites

Python 3.4+.

Install

You can install straight from pip.

pip install keystore

Before using it for the first time, you will need to setup a ~/.keystorerc in your home directory.

{
  "keystore": "~/Dropbox/keystore",
  "files": [
    "~/.ssh",
    "~/.gnupg/gpg-agent.conf",
    "~/.gnupg/gpg.conf",
    "~/.gnupg/private-keys-v1.d",
    "~/.gnupg/pubring.gpg",
    "~/.gnupg/secring.gpg",
    "~/.gnupg/trustdb.gpg",
  ],
  "verbose": true
}

Example usage

Saving keys:

$ keystore-save

Inspecting ~/.ssh:
Adding /Users/spaxe/.ssh/id_rsa ...
Adding /Users/spaxe/.ssh/id_rsa.pub ...
Adding /Users/spaxe/.ssh/known_hosts ...
Added 3 key(s) to keystore.

This passphrase is used to decrypt your keystore. Please remember it.
Please enter a passphrase:
Please verify your passphrase:
Passphrase accepted. Encrypting ...
Keyring successfully created:
AwGd2MtDWRkOFdyJoRZTdFApvKnoBQ2PXsqqE
[...]

Loading keys:

$ keystore-load

Located encrypted keystore at ~/Dropbox/keystore:
Please enter the passphrase:
Keyring decrypted successfully.
File /Users/spaxe/.ssh/id_rsa exists. Are you sure you want to overwrite? (y)/n:
Writing key to /Users/spaxe/.ssh/id_rsa ...
File /Users/spaxe/.ssh/id_rsa.pub exists. Are you sure you want to overwrite? (y)/n:
Writing key to /Users/spaxe/.ssh/id_rsa.pub ...
File /Users/spaxe/.ssh/known_hosts exists. Are you sure you want to overwrite? (y)/n:
Writing key to /Users/spaxe/.ssh/known_hosts ...
Keyring loaded. Restored 3 keys.

Loading keys to the same directory (useful for a new machine):

$ mkdir keys
$ keystore-load --copy-to keys

Located encrypted keystore at ~/Dropbox/keystore:
Please enter the passphrase:
Keyring decrypted successfully.
Writing key to /Users/spaxe/keys/id_rsa ...
Writing key to /Users/spaxe/keys/id_rsa.pub ...
Writing key to /Users/spaxe/keys/known_hosts ...
Keyring loaded. Restored 3 keys.

Running tests:

python3 test.py

Known Security Issues

This library uses simple-crypt, which was last updated in 2015. You can read up about warnings for security concerns here.

License

© Xavier Ho [email protected]

License under MIT License.

keystore's People

Contributors

spaxe avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

marmikreal

keystore's Issues

Keystore asks to overwrite non-existent files

These options

File /Users/spaxe/.ssh/id_rsa exists. Are you sure you want to overwrite? (y)/n: 
File /Users/spaxe/.ssh/id_rsa.pub exists. Are you sure you want to overwrite? (y)/n: 
File /Users/spaxe/.ssh/known_hosts exists. Are you sure you want to overwrite? (y)/n: 

Are being asked prematurely as they do not exist on this machine.

Compression causes decryption to fail.

Ideally, the keys are serialised and compressed before encryption.

If the keys are compressed before encryption, when loading it back it fails with

Error -3 while decompressing data: incorrect header check

Which appears to be a zlib problem, but also could be with rncryptor. More investigation is required.

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.