refactor RSA