summary refs log tree commit diff
path: root/crypto/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/test/src')
-rw-r--r--crypto/test/src/util/test/TestRandomData.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/crypto/test/src/util/test/TestRandomData.cs b/crypto/test/src/util/test/TestRandomData.cs
new file mode 100644

index 000000000..7fe0cf305 --- /dev/null +++ b/crypto/test/src/util/test/TestRandomData.cs
@@ -0,0 +1,33 @@ +using System; + +using Org.BouncyCastle.Utilities.Encoders; + +namespace Org.BouncyCastle.Utilities.Test +{ + /** + * A fixed secure random designed to return data for someone needing random bytes. + */ + public class TestRandomData + : FixedSecureRandom + { + /** + * Constructor from a Hex encoding of the data. + * + * @param encoding a Hex encoding of the data to be returned. + */ + public TestRandomData(string encoding) + : this(Hex.Decode(encoding)) + { + } + + /** + * Constructor from an array of bytes. + * + * @param encoding a byte array representing the data to be returned. + */ + public TestRandomData(byte[] encoding) + : base(new FixedSecureRandom.Source[] { new FixedSecureRandom.Data(encoding)}) + { + } + } +}