From 3e1dd2d345e9be2cb38bf039348abf4ff4f721e5 Mon Sep 17 00:00:00 2001 From: Gert Driesen Date: Sun, 6 Aug 2017 17:54:47 +0200 Subject: [PATCH] Added CryptoAbstraction.GenerateRandom(int length) method. --- src/Renci.SshNet/Abstractions/CryptoAbstraction.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs b/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs index e96bff9c..ff9e50a5 100644 --- a/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs @@ -9,6 +9,18 @@ namespace Renci.SshNet.Abstractions private static readonly System.Security.Cryptography.RandomNumberGenerator Randomizer = CreateRandomNumberGenerator(); #endif + /// + /// Generates a array of the specified length, and fills it with a + /// cryptographically strong random sequence of values. + /// + /// The length of the array generate. + public static byte[] GenerateRandom(int length) + { + var random = new byte[length]; + GenerateRandom(random); + return random; + } + /// /// Fills an array of bytes with a cryptographically strong random sequence of values. ///