From: Robert Date: 2005-10-19T07:11:12+09:00 Subject: rescue'ing OpenSSL errors Hi! I'm having some issues with the OpenSSL library: I'm trying to rescue whatever errors the library wants to throw, however, it's not working: def encrypt require 'openssl' begin aes = OpenSSL::Cipher::Cipher.new('AES-128-CBC') aes.encrypt('SOME_KEY') cipher = aes.update(password) cipher << aes.final return cipher rescue return false end end Now I go into irb: require 'encrypt' encrypt('test') # -> gives encrypted output encrypt('') # -> gives error "evp_enc.c(332): OpenSSL internal error, assertion failed: inl > 0 \n Abort trap" Seems like I can't rescue that because the error comes from a C library. Is that right? Are there any solutions to this, except, for example, checking that "not password.empty?" ? Thanks, Rob