RSA bug fix, AES refactoring