diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-10-22 12:04:29 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-10-22 12:04:29 +0700 |
commit | 9322296334c80a87994bb4779619210e76ffaf26 (patch) | |
tree | fa542bf88a389ac6ac7ca7f564a48deb05d7bb60 /crypto/src | |
parent | Remove unnecessary Clone (diff) | |
download | BouncyCastle.NET-ed25519-9322296334c80a87994bb4779619210e76ffaf26.tar.xz |
Apply CCM nonce length check for encryption only
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/crypto/modes/CcmBlockCipher.cs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/src/crypto/modes/CcmBlockCipher.cs b/crypto/src/crypto/modes/CcmBlockCipher.cs index 4de40d58e..0a28a288f 100644 --- a/crypto/src/crypto/modes/CcmBlockCipher.cs +++ b/crypto/src/crypto/modes/CcmBlockCipher.cs @@ -91,10 +91,8 @@ namespace Org.BouncyCastle.Crypto.Modes keyParam = cipherParameters; } - if (nonce == null || nonce.Length < 7 || nonce.Length > 13) - { + if (nonce == null || (forEncryption && (nonce.Length < 7 || nonce.Length > 13))) throw new ArgumentException("nonce must have length from 7 to 13 octets"); - } Reset(); } |