Package com.nimbusds.jose.crypto.impl
Class RSAKeyUtils
java.lang.Object
com.nimbusds.jose.crypto.impl.RSAKeyUtils
RSA JWK conversion utility.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Details
-
RSAKeyUtils
public RSAKeyUtils()
-
-
Method Details
-
toRSAPrivateKey
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
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.
-