diff options
Diffstat (limited to 'crypto/src/openpgp')
-rw-r--r-- | crypto/src/openpgp/PgpEncryptedDataGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/openpgp/PgpPublicKey.cs | 2 | ||||
-rw-r--r-- | crypto/src/openpgp/PgpSecretKey.cs | 6 | ||||
-rw-r--r-- | crypto/src/openpgp/PgpSignature.cs | 2 | ||||
-rw-r--r-- | crypto/src/openpgp/PgpSignatureGenerator.cs | 4 | ||||
-rw-r--r-- | crypto/src/openpgp/PgpUtilities.cs | 4 | ||||
-rw-r--r-- | crypto/src/openpgp/PgpV3SignatureGenerator.cs | 14 |
7 files changed, 12 insertions, 22 deletions
diff --git a/crypto/src/openpgp/PgpEncryptedDataGenerator.cs b/crypto/src/openpgp/PgpEncryptedDataGenerator.cs index 29d90c6fa..a6482db6c 100644 --- a/crypto/src/openpgp/PgpEncryptedDataGenerator.cs +++ b/crypto/src/openpgp/PgpEncryptedDataGenerator.cs @@ -122,7 +122,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp throw new PgpException("Can't use DSA for encryption."); case PublicKeyAlgorithmTag.ECDsa: throw new PgpException("Can't use ECDSA for encryption."); - case PublicKeyAlgorithmTag.EdDsa: + case PublicKeyAlgorithmTag.EdDsa_Legacy: throw new PgpException("Can't use EdDSA for encryption."); default: throw new PgpException("unknown asymmetric algorithm: " + pubKey.Algorithm); diff --git a/crypto/src/openpgp/PgpPublicKey.cs b/crypto/src/openpgp/PgpPublicKey.cs index 1fadcff64..8b3575909 100644 --- a/crypto/src/openpgp/PgpPublicKey.cs +++ b/crypto/src/openpgp/PgpPublicKey.cs @@ -594,7 +594,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp return GetECKey("ECDH", ecdhK); } } - case PublicKeyAlgorithmTag.EdDsa: + case PublicKeyAlgorithmTag.EdDsa_Legacy: { EdDsaPublicBcpgKey eddsaK = (EdDsaPublicBcpgKey)publicPk.Key; var curveOid = eddsaK.CurveOid; diff --git a/crypto/src/openpgp/PgpSecretKey.cs b/crypto/src/openpgp/PgpSecretKey.cs index f6e36715f..627b6788a 100644 --- a/crypto/src/openpgp/PgpSecretKey.cs +++ b/crypto/src/openpgp/PgpSecretKey.cs @@ -77,7 +77,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp ECPrivateKeyParameters ecK = (ECPrivateKeyParameters)privKey.Key; secKey = new ECSecretBcpgKey(ecK.D); break; - case PublicKeyAlgorithmTag.EdDsa: + case PublicKeyAlgorithmTag.EdDsa_Legacy: { if (privKey.Key is Ed25519PrivateKeyParameters ed25519K) { @@ -441,7 +441,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp case PublicKeyAlgorithmTag.RsaSign: case PublicKeyAlgorithmTag.Dsa: case PublicKeyAlgorithmTag.ECDsa: - case PublicKeyAlgorithmTag.EdDsa: + case PublicKeyAlgorithmTag.EdDsa_Legacy: case PublicKeyAlgorithmTag.ElGamalGeneral: return true; default: @@ -733,7 +733,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp privateKey = new ECPrivateKeyParameters("ECDSA", ecdsaPriv.X, ecdsaPub.CurveOid); break; } - case PublicKeyAlgorithmTag.EdDsa: + case PublicKeyAlgorithmTag.EdDsa_Legacy: { EdDsaPublicBcpgKey eddsaPub = (EdDsaPublicBcpgKey)pubPk.Key; EdSecretBcpgKey ecdsaPriv = new EdSecretBcpgKey(bcpgIn); diff --git a/crypto/src/openpgp/PgpSignature.cs b/crypto/src/openpgp/PgpSignature.cs index d1146183a..d6ffc0f74 100644 --- a/crypto/src/openpgp/PgpSignature.cs +++ b/crypto/src/openpgp/PgpSignature.cs @@ -370,7 +370,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp { signature = sigValues[0].Value.ToByteArrayUnsigned(); } - else if (KeyAlgorithm == PublicKeyAlgorithmTag.EdDsa) + else if (KeyAlgorithm == PublicKeyAlgorithmTag.EdDsa_Legacy) { if (sigValues.Length != 2) throw new InvalidOperationException(); diff --git a/crypto/src/openpgp/PgpSignatureGenerator.cs b/crypto/src/openpgp/PgpSignatureGenerator.cs index 64d256653..7ff771997 100644 --- a/crypto/src/openpgp/PgpSignatureGenerator.cs +++ b/crypto/src/openpgp/PgpSignatureGenerator.cs @@ -60,7 +60,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp ICipherParameters cp = key; // TODO Ask SignerUtilities whether random is permitted? - if (keyAlgorithm == PublicKeyAlgorithmTag.EdDsa) + if (keyAlgorithm == PublicKeyAlgorithmTag.EdDsa_Legacy) { // EdDSA signers don't expect a SecureRandom } @@ -262,7 +262,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp byte[] fingerPrint = new byte[2]{ digest[0], digest[1] }; MPInteger[] sigValues; - if (keyAlgorithm == PublicKeyAlgorithmTag.EdDsa) + if (keyAlgorithm == PublicKeyAlgorithmTag.EdDsa_Legacy) { int sigLen = sigBytes.Length; if (sigLen == Ed25519.SignatureSize) diff --git a/crypto/src/openpgp/PgpUtilities.cs b/crypto/src/openpgp/PgpUtilities.cs index 82f65bd08..fa04f5f46 100644 --- a/crypto/src/openpgp/PgpUtilities.cs +++ b/crypto/src/openpgp/PgpUtilities.cs @@ -150,7 +150,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp case PublicKeyAlgorithmTag.ECDsa: encAlg = "ECDSA"; break; - case PublicKeyAlgorithmTag.EdDsa: + case PublicKeyAlgorithmTag.EdDsa_Legacy: encAlg = "EdDSA"; break; case PublicKeyAlgorithmTag.ElGamalEncrypt: // in some malformed cases. @@ -546,7 +546,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp { switch (publicKeyAlgorithm) { - case PublicKeyAlgorithmTag.EdDsa: + case PublicKeyAlgorithmTag.EdDsa_Legacy: { ISigner signer; if (key is Ed25519PrivateKeyParameters || key is Ed25519PublicKeyParameters) diff --git a/crypto/src/openpgp/PgpV3SignatureGenerator.cs b/crypto/src/openpgp/PgpV3SignatureGenerator.cs index 03dd8795d..538b6d140 100644 --- a/crypto/src/openpgp/PgpV3SignatureGenerator.cs +++ b/crypto/src/openpgp/PgpV3SignatureGenerator.cs @@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp PublicKeyAlgorithmTag keyAlgorithm, HashAlgorithmTag hashAlgorithm) { - if (keyAlgorithm == PublicKeyAlgorithmTag.EdDsa) + if (keyAlgorithm == PublicKeyAlgorithmTag.EdDsa_Legacy) throw new ArgumentException("Invalid algorithm for V3 signature", nameof(keyAlgorithm)); this.keyAlgorithm = keyAlgorithm; @@ -52,17 +52,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp try { 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); - } - + cp = ParameterUtilities.WithRandom(cp, random); sig.Init(true, cp); } catch (InvalidKeyException e) |