IAIK ECC
version 2.18

iaik.security.ecc.ecdsa
Class ECPublicKey

java.lang.Object
  extended byiaik.x509.PublicKeyInfo
      extended byiaik.security.ecc.ecdsa.ECPublicKey
All Implemented Interfaces:
iaik.asn1.ASN1Type, java.lang.Cloneable, ECDSAKey, ECDSAPublicKey, java.security.Key, java.security.PublicKey, java.io.Serializable

public class ECPublicKey
extends iaik.x509.PublicKeyInfo
implements ECDSAPublicKey

Representation of a public key for the ECDSA algorithm and implementation of the PublicKey Interface. It is derived from PublicKeyInfo which makes it suitable for use in X.509 certificates.

See Also:
Serialized Form

Field Summary
protected static java.lang.String ALGORITHM
          the name of the algorithm
 
Fields inherited from class iaik.x509.PublicKeyInfo
public_key_algorithm
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
ECPublicKey(iaik.asn1.ASN1Object obj)
          Creates a new PublicKeyInfo from an ASN1Object.
ECPublicKey(byte[] arr)
          Creates a new PublicKey from an ASN.1 encoded DER byte array.
ECPublicKey(ECDSAParams p, ECPoint w)
          Creates a new public key
ECPublicKey(ECDSAPublicKeySpec spec)
          Creates a new public key from a spec.
ECPublicKey(java.io.InputStream is)
          Reads the DER or BER encoded public key info from an input stream.
 
Method Summary
protected  void decode(byte[] publicKey)
          Decodes an DER encoded ECPublic Key
protected  byte[] encode()
           
 java.lang.String getAlgorithm()
          Implementation of the interface methods.
 ECDSAParams getParameter()
           
 ECPoint getW()
           
 int hashCode()
          Returns the hash code of this ECPublicKey.
 java.lang.String toString()
           
 void validatePublicKey()
          validates the public key
 
Methods inherited from class iaik.x509.PublicKeyInfo
clone, createPublicKeyInfo, decode, equals, getEncoded, getFingerprint, getFormat, getPublicKey, getPublicKey, toASN1Object, writeTo
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Key
getEncoded, getFormat
 

Field Detail

ALGORITHM

protected static final java.lang.String ALGORITHM
the name of the algorithm

See Also:
getAlgorithm(), Constant Field Values
Constructor Detail

ECPublicKey

public ECPublicKey(iaik.asn1.ASN1Object obj)
            throws java.security.InvalidKeyException
Creates a new PublicKeyInfo from an ASN1Object.


ECPublicKey

public ECPublicKey(byte[] arr)
            throws java.security.InvalidKeyException
Creates a new PublicKey from an ASN.1 encoded DER byte array.


ECPublicKey

public ECPublicKey(ECDSAParams p,
                   ECPoint w)
Creates a new public key

Parameters:
p - the domain parameters of the elliptic curve
w - the point on the elliptic curve, satisfying W = s*G, where s is the private key

ECPublicKey

public ECPublicKey(ECDSAPublicKeySpec spec)
Creates a new public key from a spec.

Parameters:
spec - the key material

ECPublicKey

public ECPublicKey(java.io.InputStream is)
            throws java.security.InvalidKeyException,
                   java.io.IOException
Reads the DER or BER encoded public key info from an input stream.

Parameters:
is - the input stream providing the data
Throws:
java.security.InvalidKeyException - if the provided key data is invalid.
java.io.IOException - if the I/O error occurs
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Implementation of the interface methods.

Specified by:
getAlgorithm in interface java.security.Key
Returns:
"ECDSA"

getParameter

public ECDSAParams getParameter()
Specified by:
getParameter in interface ECDSAKey
Returns:
the elliptic curve domain parameters.
See Also:
PublicKeyInfo.getPublicKey(byte[])

getW

public ECPoint getW()
Specified by:
getW in interface ECDSAPublicKey
Returns:
the public key = point on the elliptic curve
See Also:
getParameter()

hashCode

public int hashCode()
Returns the hash code of this ECPublicKey.

Returns:
the hash code of this ECPublicKey.

toString

public java.lang.String toString()
Returns:
a human readable format containing the point w and the parameters.

validatePublicKey

public void validatePublicKey()
validates the public key


decode

protected void decode(byte[] publicKey)
               throws java.security.InvalidKeyException
Decodes an DER encoded ECPublic Key

Parameters:
publicKey - the DER encoded key
Throws:
java.security.InvalidKeyException - if the encoded key is invalid or the encoded parameters are not supported.

encode

protected byte[] encode()
Returns:
the DER encoded ASN.1 public key

IAIK ECC
version 2.18

IAIK-ECC 2.18, (c) 2002 IAIK, (c) 2003 SIC