diff --git a/SystemExtensions.NetStandard.Security.Tests/CryptoRngProviderTests.cs b/SystemExtensions.NetStandard.Security.Tests/CryptoRngProviderTests.cs
index 5bba5c0..da2a390 100644
--- a/SystemExtensions.NetStandard.Security.Tests/CryptoRngProviderTests.cs
+++ b/SystemExtensions.NetStandard.Security.Tests/CryptoRngProviderTests.cs
@@ -35,5 +35,21 @@ namespace SystemExtensions.NetStandard.Security.Tests
bytes.All(b => b != 0).Should().BeTrue();
}
+
+ [TestMethod]
+ public void GetBytes_ShouldReturnBytes()
+ {
+ var bytes = this.cryptoRngProvider.GetBytes(10);
+
+ bytes.Length.Should().Be(10);
+ }
+
+ [TestMethod]
+ public void GetNonZeroBytes_ShouldReturnBytes()
+ {
+ var bytes = this.cryptoRngProvider.GetNonZeroBytes(10);
+
+ bytes.Length.Should().Be(10);
+ }
}
}
\ No newline at end of file
diff --git a/SystemExtensions.NetStandard.Security/Rng/CryptoRngProvider.cs b/SystemExtensions.NetStandard.Security/Rng/CryptoRngProvider.cs
index 452befa..f219161 100644
--- a/SystemExtensions.NetStandard.Security/Rng/CryptoRngProvider.cs
+++ b/SystemExtensions.NetStandard.Security/Rng/CryptoRngProvider.cs
@@ -25,6 +25,18 @@ namespace System.Rng
{
this.rngProvider.GetNonZeroBytes(data);
}
+ public byte[] GetBytes(int byteCount)
+ {
+ var bytes = new byte[byteCount];
+ this.GetBytes(bytes);
+ return bytes;
+ }
+ public byte[] GetNonZeroBytes(int byteCount)
+ {
+ var bytes = new byte[byteCount];
+ this.GetNonZeroBytes(bytes);
+ return bytes;
+ }
private void Dispose(bool disposing)
{
diff --git a/SystemExtensions.NetStandard.Security/Rng/ICryptoRngProvider.cs b/SystemExtensions.NetStandard.Security/Rng/ICryptoRngProvider.cs
index 8eae503..094dcad 100644
--- a/SystemExtensions.NetStandard.Security/Rng/ICryptoRngProvider.cs
+++ b/SystemExtensions.NetStandard.Security/Rng/ICryptoRngProvider.cs
@@ -3,6 +3,8 @@
public interface ICryptoRngProvider
{
public void GetBytes(byte[] data);
+ public byte[] GetBytes(int byteCount);
public void GetNonZeroBytes(byte[] data);
+ public byte[] GetNonZeroBytes(int byteCount);
}
}
diff --git a/SystemExtensions.NetStandard.Security/SystemExtensions.NetStandard.Security.csproj b/SystemExtensions.NetStandard.Security/SystemExtensions.NetStandard.Security.csproj
index bc0819e..0a9f3b3 100644
--- a/SystemExtensions.NetStandard.Security/SystemExtensions.NetStandard.Security.csproj
+++ b/SystemExtensions.NetStandard.Security/SystemExtensions.NetStandard.Security.csproj
@@ -7,7 +7,7 @@
LICENSE
true
System
- 1.1.0
+ 1.1.1
Alexandru Macocian
https://github.com/AlexMacocian/SystemExtensions