diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-19 13:32:53 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-19 13:32:53 +0700 |
commit | 2b44881bc63813af842ccf2012746bb38877b325 (patch) | |
tree | 7308a4c6ba0b0a34fffd38ea3a211997c08aa62c | |
parent | Add test coverage for AesEngine_X86.ProcessFourBlocks (diff) | |
download | BouncyCastle.NET-ed25519-2b44881bc63813af842ccf2012746bb38877b325.tar.xz |
Refine exception types
4 files changed, 6 insertions, 6 deletions
diff --git a/crypto/src/crypto/parameters/Ed25519PrivateKeyParameters.cs b/crypto/src/crypto/parameters/Ed25519PrivateKeyParameters.cs index eeb782d8e..2bd6445b8 100644 --- a/crypto/src/crypto/parameters/Ed25519PrivateKeyParameters.cs +++ b/crypto/src/crypto/parameters/Ed25519PrivateKeyParameters.cs @@ -104,7 +104,7 @@ namespace Org.BouncyCastle.Crypto.Parameters case Ed25519.Algorithm.Ed25519: { if (null != ctx) - throw new ArgumentException(nameof(ctx)); + throw new ArgumentOutOfRangeException(nameof(ctx)); Ed25519.Sign(data, 0, pk, 0, msg, msgOff, msgLen, sig, sigOff); break; @@ -126,7 +126,7 @@ namespace Org.BouncyCastle.Crypto.Parameters if (ctx.Length > 255) throw new ArgumentOutOfRangeException(nameof(ctx)); if (Ed25519.PrehashSize != msgLen) - throw new ArgumentException(nameof(msgLen)); + throw new ArgumentOutOfRangeException(nameof(msgLen)); Ed25519.SignPrehash(data, 0, pk, 0, ctx, msg, msgOff, sig, sigOff); break; diff --git a/crypto/src/crypto/parameters/Ed25519PublicKeyParameters.cs b/crypto/src/crypto/parameters/Ed25519PublicKeyParameters.cs index 5465543a8..a454754f5 100644 --- a/crypto/src/crypto/parameters/Ed25519PublicKeyParameters.cs +++ b/crypto/src/crypto/parameters/Ed25519PublicKeyParameters.cs @@ -68,7 +68,7 @@ namespace Org.BouncyCastle.Crypto.Parameters case Ed25519.Algorithm.Ed25519: { if (null != ctx) - throw new ArgumentException(nameof(ctx)); + throw new ArgumentOutOfRangeException(nameof(ctx)); return Ed25519.Verify(sig, sigOff, data, 0, msg, msgOff, msgLen); } @@ -88,7 +88,7 @@ namespace Org.BouncyCastle.Crypto.Parameters if (ctx.Length > 255) throw new ArgumentOutOfRangeException(nameof(ctx)); if (Ed25519.PrehashSize != msgLen) - throw new ArgumentException(nameof(msgLen)); + throw new ArgumentOutOfRangeException(nameof(msgLen)); return Ed25519.VerifyPrehash(sig, sigOff, data, 0, ctx, msg, msgOff); } diff --git a/crypto/src/crypto/parameters/Ed448PrivateKeyParameters.cs b/crypto/src/crypto/parameters/Ed448PrivateKeyParameters.cs index a9283761b..9f442b21a 100644 --- a/crypto/src/crypto/parameters/Ed448PrivateKeyParameters.cs +++ b/crypto/src/crypto/parameters/Ed448PrivateKeyParameters.cs @@ -118,7 +118,7 @@ namespace Org.BouncyCastle.Crypto.Parameters if (ctx.Length > 255) throw new ArgumentOutOfRangeException(nameof(ctx)); if (Ed448.PrehashSize != msgLen) - throw new ArgumentException(nameof(msgLen)); + throw new ArgumentOutOfRangeException(nameof(msgLen)); Ed448.SignPrehash(data, 0, pk, 0, ctx, msg, msgOff, sig, sigOff); break; diff --git a/crypto/src/crypto/parameters/Ed448PublicKeyParameters.cs b/crypto/src/crypto/parameters/Ed448PublicKeyParameters.cs index 2b12f37e5..d2ef7c891 100644 --- a/crypto/src/crypto/parameters/Ed448PublicKeyParameters.cs +++ b/crypto/src/crypto/parameters/Ed448PublicKeyParameters.cs @@ -81,7 +81,7 @@ namespace Org.BouncyCastle.Crypto.Parameters if (ctx.Length > 255) throw new ArgumentOutOfRangeException(nameof(ctx)); if (Ed448.PrehashSize != msgLen) - throw new ArgumentException(nameof(msgLen)); + throw new ArgumentOutOfRangeException(nameof(msgLen)); return Ed448.VerifyPrehash(sig, sigOff, data, 0, ctx, msg, msgOff); } |