public class ElGamalPrivateKey extends PrivateKeyInfo
private_key_algorithm| Constructor and Description |
|---|
ElGamalPrivateKey(ASN1Object obj)
Creates a new ElGamalPrivateKey from the given ASN.1 object.
|
ElGamalPrivateKey(java.math.BigInteger x,
ElGamalParameterSpec parameters)
Creates a new ElGamalPrivateKey from given private key value x and ElGamal parameter
specification
|
ElGamalPrivateKey(byte[] pk)
Creates a new ElGamalPrivateKey from the given DER encoded byte array.
|
ElGamalPrivateKey(ElGamalPrivateKeySpec keySpec)
Creates a new ElGamalPrivateKey from the given ElGamalPrivateKeySpec representing the
ElGamal private key value x, and the public values p, g and l.
|
ElGamalPrivateKey(java.io.InputStream is)
Creates a new ElGamalPrivateKey from an InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
decode(byte[] privateKey)
Decodes a DER encoded ElGamal private key.
|
byte[] |
encode()
Returns the raw ElGamal private key (not wrapped in a PKCS#8 PrivateKeyInfo) as
DER encoded ASN.1 object.
|
java.lang.String |
getAlgorithm()
Returns the name of the appertaining algorithm.
|
ElGamalParameterSpec |
getParams()
Returns the key parameters.
|
java.math.BigInteger |
getX()
Returns the private value
x as BigInteger. |
int |
hashCode()
Returns a hash code for this object.
|
java.lang.String |
toString()
Returns a string that represents the contents of this private key.
|
clone, createPrivateKeyInfo, decode, equals, getAlgorithmID, getEncoded, getFormat, getPrivateKey, getPrivateKey, getPrivateKey, getPrivateKey, toASN1Object, writeTopublic ElGamalPrivateKey(java.math.BigInteger x,
ElGamalParameterSpec parameters)
x - the BigInteger value representing the ElGamal private key valueparameters - the ElGamal parameters p (prime modulus), g (base generator) and l
(length of the private value x) as ElGamalParameterSpecpublic ElGamalPrivateKey(ElGamalPrivateKeySpec keySpec)
keySpec - the ElGamalPrivateKeySpec representing the private key value x, the
prime modulus p, the base generator g,
and the length l of the private valuejavax.crypto.spec.ElGamalPrivateKeySpecpublic ElGamalPrivateKey(byte[] pk)
throws java.security.InvalidKeyException
This constructor may be used for parsing an already existing ElGamal private
key, wrapped into a PKCS#8 PrivateKeyInfo that is supplied as DER encoded byte array.
pk - the byte array holding the DER encoded private key infojava.security.InvalidKeyException - if something is wrong with the key encodingpublic ElGamalPrivateKey(ASN1Object obj) throws java.security.InvalidKeyException
PrivateKeyInfo holding the ElGamal
private key.obj - the private key ASN.1 data structurejava.security.InvalidKeyException - if something is wrong with the key encodingpublic ElGamalPrivateKey(java.io.InputStream is)
throws java.io.IOException,
java.security.InvalidKeyException
This constructor may be used for parsing an already existing ElGamal private
key, wrapped into a PKCS#8 PrivateKeyInfo that is supplied as DER encoded byte array.
is - the input stream with the data to be read to initialize the
private keyjava.io.IOException - if an I/O error occursjava.security.InvalidKeyException - if something is wrong with the key encodingprotected void decode(byte[] privateKey)
throws java.security.InvalidKeyException
From the given DER encoded byte array an ASN.1 object is created and parsed
for the private key value x and the ElGamal parameters prime
p and base g, and - if included - the length
l of the private value x.
This method is protected and typically will not be used by an application.
Rather it is used by the parent PKCS#8
PrivateKeyInfo class for decoding
the inherent ElGamal private key.
decode in class PrivateKeyInfoprivateKey - the ElGamal private key as DER encoded ASN.1 objectjava.security.InvalidKeyException - if the given key is not a ElGamal private keypublic byte[] encode()
PrivateKeyInfo
class for encoding the inherent ElGamal private key.encode in class PrivateKeyInfopublic java.math.BigInteger getX()
x as BigInteger.
x as BigIntegerpublic ElGamalParameterSpec getParams()
public java.lang.String getAlgorithm()
getAlgorithm in interface java.security.KeygetAlgorithm in class PrivateKeyInfopublic int hashCode()
hashCode in class PrivateKeyInfopublic java.lang.String toString()
toString in class PrivateKeyInfo