Fix android test for bouncy castle key der service

This commit is contained in:
Kyle Spearrin 2016-08-01 21:34:22 -04:00
parent c42a1504a7
commit aea96ae334

View file

@ -2,6 +2,7 @@ using System;
using System.Text; using System.Text;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using Bit.Android.Services;
namespace Bit.Android.Test namespace Bit.Android.Test
{ {
@ -18,7 +19,7 @@ namespace Bit.Android.Test
[Test] [Test]
public void MakeKeyFromPasswordBase64() public void MakeKeyFromPasswordBase64()
{ {
var service = new CommonCryptoKeyDerivationService(); var service = new BouncyCastleKeyDerivationService();
var key = service.DeriveKey(Encoding.UTF8.GetBytes("123456"), Encoding.UTF8.GetBytes("salt"), 5000); var key = service.DeriveKey(Encoding.UTF8.GetBytes("123456"), Encoding.UTF8.GetBytes("salt"), 5000);
Assert.True(key.SequenceEqual(GetKey())); Assert.True(key.SequenceEqual(GetKey()));
} }
@ -26,7 +27,7 @@ namespace Bit.Android.Test
[Test] [Test]
public void HashPasswordBase64() public void HashPasswordBase64()
{ {
var service = new CommonCryptoKeyDerivationService(); var service = new BouncyCastleKeyDerivationService();
var hash = service.DeriveKey(GetKey(), Encoding.UTF8.GetBytes("123456"), 1); var hash = service.DeriveKey(GetKey(), Encoding.UTF8.GetBytes("123456"), 1);
var hashBytes = Convert.FromBase64String("7Bsl4ponrsFu0jGl4yMeLZp5tKqx6g4tLrXhMszIsjQ="); var hashBytes = Convert.FromBase64String("7Bsl4ponrsFu0jGl4yMeLZp5tKqx6g4tLrXhMszIsjQ=");
Assert.True(hash.SequenceEqual(hashBytes)); Assert.True(hash.SequenceEqual(hashBytes));