summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/crypto/parameters/KeyParameter.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/src/crypto/parameters/KeyParameter.cs b/crypto/src/crypto/parameters/KeyParameter.cs
index 33dff96d7..043adf276 100644
--- a/crypto/src/crypto/parameters/KeyParameter.cs
+++ b/crypto/src/crypto/parameters/KeyParameter.cs
@@ -27,7 +27,7 @@ namespace Org.BouncyCastle.Crypto.Parameters
 				throw new ArgumentNullException("key");
 			if (keyOff < 0 || keyOff > key.Length)
 				throw new ArgumentOutOfRangeException("keyOff");
-			if (keyLen < 0 || (keyOff + keyLen) > key.Length)
+            if (keyLen < 0 || keyLen > (key.Length - keyOff))
 				throw new ArgumentOutOfRangeException("keyLen");
 
 			this.key = new byte[keyLen];