From 45341ec408319cbf69a4772e503a3991ae770a49 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 2 Oct 2018 09:20:32 -0400 Subject: [PATCH] lower kdf iterations for edge/ie since they use less-performant polyfill --- src/angular/components/register.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index 6a6dc96e6d..f30e8bff55 100644 --- a/src/angular/components/register.component.ts +++ b/src/angular/components/register.component.ts @@ -10,6 +10,7 @@ import { ApiService } from '../../abstractions/api.service'; import { AuthService } from '../../abstractions/auth.service'; import { CryptoService } from '../../abstractions/crypto.service'; import { I18nService } from '../../abstractions/i18n.service'; +import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; import { StateService } from '../../abstractions/state.service'; import { KdfType } from '../../enums/kdfType'; @@ -28,7 +29,8 @@ export class RegisterComponent { constructor(protected authService: AuthService, protected router: Router, protected analytics: Angulartics2, protected toasterService: ToasterService, protected i18nService: I18nService, protected cryptoService: CryptoService, - protected apiService: ApiService, protected stateService: StateService) { } + protected apiService: ApiService, protected stateService: StateService, + protected platformUtilsService: PlatformUtilsService) { } async submit() { if (this.email == null || this.email === '') { @@ -60,7 +62,8 @@ export class RegisterComponent { this.name = this.name === '' ? null : this.name; this.email = this.email.trim().toLowerCase(); const kdf = KdfType.PBKDF2_SHA256; - const kdfIterations = 100000; + const useLowerKdf = this.platformUtilsService.isEdge() || this.platformUtilsService.isIE(); + const kdfIterations = useLowerKdf ? 10000 : 100000; const key = await this.cryptoService.makeKey(this.masterPassword, this.email, kdf, kdfIterations); const encKey = await this.cryptoService.makeEncKey(key); const hashedPassword = await this.cryptoService.hashPassword(this.masterPassword, key);