1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Added discovery key support.

This commit is contained in:
Ylian Saint-Hilaire 2020-07-14 15:39:14 -07:00
parent e00e0e82d0
commit f84220a7f4
3 changed files with 55 additions and 18 deletions

2
db.js
View file

@ -660,7 +660,7 @@ module.exports.CreateDB = function (parent, func) {
// If a DB encryption key is provided, perform database encryption
if ((typeof parent.args.dbencryptkey == 'string') && (parent.args.dbencryptkey.length != 0)) {
// Hash the database password into a AES256 key and setup encryption and decryption.
obj.dbKey = parent.crypto.createHash('sha384').update(parent.args.dbencryptkey).digest("raw").slice(0, 32);
obj.dbKey = parent.crypto.createHash('sha384').update(parent.args.dbencryptkey).digest('raw').slice(0, 32);
datastoreOptions.afterSerialization = function (plaintext) {
const iv = parent.crypto.randomBytes(16);
const aes = parent.crypto.createCipheriv('aes-256-cbc', obj.dbKey, iv);