summary refs log tree commit diff
path: root/crypto/src/security/ParameterUtilities.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2018-10-11 17:41:20 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2018-10-11 17:41:20 +0700
commit02d07a1f8bd57f4141ef1a1dc006e5f72c1116c5 (patch)
treefb5b664fda22c03a399d5185d0fe48336961fea7 /crypto/src/security/ParameterUtilities.cs
parentMore PORTABLE fixes (diff)
downloadBouncyCastle.NET-ed25519-02d07a1f8bd57f4141ef1a1dc006e5f72c1116c5.tar.xz
Refactoring to support custom ISignatureFactory
- see https://github.com/bcgit/bc-csharp/issues/153
Diffstat (limited to 'crypto/src/security/ParameterUtilities.cs')
-rw-r--r--crypto/src/security/ParameterUtilities.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/src/security/ParameterUtilities.cs b/crypto/src/security/ParameterUtilities.cs
index 792067bba..dc6992833 100644
--- a/crypto/src/security/ParameterUtilities.cs
+++ b/crypto/src/security/ParameterUtilities.cs
@@ -299,6 +299,15 @@ namespace Org.BouncyCastle.Security
             throw new SecurityUtilityException("Algorithm " + algorithm + " not recognised.");
         }
 
+        public static ICipherParameters WithRandom(ICipherParameters cp, SecureRandom random)
+        {
+            if (random != null)
+            {
+                cp = new ParametersWithRandom(cp, random);
+            }
+            return cp;
+        }
+
         private static Asn1OctetString CreateIVOctetString(
             SecureRandom	random,
             int				ivLength)