Class RsaKeyProvider
- java.lang.Object
-
- org.activecomponents.udp.asymciphers.RsaKeyProvider
-
- All Implemented Interfaces:
IKeyProvider
public class RsaKeyProvider extends java.lang.Object implements IKeyProvider
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_KEY_SIZEThe default key size.protected static intDEFAULT_MAX_KEYSThe default maximum number of pre-gen keys.protected static java.math.BigIntegerEXPRSA exponent.protected static booleanPARALLEL_MODEGenerating keys in parallel.protected java.util.concurrent.BlockingQueue<org.bouncycastle.crypto.AsymmetricCipherKeyPair>pregenkeysPre-generated keys.protected booleanrunningRunning flag.protected java.util.concurrent.CyclicBarriershutdownbarrierBarrier for coordinating shutdown.protected java.lang.RunnabletaskGeneration task.
-
Constructor Summary
Constructors Constructor Description RsaKeyProvider()Creates the provider.RsaKeyProvider(int keysize)Creates the provider.RsaKeyProvider(int keysize, int maxkeys)Creates the provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.crypto.AsymmetricCipherKeyPairgetKeyPair()Returns a random key pair.voidstart(IThreadExecutor texec)Starts the key generation.voidstop()Stops the key generation.
-
-
-
Field Detail
-
EXP
protected static final java.math.BigInteger EXP
RSA exponent.
-
DEFAULT_KEY_SIZE
protected static final int DEFAULT_KEY_SIZE
The default key size.- See Also:
- Constant Field Values
-
DEFAULT_MAX_KEYS
protected static final int DEFAULT_MAX_KEYS
The default maximum number of pre-gen keys.- See Also:
- Constant Field Values
-
PARALLEL_MODE
protected static final boolean PARALLEL_MODE
Generating keys in parallel.- See Also:
- Constant Field Values
-
pregenkeys
protected java.util.concurrent.BlockingQueue<org.bouncycastle.crypto.AsymmetricCipherKeyPair> pregenkeys
Pre-generated keys.
-
running
protected volatile boolean running
Running flag.
-
shutdownbarrier
protected java.util.concurrent.CyclicBarrier shutdownbarrier
Barrier for coordinating shutdown.
-
task
protected java.lang.Runnable task
Generation task.
-
-
Method Detail
-
start
public void start(IThreadExecutor texec)
Starts the key generation.
-
stop
public void stop()
Stops the key generation.
-
getKeyPair
public org.bouncycastle.crypto.AsymmetricCipherKeyPair getKeyPair()
Returns a random key pair.- Specified by:
getKeyPairin interfaceIKeyProvider- Returns:
- Key pair.
-
-