mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Updated Design: Encryption of credentials (markdown)
parent
f73ab7da3b
commit
f317552d68
@ -42,11 +42,11 @@ By keeping it a valid JSON object underlying storage implementations should not
|
|||||||
|
|
||||||
### Encryption scheme
|
### Encryption scheme
|
||||||
|
|
||||||
var encryptionKey = crypto.createHash('sha256').update(userKey).digest();
|
var encryptionKey = crypto.createHash('sha256').update(userKey).digest();
|
||||||
var initVector = crypto.randomBytes(16);
|
var initVector = crypto.randomBytes(16);
|
||||||
var cipher = crypto.createCipheriv("aes-256-ctr", encryptionKey, initVector);
|
var cipher = crypto.createCipheriv("aes-256-ctr", encryptionKey, initVector);
|
||||||
var result = cipher.update(JSON.stringify(credentials), 'utf8', 'base64') + cipher.final('base64');
|
var result = cipher.update(JSON.stringify(credentials), 'utf8', 'base64') + cipher.final('base64');
|
||||||
result = initVector.toString('hex') + result;
|
result = initVector.toString('hex') + result;
|
||||||
|
|
||||||
### Decryption scheme
|
### Decryption scheme
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user