Skip to content

Commit

Permalink
commit 2019-12-08 -> code refactor, Argon2id tests, changed version t…
Browse files Browse the repository at this point in the history
…o 3.3.2
  • Loading branch information
alecgn committed Dec 8, 2019
1 parent b79d7d4 commit c3d3d16
Show file tree
Hide file tree
Showing 21 changed files with 401 additions and 338 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

<IsPackable>false</IsPackable>

<Version>3.3.1</Version>
<Version>3.3.2</Version>

<AssemblyVersion>3.3.1</AssemblyVersion>
<AssemblyVersion>3.3.2</AssemblyVersion>

<FileVersion>3.3.1</FileVersion>
<FileVersion>3.3.2</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void Test_EncryptString_with_append_encryption_data()
{
var appendEncryptionData = true;

var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -28,7 +28,7 @@ public void Test_EncryptString_without_append_encryption_data()
{
var appendEncryptionData = false;

var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -40,11 +40,11 @@ public void Test_DecryptString_with_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes128cbcHmacSha256.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInputString: appendEncryptionData);
aesDecryptionResult = _aes128cbcHmacSha256.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInput: appendEncryptionData);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand All @@ -62,12 +62,12 @@ public void Test_DecryptString_without_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes128cbcHmacSha256.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes128cbcHmacSha256.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password),
hasEncryptionDataAppendedInInputString: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);
hasEncryptionDataAppendedInInput: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void Test_EncryptString_with_append_encryption_data()
{
var appendEncryptionData = true;

var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -28,7 +28,7 @@ public void Test_EncryptString_without_append_encryption_data()
{
var appendEncryptionData = false;

var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -40,11 +40,11 @@ public void Test_DecryptString_with_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes192cbcHmacSha384.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInputString: appendEncryptionData);
aesDecryptionResult = _aes192cbcHmacSha384.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInput: appendEncryptionData);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand All @@ -62,12 +62,12 @@ public void Test_DecryptString_without_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes192cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes192cbcHmacSha384.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password),
hasEncryptionDataAppendedInInputString: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);
hasEncryptionDataAppendedInInput: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void Test_EncryptString_with_append_encryption_data()
{
var appendEncryptionData = true;

var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -28,7 +28,7 @@ public void Test_EncryptString_without_append_encryption_data()
{
var appendEncryptionData = false;

var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -40,11 +40,11 @@ public void Test_DecryptString_with_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256cbcHmacSha384.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInputString: appendEncryptionData);
aesDecryptionResult = _aes256cbcHmacSha384.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInput: appendEncryptionData);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand All @@ -62,12 +62,12 @@ public void Test_DecryptString_without_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha384.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256cbcHmacSha384.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password),
hasEncryptionDataAppendedInInputString: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);
hasEncryptionDataAppendedInInput: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void Test_EncryptString_with_append_encryption_data()
{
var appendEncryptionData = true;

var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -28,7 +28,7 @@ public void Test_EncryptString_without_append_encryption_data()
{
var appendEncryptionData = false;

var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

Assert.IsTrue(aesEncryptionResult.Success, aesEncryptionResult.Message);
}
Expand All @@ -40,11 +40,11 @@ public void Test_DecryptString_with_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256cbcHmacSha512.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInputString: appendEncryptionData);
aesDecryptionResult = _aes256cbcHmacSha512.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, hasEncryptionDataAppendedInInput: appendEncryptionData);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand All @@ -62,12 +62,12 @@ public void Test_DecryptString_without_encryption_data_appended()
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256cbcHmacSha512.EncryptString(_testString, _password, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256cbcHmacSha512.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password),
hasEncryptionDataAppendedInInputString: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);
hasEncryptionDataAppendedInInput: appendEncryptionData, aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.IV);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ public void Test_DecryptString_without_encryption_data_appended_without_associat
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password), null, hasEncryptionDataAppendedInInputString: appendEncryptionData,
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password), null, hasEncryptionDataAppendedInInput: appendEncryptionData,
aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.Nonce);

if (!aesDecryptionResult.Success)
Expand All @@ -90,11 +90,11 @@ public void Test_DecryptString_without_encryption_data_appended_with_associated_
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password), Encoding.UTF8.GetBytes(associatedData), hasEncryptionDataAppendedInInputString: appendEncryptionData,
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBytes, Encoding.UTF8.GetBytes(_password), Encoding.UTF8.GetBytes(associatedData), hasEncryptionDataAppendedInInput: appendEncryptionData,
aesEncryptionResult.Tag, aesEncryptionResult.Salt, aesEncryptionResult.Nonce);

if (!aesDecryptionResult.Success)
Expand All @@ -114,11 +114,11 @@ public void Test_DecryptString_with_encryption_data_appended_without_associated_
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, associatedData, hasEncryptionDataAppendedInInputString: appendEncryptionData);
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, associatedData, hasEncryptionDataAppendedInInput: appendEncryptionData);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand All @@ -137,11 +137,11 @@ public void Test_DecryptString_with_encryption_data_appended_with_associated_dat
var aesDecryptionResult = new AesDecryptionResult();
string errorMessage = "";

var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutputString: appendEncryptionData);
var aesEncryptionResult = _aes256gcm.EncryptString(_testString, _password, associatedData, appendEncryptionDataToOutput: appendEncryptionData);

if (aesEncryptionResult.Success)
{
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, associatedData, hasEncryptionDataAppendedInInputString: appendEncryptionData);
aesDecryptionResult = _aes256gcm.DecryptString(aesEncryptionResult.EncryptedDataBase64String, _password, associatedData, hasEncryptionDataAppendedInInput: appendEncryptionData);

if (!aesDecryptionResult.Success)
errorMessage = aesDecryptionResult.Message;
Expand Down
Loading

0 comments on commit c3d3d16

Please sign in to comment.