de.flexiprovider.ec.keys
Class ECPrivateKey

java.lang.Object
  |
  +--de.flexiprovider.api.keys.PrivateKey
        |
        +--de.flexiprovider.ec.keys.ECPrivateKey
All Implemented Interfaces:
java.security.Key, Key, java.security.PrivateKey, java.io.Serializable

public class ECPrivateKey
extends PrivateKey

The interface to an EC private key. The private key is an integer s in the range [1, r - 1], where r is a prime and part of the DomainParameters (see CurveParams).

Author:
Birgit Henhapl, Michele Boivin
See Also:
ECPublicKey, Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Constructor Summary
protected ECPrivateKey(ECPrivateKeySpec keySpec)
          Construct an ECPrivateKey out of the given key specification.
protected ECPrivateKey(FlexiBigInt s, CurveParams params)
          Generate a new ECPrivateKey with the specified parameters.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare this private key with another object.
 java.lang.String getAlgorithm()
           
protected  codec.asn1.ASN1Type getAlgParams()
           
protected  byte[] getKeyData()
           
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
 CurveParams getParams()
          Returns the corresponding ecdomain parameters.
 FlexiBigInt getS()
           
 int hashCode()
           
 java.lang.String toString()
          This method returns this private key s with its corresponding ECParameterSpec as String.
 
Methods inherited from class de.flexiprovider.api.keys.PrivateKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ECPrivateKey

protected ECPrivateKey(FlexiBigInt s,
                       CurveParams params)
Generate a new ECPrivateKey with the specified parameters.
Parameters:
s - the FlexiBigInt that represents the private key
params - the parameters

ECPrivateKey

protected ECPrivateKey(ECPrivateKeySpec keySpec)
Construct an ECPrivateKey out of the given key specification.
Parameters:
keySpec - the key specification
Method Detail

getS

public FlexiBigInt getS()
Returns:
the private key s

getAlgorithm

public java.lang.String getAlgorithm()
Returns:
the name of the algorithm

toString

public java.lang.String toString()
This method returns this private key s with its corresponding ECParameterSpec as String. The format is:
s = ...
q = ...
a = ...
b = ...
G = (xG, yG)
r = ...
k = ...
Overrides:
toString in class java.lang.Object
Returns:
the private key and its corresponding ecparameters as String
See Also:
CurveParams

getParams

public CurveParams getParams()
Returns the corresponding ecdomain parameters.
Returns:
the corresponding ecdomain parameters.

equals

public boolean equals(java.lang.Object obj)
Compare this private key with another object.
Overrides:
equals in class java.lang.Object
Parameters:
obj - another object
Returns:
the result of the comparison

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getOID

protected codec.asn1.ASN1ObjectIdentifier getOID()
Overrides:
getOID in class PrivateKey
Returns:
the OID to encode in the SubjectPublicKeyInfo structure

getAlgParams

protected codec.asn1.ASN1Type getAlgParams()
Overrides:
getAlgParams in class PrivateKey
Returns:
the algorithm parameters to encode in the SubjectPublicKeyInfo structure

getKeyData

protected byte[] getKeyData()
Overrides:
getKeyData in class PrivateKey
Returns:
the keyData to encode in the SubjectPublicKeyInfo structure