Class RSAKeyUtils

    • Method Detail

      • toRSAPrivateKey

        public static PrivateKey toRSAPrivateKey​(RSAKey rsaJWK)
                                          throws JOSEException
        Returns the private RSA key of the specified RSA JWK. Supports PKCS#11 keys stores.
        Parameters:
        rsaJWK - The RSA JWK. Must not be null.
        Returns:
        The private RSA key.
        Throws:
        JOSEException - If the RSA JWK doesn't contain a private part.
      • keyBitLength

        public static int keyBitLength​(PrivateKey privateKey)
        Returns the length in bits of the specified RSA private key.
        Parameters:
        privateKey - The RSA private key. Must not be null.
        Returns:
        The key length in bits, -1 if the length couldn't be determined, e.g. for a PKCS#11 backed key which doesn't expose an RSAPrivateKey interface or support the getModulus() method.