Encrypt secretKey with the masterKey
This commit is contained in:
parent
7cfe82e347
commit
c698fd68fa
1 changed files with 2 additions and 2 deletions
|
@ -66,7 +66,7 @@ class Configuration {
|
|||
|
||||
// Generate a public-private keypair and encrypt the latter
|
||||
final keyPair = await CryptoUtil.generateKeyPair();
|
||||
final encryptedSecretKeyData = CryptoUtil.encryptSync(keyPair.sk, kek);
|
||||
final encryptedSecretKeyData = CryptoUtil.encryptSync(keyPair.sk, key);
|
||||
|
||||
final attributes = KeyAttributes(
|
||||
Sodium.bin2base64(kekSalt),
|
||||
|
@ -97,7 +97,7 @@ class Configuration {
|
|||
Sodium.base642bin(attributes.keyDecryptionNonce));
|
||||
final secretKey = CryptoUtil.decryptSync(
|
||||
Sodium.base642bin(attributes.encryptedSecretKey),
|
||||
kek,
|
||||
key,
|
||||
Sodium.base642bin(attributes.secretKeyDecryptionNonce));
|
||||
await setKey(Sodium.bin2base64(key));
|
||||
await setSecretKey(Sodium.bin2base64(secretKey));
|
||||
|
|
Loading…
Add table
Reference in a new issue