-
Notifications
You must be signed in to change notification settings - Fork 1
8. Keystore
Nanocat edited this page Sep 15, 2017
·
1 revision
Keystore is a special db into orwelldb, which contain all private keys for reading messages. Keys can be linked to databasename or databasename+datasetname. In version 0.0.1 cant create more then one key to database or database+dataset.
Use program puttygen for windows, or openssl package for linux to generate new rsa key. You need to generate new rsa key, then export in pem format. Result key look like this:
-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQEAqs7mFZ7e7SSYjggqrb6G0haQWvXZsjuU+8Gh3U6jZFwNTKpn
lFLgc9mKo6Wu+bVNo+7vYjuRW9U3o5ckVE4gjwRh7O6tAl6rxGxfhpDUoThPXbEl
.....
YxRqsJwI5VbJTC6I+T1B81vyNQnxwmS8xA4+mzSDq+9+0cBCfA==
-----END RSA PRIVATE KEY-----
Next step - you need to add this key (with -----BEGIN RSA PRIVATE KEY-----) into orwelldb, use next method:
$(orwelldb_params)
.then(function(db){
return db.addPem('-----BEGIN RSA PRIVATE KEY-----.....', datasetname_optional, algorithm)
})
.then(function(args) {
//args.data is data from db with meta keys
})algorithm only supported now is rsa, but in next version will be added ecdh.
This method check first existing keys for dbname + datasetname, if dont have - check dbname only.
$(orwelldb_params)
.then(function(db){
return db.getPem(datasetname_optional)
})
.then(function(item) {
//item.pem
//item.algorithm
//item.dataset
//item.dbname
})