de.flexiprovider.ec.keys
Class ECPublicKey
java.lang.Object
|
+--de.flexiprovider.api.keys.PublicKey
|
+--de.flexiprovider.ec.keys.ECPublicKey
- All Implemented Interfaces:
- java.security.Key, Key, java.security.PublicKey, java.io.Serializable
- public class ECPublicKey
- extends PublicKey
The interface to a EC public key. The public key is a point W,
built by W = sG, where G is generator of a
subgroup with order r, and where s is the private key,
an integer in the range [1, r - 1].
- Author:
- Birgit Henhapl, Michele Boivin
- See Also:
ECPrivateKey,
CurveParams,
Point, Serialized Form
| Fields inherited from interface java.security.Key |
serialVersionUID |
| Fields inherited from interface java.security.PublicKey |
serialVersionUID |
|
Constructor Summary |
protected |
ECPublicKey(byte[] encodedW)
Generate a new ECPublicKey out of the byte array encoding. |
protected |
ECPublicKey(Point w,
CurveParams params)
Generate a new ECPublicKey with the specified parameters. |
|
Method Summary |
boolean |
equals(java.lang.Object other)
Compare this public key with another object. |
java.lang.String |
getAlgorithm()
Returns the name of the algorithm. |
protected codec.asn1.ASN1Type |
getAlgParams()
|
byte[] |
getEncodedW()
|
protected byte[] |
getKeyData()
|
protected codec.asn1.ASN1ObjectIdentifier |
getOID()
|
CurveParams |
getParams()
This method returns the corresponding ECParameterSpec. |
Point |
getW()
|
int |
hashCode()
|
java.lang.String |
toString()
This method returns this public key W with its corresponding
ECParameterSpec as String. |
| Methods inherited from class java.lang.Object |
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
ECPublicKey
protected ECPublicKey(Point w,
CurveParams params)
- Generate a new ECPublicKey with the specified parameters.
- Parameters:
w - the point that represents the public keyparams - the EC domain parameters
ECPublicKey
protected ECPublicKey(byte[] encodedW)
- Generate a new ECPublicKey out of the byte array encoding.
- Parameters:
encodedW - the encoded point that represents the public key
getW
public Point getW()
throws InvalidKeyException
- Returns:
- the public key W
- Throws:
InvalidKeyException - if the key has not been initialized with EC domain
parameters yet.- See Also:
Point
getEncodedW
public byte[] getEncodedW()
- Returns:
- the uncompressed encoding of the public point W
getParams
public CurveParams getParams()
- This method returns the corresponding ECParameterSpec.
- Returns:
- the corresponding ECParameterSpec.
- See Also:
CurveParams
getAlgorithm
public java.lang.String getAlgorithm()
- Returns the name of the algorithm.
- Returns:
- the name of the algorithm.
toString
public java.lang.String toString()
- This method returns this public key W with its corresponding
ECParameterSpec as String. The format is:
W = (xW, yW)
q = ...
a = ...
b = ...
G = (xG, yG)
r = ...
k = ...
In case the public point can not be decoded as no parameters are defined,
it is printed as hex string with the format: W = (encoded) 0x...
- Overrides:
toString in class java.lang.Object
- Returns:
- the public key and its corresponding EC domain parameters as
String
- See Also:
CurveParams
equals
public boolean equals(java.lang.Object other)
- Compare this public key with another object.
- Overrides:
equals in class java.lang.Object
- Parameters:
other - the other object- Returns:
- the result of the comparison
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
- Returns:
- the hash code of this key
getOID
protected codec.asn1.ASN1ObjectIdentifier getOID()
- Overrides:
getOID in class PublicKey
- Returns:
- the OID to encode in the SubjectPublicKeyInfo structure
getAlgParams
protected codec.asn1.ASN1Type getAlgParams()
- Overrides:
getAlgParams in class PublicKey
- Returns:
- the algorithm parameters to encode in the SubjectPublicKeyInfo
structure
getKeyData
protected byte[] getKeyData()
- Overrides:
getKeyData in class PublicKey
- Returns:
- the keyData to encode in the SubjectPublicKeyInfo structure