summary refs log tree commit diff
path: root/crypto/src/openpgp/PgpV3SignatureGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/openpgp/PgpV3SignatureGenerator.cs')
-rw-r--r--crypto/src/openpgp/PgpV3SignatureGenerator.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/crypto/src/openpgp/PgpV3SignatureGenerator.cs b/crypto/src/openpgp/PgpV3SignatureGenerator.cs
index 324dbd768..03dd8795d 100644
--- a/crypto/src/openpgp/PgpV3SignatureGenerator.cs
+++ b/crypto/src/openpgp/PgpV3SignatureGenerator.cs
@@ -47,20 +47,23 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 
             AsymmetricKeyParameter key = privKey.Key;
 
-            if (sig == null)
-            {
-                this.sig = PgpUtilities.CreateSigner(keyAlgorithm, hashAlgorithm, key);
-            }
+            this.sig = PgpUtilities.CreateSigner(keyAlgorithm, hashAlgorithm, key);
 
             try
             {
-				ICipherParameters cp = key;
-				if (random != null)
-				{
-					cp = new ParametersWithRandom(cp, random);
-				}
+                ICipherParameters cp = key;
+
+                // TODO Ask SignerUtilities whether random is permitted?
+                if (keyAlgorithm == PublicKeyAlgorithmTag.EdDsa)
+                {
+                    // EdDSA signers don't expect a SecureRandom
+                }
+                else
+                {
+                    cp = ParameterUtilities.WithRandom(cp, random);
+                }
 
-				sig.Init(true, cp);
+                sig.Init(true, cp);
             }
             catch (InvalidKeyException e)
             {