diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-10-09 21:43:38 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-10-09 21:43:38 +0200 |
commit | cbea7bc041e5c14670042e3e52f0786f9561af05 (patch) | |
tree | 4d646978f1ed984099828a65c92bcee0a72b47dc /aes.cpp | |
parent | d6dd94c63252ace898d9a60a539c7ab14d69f0ea (diff) |
Better error handling (exceptions)
Diffstat (limited to 'aes.cpp')
-rw-r--r-- | aes.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -248,7 +248,9 @@ namespace AES{ case AES_256_CBC: increment=2; break; default: assert(false); } - assert((int)key.size()==4*(4+2*increment)); + if((int)key.size()!=4*(4+2*increment)){ + throw invalid_argument("Invalid AES key length"); + } return decryptCBC(data,key,10+2*increment); } |