Fix incorrect RSA key size calculation, and reduce extra calls to that method.