public class RSAKeyFactory
extends java.security.KeyFactorySpi
| Modifier and Type | Class and Description |
|---|---|
static class |
RSAKeyFactory.Legacy |
static class |
RSAKeyFactory.PSS |
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_MODLEN |
static int |
MAX_MODLEN_RESTRICT_EXP |
static int |
MAX_RESTRICTED_EXPLEN |
static int |
MIN_MODLEN |
| Constructor and Description |
|---|
RSAKeyFactory(RSAUtil.KeyType type) |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkKeyLengths(int modulusLen,
java.math.BigInteger exponent,
int minModulusLen,
int maxModulusLen)
Check the length of an RSA key modulus/exponent to make sure it
is not too short or long.
|
protected java.security.PrivateKey |
engineGeneratePrivate(java.security.spec.KeySpec keySpec) |
protected java.security.PublicKey |
engineGeneratePublic(java.security.spec.KeySpec keySpec) |
protected <T extends java.security.spec.KeySpec> |
engineGetKeySpec(java.security.Key key,
java.lang.Class<T> keySpec) |
protected java.security.Key |
engineTranslateKey(java.security.Key key)
Translate an RSA key into a SunRsaSign RSA key.
|
static java.security.interfaces.RSAKey |
toRSAKey(java.security.Key key)
Static method to convert Key into an instance of RSAPublicKeyImpl
or RSAPrivate(Crt)KeyImpl.
|
public static final int MIN_MODLEN
public static final int MAX_MODLEN
public static final int MAX_MODLEN_RESTRICT_EXP
public static final int MAX_RESTRICTED_EXPLEN
public RSAKeyFactory(RSAUtil.KeyType type)
public static java.security.interfaces.RSAKey toRSAKey(java.security.Key key)
throws java.security.InvalidKeyException
java.security.InvalidKeyExceptionpublic static void checkKeyLengths(int modulusLen,
java.math.BigInteger exponent,
int minModulusLen,
int maxModulusLen)
throws java.security.InvalidKeyException
modulusLen - the bit length of the RSA modulus.exponent - the RSA exponentminModulusLen - if > 0, check to see if modulusLen is at
least this long, otherwise unused.maxModulusLen - caller will allow this max number of bits.
Allow the smaller of the system-defined maximum and this param.java.security.InvalidKeyException - if any of the values are unacceptable.protected java.security.Key engineTranslateKey(java.security.Key key)
throws java.security.InvalidKeyException
engineTranslateKey in class java.security.KeyFactorySpijava.security.InvalidKeyExceptionprotected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
throws java.security.spec.InvalidKeySpecException
engineGeneratePublic in class java.security.KeyFactorySpijava.security.spec.InvalidKeySpecExceptionprotected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
throws java.security.spec.InvalidKeySpecException
engineGeneratePrivate in class java.security.KeyFactorySpijava.security.spec.InvalidKeySpecExceptionprotected <T extends java.security.spec.KeySpec> T engineGetKeySpec(java.security.Key key,
java.lang.Class<T> keySpec)
throws java.security.spec.InvalidKeySpecException
engineGetKeySpec in class java.security.KeyFactorySpijava.security.spec.InvalidKeySpecException