bmwcarit / MoCOCrW

(mo)dern (c)++ (o)penssl (cr)ypto (w)rapper library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-informative message when building GCM decryptor without an IV

zinzila opened this issue · comments

Following code, note setting of an empty IV vector:

    auto decryptor = mococrw::AESCipherBuilder{mococrw::SymmetricCipherMode::GCM,
                                               mococrw::SymmetricCipherKeySize::S_128,
                                               mKey}
                         .setPadding(mococrw::SymmetricCipherPadding::NO)
                         .setIV({})
                         .buildAuthenticatedDecryptor();

Results in an exception:

terminate called after throwing an instance of 'mococrw::openssl::OpenSSLException'
  what():  error:00000000:lib(0):func(0):reason(0): 0

Which has no useful information for a developer to understand the issue. Maybe this can be improved.