Package com.nimbusds.jose.crypto.impl
Class RSAKeyUtils
- java.lang.Object
-
- com.nimbusds.jose.crypto.impl.RSAKeyUtils
-
public class RSAKeyUtils extends 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(PrivateKey privateKey)
Returns the length in bits of the specified RSA private key.static PrivateKey
toRSAPrivateKey(RSAKey rsaJWK)
Returns the private RSA key of the specified RSA JWK.
-
-
-
Constructor Detail
-
RSAKeyUtils
public 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 benull
.- 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 benull
.- 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.
-
-