OpenSSL enabled in CMake

CMake is able to find OpenSSL now. Also fixed some errors in encrypting
functions