Class JCEComponentManager
java.lang.Object
com.sshtools.common.ssh.components.ComponentManager
com.sshtools.common.ssh.components.jce.JCEComponentManager
- All Implemented Interfaces:
JCEAlgorithms
A component manager for the Java runtime JCE provider. By default all
algorithms will be selected from the default provider i.e no provider is
specified in calls to JCE methods to create components. You can initialize a
default provider to be used on all calls with the following code:
Alternatively you can also assign a specific provider for an individual algorithm, all algorithms used by the API are included as static constants in this class.JCEComponentManager.initializeDefaultProvider(new BouncyCastleProvider());
JCEComponentManager.initializeProviderForAlgorithm(JCEComponentManager.JCE_DSA, new BouncyCastleProvider());
- Author:
- Lee David Painter
-
Field Summary
Fields inherited from class com.sshtools.common.ssh.components.ComponentManager
instanceFields inherited from interface com.sshtools.common.ssh.components.jce.JCEAlgorithms
ED25519, ED448, EdDSA, JCE_3DESCBCNOPADDING, JCE_3DESCTRNOPADDING, JCE_AESCBCNOPADDING, JCE_AESCTRNOPADDING, JCE_AESGCMNOPADDING, JCE_ARCFOUR, JCE_BLOWFISHCBCNOPADDING, JCE_DESCBCNOPADDING, JCE_DH, JCE_DH_KEY_AGREEMENT, JCE_DH_KEY_FACTORY, JCE_DH_KEY_GENERATOR, JCE_DSA, JCE_ECDH, JCE_HMACMD5, JCE_HMACRIPEMD160, JCE_HMACSHA1, JCE_HMACSHA256, JCE_HMACSHA512, JCE_MD5, JCE_MD5WithRSA, JCE_RSA, JCE_RSA_CIPHER, JCE_RSANONEPKCS1PADDING, JCE_SHA1, JCE_SHA1PRNG, JCE_SHA1WithDSA, JCE_SHA1WithECDSA, JCE_SHA1WithRSA, JCE_SHA256, JCE_SHA256WithECDSA, JCE_SHA256WithRSA, JCE_SHA384, JCE_SHA384WithECDSA, JCE_SHA512, JCE_SHA512WithECDSA, JCE_SHA512WithRSA, JCE_X509 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDsaPrivateKey(BigInteger p, BigInteger q, BigInteger g, BigInteger x, BigInteger y) Create an instance of a DSA private key.Create an uninitialized instance of a DSA public keycreateDsaPublicKey(BigInteger p, BigInteger q, BigInteger g, BigInteger y) Create an instance of a DSA public key.createRsaPrivateCrtKey(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger crtCoefficient) Create an instance of an RSA co-effecient private key.createRsaPrivateCrtKey(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger primeExponentP, BigInteger primeExponentQ, BigInteger crtCoefficient) Create an instance of an RSA co-efficent private key.createRsaPrivateKey(BigInteger modulus, BigInteger privateExponent) Create an instance of an RSA private key.createRsaPublicKey(BigInteger modulus, BigInteger publicExponent) Create an instance of an RSA public key.Create an instance of an SSH2 RSA public key.generateDsaKeyPair(int bits) Generate a new DSA public/private key pair.generateEcdsaKeyPair(int bits) Generate a new ECDSA key pair.generateRsaKeyPair(int bits, int version) Generate an RSA public/private pair.static ComponentManagerstatic ProvidergetProviderForAlgorithm(String jceAlgorithm) Get the provider for a specific algorithm.getRND()Get the secure random number generator.static SecureRandomGet the secure random implementation for the API.static StringGet the algorithm used for secure random number generation.static voidinitializeDefaultProvider(Provider provider) Initialize the default JCE provider used by the API.protected voidinitializeDigestFactory(ComponentFactory<Digest> digests) Initialize the digest factory.protected voidInitialize the SSH2 HMAC factory.static voidinitializeProviderForAlgorithm(String jceAlgorithm, Provider provider) Initialize a provider for a specific algorithm.protected voidinitializePublicKeyFactory(ComponentFactory<SshPublicKey> publickeys) Initialize the public key factory.protected voidInitialize the SSH2 cipher factory.voidsetClassLoader(ClassLoader classLoader) static voidsetSecureRandomAlgorithm(String secureRandomAlgorithm) Set the algorithm used for secure random number generation.Methods inherited from class com.sshtools.common.ssh.components.ComponentManager
disableAlgorithm, enableAlgorithm, getDigest, getInstance, init, isDefaultEnabled, isDisabled, isEnabled, isEnableNoneCipher, isEnableNoneMac, loadComponents, reset, setDefaultEnabled, setEnableNoneCipher, setEnableNoneMac, setInstance, setMinimumSecurityLevel, supportedDigests, supportedHMacsCS, supportedHMacsSC, supportedPublicKeys, supportedSsh2CiphersCS, supportedSsh2CiphersSC
-
Constructor Details
-
JCEComponentManager
public JCEComponentManager()
-
-
Method Details
-
initializeDefaultProvider
Initialize the default JCE provider used by the API.- Parameters:
provider-
-
initializeProviderForAlgorithm
Initialize a provider for a specific algorithm.- Parameters:
jceAlgorithm-provider-
-
getSecureRandomAlgorithm
Get the algorithm used for secure random number generation.- Returns:
- String
-
setSecureRandomAlgorithm
Set the algorithm used for secure random number generation.- Parameters:
secureRandomAlgorithm-
-
getProviderForAlgorithm
Get the provider for a specific algorithm.- Parameters:
jceAlgorithm-- Returns:
- Provider
-
getSecureRandom
Get the secure random implementation for the API.- Returns:
- SecureRandom
- Throws:
NoSuchAlgorithmException
-
createDsaPrivateKey
public SshDsaPrivateKey createDsaPrivateKey(BigInteger p, BigInteger q, BigInteger g, BigInteger x, BigInteger y) throws SshException Description copied from class:ComponentManagerCreate an instance of a DSA private key.- Specified by:
createDsaPrivateKeyin classComponentManager- Returns:
- SshDsaPrivateKey
- Throws:
SshException
-
createDsaPublicKey
public SshDsaPublicKey createDsaPublicKey(BigInteger p, BigInteger q, BigInteger g, BigInteger y) throws SshException Description copied from class:ComponentManagerCreate an instance of a DSA public key.- Specified by:
createDsaPublicKeyin classComponentManager- Returns:
- SshDsaPublicKey
- Throws:
SshException
-
createDsaPublicKey
Description copied from class:ComponentManagerCreate an uninitialized instance of a DSA public key- Specified by:
createDsaPublicKeyin classComponentManager- Returns:
- SshDsaPublicKey
-
createRsaPrivateCrtKey
public SshRsaPrivateCrtKey createRsaPrivateCrtKey(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger crtCoefficient) throws SshException Description copied from class:ComponentManagerCreate an instance of an RSA co-effecient private key.- Specified by:
createRsaPrivateCrtKeyin classComponentManager- Returns:
- SshRsaPrivateCrtKey
- Throws:
SshException
-
createRsaPrivateCrtKey
public SshRsaPrivateCrtKey createRsaPrivateCrtKey(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger primeExponentP, BigInteger primeExponentQ, BigInteger crtCoefficient) throws SshException Description copied from class:ComponentManagerCreate an instance of an RSA co-efficent private key.- Specified by:
createRsaPrivateCrtKeyin classComponentManager- Returns:
- SshRsaPrivateCrtKey
- Throws:
SshException
-
createRsaPrivateKey
public SshRsaPrivateKey createRsaPrivateKey(BigInteger modulus, BigInteger privateExponent) throws SshException Description copied from class:ComponentManagerCreate an instance of an RSA private key.- Specified by:
createRsaPrivateKeyin classComponentManager- Returns:
- SshRsaPrivateKey
- Throws:
SshException
-
createRsaPublicKey
public SshRsaPublicKey createRsaPublicKey(BigInteger modulus, BigInteger publicExponent) throws SshException Description copied from class:ComponentManagerCreate an instance of an RSA public key.- Specified by:
createRsaPublicKeyin classComponentManager- Returns:
- SshRsaPublicKey
- Throws:
SshException
-
createSsh2RsaPublicKey
Description copied from class:ComponentManagerCreate an instance of an SSH2 RSA public key.- Specified by:
createSsh2RsaPublicKeyin classComponentManager- Returns:
- SshRsaPublicKey
- Throws:
SshException
-
generateDsaKeyPair
Description copied from class:ComponentManagerGenerate a new DSA public/private key pair.- Specified by:
generateDsaKeyPairin classComponentManager- Returns:
- SshKeyPair
- Throws:
SshException
-
generateRsaKeyPair
Description copied from class:ComponentManagerGenerate an RSA public/private pair.- Specified by:
generateRsaKeyPairin classComponentManager- Returns:
- SshKeyPair
- Throws:
SshException
-
generateEd25519KeyPair
- Specified by:
generateEd25519KeyPairin classComponentManager- Throws:
SshException
-
generateEd448KeyPair
- Specified by:
generateEd448KeyPairin classComponentManager- Throws:
SshException
-
generateEcdsaKeyPair
Description copied from class:ComponentManagerGenerate a new ECDSA key pair.- Specified by:
generateEcdsaKeyPairin classComponentManager- Returns:
- Throws:
SshException
-
getRND
Description copied from class:ComponentManagerGet the secure random number generator.- Specified by:
getRNDin classComponentManager- Returns:
- SshSecureRandomGenerator
- Throws:
SshException
-
initializeDigestFactory
Description copied from class:ComponentManagerInitialize the digest factory.- Specified by:
initializeDigestFactoryin classComponentManager
-
initializeHmacFactory
Description copied from class:ComponentManagerInitialize the SSH2 HMAC factory.- Specified by:
initializeHmacFactoryin classComponentManager
-
initializePublicKeyFactory
Description copied from class:ComponentManagerInitialize the public key factory.- Specified by:
initializePublicKeyFactoryin classComponentManager
-
initializeSsh2CipherFactory
Description copied from class:ComponentManagerInitialize the SSH2 cipher factory. These ciphers are exclusively used by the SSH2 implementation.- Specified by:
initializeSsh2CipherFactoryin classComponentManager
-
getClassLoader
- Specified by:
getClassLoaderin classComponentManager
-
setClassLoader
-
getDefaultInstance
-