Skip to content

Commit 4ce7068

Browse files
committed
add GenerateBase64IVKey method
1 parent 8475f8e commit 4ce7068

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/SafeCrypt.Lib/Helpers/KeyGenerators.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,18 @@ public static byte[] GenerateRandomIVKeyAsBytes(int length)
4242
/// <see cref="BitConverter.ToString"/>. Any hyphens in the resulting string are removed
4343
/// using <see cref="string.Replace"/>.
4444
/// </remarks>
45-
public static string GenerateRandomIVKeyAsString()
45+
public static string GenerateHexadecimalIVKey()
4646
{
4747
byte[] randomBytes = GenerateRandomIVKeyAsBytes(16);
4848
return BitConverter.ToString(randomBytes).Replace("-", "");
4949
}
5050

51+
public static string GenerateBase64IVKey()
52+
{
53+
byte[] randomBytes = GenerateRandomIVKeyAsBytes(16);
54+
return Convert.ToBase64String(randomBytes);
55+
}
56+
5157
/// <summary>
5258
/// Generates a valid AES secret key with the specified key size.
5359
/// </summary>

0 commit comments

Comments
 (0)