| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectxjava.security.IJCE_Traceablexjava.security.Ciphercryptix.provider.elgamal.RawElGamalCipherField Summary |
Fields inherited from class xjava.security.Cipher | |
DECRYPT, ENCRYPT, UNINITIALIZED | |
Fields inherited from class xjava.security.IJCE_Traceable | |
tracing | |
Constructor Summary | |
| |
Method Summary | |
protected int |
|
protected Object |
|
protected void |
|
protected void |
|
protected int |
|
protected void |
|
protected int |
|
static void |
|
static void |
|
Methods inherited from class xjava.security.IJCE_Traceable | |
disableTracing, enableTracing, traceMethod, traceResult, traceResult, traceVoidMethod | |
protected int engineCiphertextBlockSize()
SPI: Return the ciphertext block size, in bytes. For ElGamal this is double the number of bytes needed to represent p-1. If the key has not been set, this method throws CryptixException (a subclass of ProviderException).
- Overrides:
- engineCiphertextBlockSize in interface Cipher
- Returns:
- the ciphertext block size
protected Object engineGetParameter(String param)
SPI: Return an algorithm-specific parameter. ElGamal has one algorithm-specific parameter called "random", as described above. It is guaranteed to be a subclass of java.util.Random. Calling this method with a param string other than "random" will return null.
- Overrides:
- engineGetParameter in interface Cipher
- Parameters:
param- the string name of the parameter.
- Returns:
- the object that represents the parameter value, or null if there is none.
protected void engineInitDecrypt(Key key)
throws KeyExceptionSPI: Initializes the cipher for decryption, using the given private key. The key object must implement java.security.interfaces.ElGamalPrivateKey.
- Overrides:
- engineInitDecrypt in interface Cipher
- Parameters:
key- the private key
protected void engineInitEncrypt(Key key)
throws KeyExceptionSPI: Initializes the cipher for encryption, using the given public key. The key object must implement java.security.interfaces.ElGamalPublicKey.
- Overrides:
- engineInitEncrypt in interface Cipher
- Parameters:
key- the public key
protected int enginePlaintextBlockSize()
SPI: Return the plaintext block size, in bytes. For ElGamal this is the number of bytes needed for a bit string one bit shorter than the prime, p. If the key has not been set, this method throws CryptixException (a subclass of ProviderException).
- Overrides:
- enginePlaintextBlockSize in interface Cipher
- Returns:
- the plaintext block size
protected void engineSetParameter(String param,
Object value)SPI: Set an algorithm-specific parameter. ElGamal has one algorithm-specific parameter called "random", of type java.util.Random, which specifies the source of random bits used to generate the k values needed for encryption. If this parameter is not set wheninitKeyis called, the result ofnew SecureRandom()will be used. You can set the "random" parameter using the following code:try { elgamal.setParameter("random", existingSecureRandom); } catch (InvalidParameterException e) { /* ignore */ } elgamal.initEncrypt(publicKey);This is not useful if the cipher will only be used for decryption.
- Overrides:
- engineSetParameter in interface Cipher
- Parameters:
param- the string identifier of the parameter.value- the parameter value.
protected int engineUpdate(byte[] in,
int inOffset,
int inLen,
byte[] out,
int outOffset)SPI: DOCUMENT ME
- Overrides:
- engineUpdate in interface Cipher
public static final void main(String[] args)
Entry point for very basicself_test.
public static void self_test(PrintWriter out)
throws KeyException