diff --git a/apps/cli/src/commands/login.command.ts b/apps/cli/src/commands/login.command.ts index 6284f8b94b..b6ec7f3959 100644 --- a/apps/cli/src/commands/login.command.ts +++ b/apps/cli/src/commands/login.command.ts @@ -410,7 +410,7 @@ export class LoginCommand { this.policyService.masterPasswordPolicyOptions$() ); const kdf = await this.stateService.getKdfType(); - const kdfIterations = await this.stateService.getKdfIterations(); + const kdfConfig = await this.stateService.getKdfConfig(); if ( enforcedPolicyOptions != null && @@ -431,7 +431,7 @@ export class LoginCommand { masterPassword, this.email.trim().toLowerCase(), kdf, - kdfIterations + kdfConfig ); const newPasswordHash = await this.cryptoService.hashPassword(masterPassword, newKey); diff --git a/apps/cli/src/commands/unlock.command.ts b/apps/cli/src/commands/unlock.command.ts index 7e2136e6e3..28c892b58b 100644 --- a/apps/cli/src/commands/unlock.command.ts +++ b/apps/cli/src/commands/unlock.command.ts @@ -44,8 +44,8 @@ export class UnlockCommand { await this.setNewSessionKey(); const email = await this.stateService.getEmail(); const kdf = await this.stateService.getKdfType(); - const kdfIterations = await this.stateService.getKdfIterations(); - const key = await this.cryptoService.makeKey(password, email, kdf, kdfIterations); + const kdfConfig = await this.stateService.getKdfConfig(); + const key = await this.cryptoService.makeKey(password, email, kdf, kdfConfig); const storedKeyHash = await this.cryptoService.getKeyHash(); let passwordValid = false; diff --git a/apps/web/src/app/organizations/members/components/reset-password.component.ts b/apps/web/src/app/organizations/members/components/reset-password.component.ts index 3d96426f70..391420c48a 100644 --- a/apps/web/src/app/organizations/members/components/reset-password.component.ts +++ b/apps/web/src/app/organizations/members/components/reset-password.component.ts @@ -20,6 +20,7 @@ import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwo import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction"; import { EncString } from "@bitwarden/common/models/domain/enc-string"; +import { KdfConfig } from "@bitwarden/common/models/domain/kdf-config"; import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/master-password-policy-options"; import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetric-crypto-key"; @@ -156,6 +157,8 @@ export class ResetPasswordComponent implements OnInit, OnDestroy { const kdfType = response.kdf; const kdfIterations = response.kdfIterations; + const kdfMemory = response.kdfMemory; + const kdfParallelism = response.kdfParallelism; const resetPasswordKey = response.resetPasswordKey; const encryptedPrivateKey = response.encryptedPrivateKey; @@ -175,7 +178,7 @@ export class ResetPasswordComponent implements OnInit, OnDestroy { this.newPassword, this.email.trim().toLowerCase(), kdfType, - kdfIterations + new KdfConfig(kdfIterations, kdfMemory, kdfParallelism) ); const newPasswordHash = await this.cryptoService.hashPassword(this.newPassword, newKey); diff --git a/apps/web/src/app/settings/change-email.component.ts b/apps/web/src/app/settings/change-email.component.ts index 2c41bd0b78..134698584e 100644 --- a/apps/web/src/app/settings/change-email.component.ts +++ b/apps/web/src/app/settings/change-email.component.ts @@ -66,12 +66,12 @@ export class ChangeEmailComponent implements OnInit { request.newEmail = this.newEmail; request.masterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, null); const kdf = await this.stateService.getKdfType(); - const kdfIterations = await this.stateService.getKdfIterations(); + const kdfConfig = await this.stateService.getKdfConfig(); const newKey = await this.cryptoService.makeKey( this.masterPassword, this.newEmail, kdf, - kdfIterations + kdfConfig ); request.newMasterPasswordHash = await this.cryptoService.hashPassword( this.masterPassword, diff --git a/apps/web/src/app/settings/change-kdf.component.html b/apps/web/src/app/settings/change-kdf.component.html index 1b3b62a03f..b01b83a954 100644 --- a/apps/web/src/app/settings/change-kdf.component.html +++ b/apps/web/src/app/settings/change-kdf.component.html @@ -32,43 +32,94 @@ > - + + + +
- - - - - + + + + + + + + + + + + +
-
-
-

{{ "kdfIterationsDesc" | i18n: (recommendedKdfIterations | number) }}

- {{ "warning" | i18n }}: {{ "kdfIterationsWarning" | i18n: (50000 | number) }} -
-
+ +

+ {{ "kdfIterationsDesc" | i18n: (recommendedPbkdf2Iterations | number) }} +

+ + {{ "kdfIterationsWarning" | i18n: (100000 | number) }} + +
+ +

{{ "argon2Desc" | i18n }}

+ {{ "argon2Warning" | i18n }} +