PBKDF2 is SHA256

This commit is contained in:
Kyle Spearrin 2018-08-27 19:56:22 -04:00
parent d278fde5f2
commit 42c21ce892
4 changed files with 5 additions and 5 deletions

View file

@ -2,6 +2,6 @@
{ {
public enum KdfType : short public enum KdfType : short
{ {
PBKDF2 = 0 PBKDF2_SHA256 = 0
} }
} }

View file

@ -192,7 +192,7 @@ namespace Bit.App.Pages
return; return;
} }
var kdf = Enums.KdfType.PBKDF2; var kdf = Enums.KdfType.PBKDF2_SHA256;
var kdfIterations = 5000; var kdfIterations = 5000;
var normalizedEmail = EmailCell.Entry.Text.ToLower(); var normalizedEmail = EmailCell.Entry.Text.ToLower();
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, normalizedEmail, kdf, kdfIterations); var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, normalizedEmail, kdf, kdfIterations);

View file

@ -168,7 +168,7 @@ namespace Bit.App.Services
{ {
if(!_kdf.HasValue) if(!_kdf.HasValue)
{ {
_kdf = (KdfType)_settings.GetValueOrDefault(KdfKey, (short)KdfType.PBKDF2); _kdf = (KdfType)_settings.GetValueOrDefault(KdfKey, (short)KdfType.PBKDF2_SHA256);
} }
return _kdf.Value; return _kdf.Value;
} }
@ -269,7 +269,7 @@ namespace Bit.App.Services
public async Task<FullLoginResult> TokenPostAsync(string email, string masterPassword) public async Task<FullLoginResult> TokenPostAsync(string email, string masterPassword)
{ {
Kdf = KdfType.PBKDF2; Kdf = KdfType.PBKDF2_SHA256;
KdfIterations = 5000; KdfIterations = 5000;
var preloginResponse = await _accountsApiRepository.PostPreloginAsync( var preloginResponse = await _accountsApiRepository.PostPreloginAsync(
new PreloginRequest { Email = email }); new PreloginRequest { Email = email });

View file

@ -445,7 +445,7 @@ namespace Bit.App.Services
var saltBytes = Encoding.UTF8.GetBytes(salt); var saltBytes = Encoding.UTF8.GetBytes(salt);
byte[] keyBytes = null; byte[] keyBytes = null;
if(kdf == KdfType.PBKDF2) if(kdf == KdfType.PBKDF2_SHA256)
{ {
if(kdfIterations < 5000) if(kdfIterations < 5000)
{ {