Class RSAKeyUtils


  • public class RSAKeyUtils
    extends java.lang.Object
    RSA JWK conversion utility.
    • Constructor Summary

      Constructors 
      Constructor Description
      RSAKeyUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int keyBitLength​(java.security.PrivateKey privateKey)
      Returns the length in bits of the specified RSA private key.
      static java.security.PrivateKey toRSAPrivateKey​(RSAKey rsaJWK)
      Returns the private RSA key of the specified RSA JWK.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RSAKeyUtils

        public RSAKeyUtils()
    • Method Detail

      • toRSAPrivateKey

        public static java.security.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​(java.security.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.