code: public int getStrength(String password) throws CredentialException {
          if (opensslKey == null) {
              return -1;
          }
          if (this.opensslKey.isEncrypted()) {
              if (password == null) {
                  throw new CredentialException("Key encrypted, password required");
              } else {
                  try {
                      this.opensslKey.decrypt(password);
                  } catch (GeneralSecurityException exp) {
                      throw new CredentialException(exp.getMessage(), exp);
                  }
              }
          }
          return ((RSAPrivateKey)opensslKey.getPrivateKey()).getModulus().bitLength();
      }
docs: Returns strength of the private/public key in bits.
  
  @return strength of the key in bits. Returns -1 if unable to determine it.