From 42c21ce8922f0bac0d0f9acff7176cfaab1a45de Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 27 Aug 2018 19:56:22 -0400 Subject: [PATCH] PBKDF2 is SHA256 --- src/App/Enums/KdfType.cs | 2 +- src/App/Pages/RegisterPage.cs | 2 +- src/App/Services/AuthService.cs | 4 ++-- src/App/Services/CryptoService.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App/Enums/KdfType.cs b/src/App/Enums/KdfType.cs index 0ecec8cad..b71557943 100644 --- a/src/App/Enums/KdfType.cs +++ b/src/App/Enums/KdfType.cs @@ -2,6 +2,6 @@ { public enum KdfType : short { - PBKDF2 = 0 + PBKDF2_SHA256 = 0 } } diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index d715c47d4..409dbdbea 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -192,7 +192,7 @@ namespace Bit.App.Pages return; } - var kdf = Enums.KdfType.PBKDF2; + var kdf = Enums.KdfType.PBKDF2_SHA256; var kdfIterations = 5000; var normalizedEmail = EmailCell.Entry.Text.ToLower(); var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, normalizedEmail, kdf, kdfIterations); diff --git a/src/App/Services/AuthService.cs b/src/App/Services/AuthService.cs index 6f5beefab..41eb26f60 100644 --- a/src/App/Services/AuthService.cs +++ b/src/App/Services/AuthService.cs @@ -168,7 +168,7 @@ namespace Bit.App.Services { if(!_kdf.HasValue) { - _kdf = (KdfType)_settings.GetValueOrDefault(KdfKey, (short)KdfType.PBKDF2); + _kdf = (KdfType)_settings.GetValueOrDefault(KdfKey, (short)KdfType.PBKDF2_SHA256); } return _kdf.Value; } @@ -269,7 +269,7 @@ namespace Bit.App.Services public async Task TokenPostAsync(string email, string masterPassword) { - Kdf = KdfType.PBKDF2; + Kdf = KdfType.PBKDF2_SHA256; KdfIterations = 5000; var preloginResponse = await _accountsApiRepository.PostPreloginAsync( new PreloginRequest { Email = email }); diff --git a/src/App/Services/CryptoService.cs b/src/App/Services/CryptoService.cs index 20674db31..5a429de46 100644 --- a/src/App/Services/CryptoService.cs +++ b/src/App/Services/CryptoService.cs @@ -445,7 +445,7 @@ namespace Bit.App.Services var saltBytes = Encoding.UTF8.GetBytes(salt); byte[] keyBytes = null; - if(kdf == KdfType.PBKDF2) + if(kdf == KdfType.PBKDF2_SHA256) { if(kdfIterations < 5000) {