IAIK ECC
version 2.18

iaik.security.ecc.util
Class PointCoDecImpl

java.lang.Object
  extended byiaik.security.ecc.util.PointCoDecImpl
All Implemented Interfaces:
PointCoDec

public class PointCoDecImpl
extends java.lang.Object
implements PointCoDec

Implements the PointCodec Interface. Tries to load the Pointcompressor class and if the succeeds the point compression is enabled.


Field Summary
protected  PointCompressor decompressor_
          The compressor implementation.
protected  int supportedCompressions_
          depends on the supported compression methods.
protected  boolean verifyOnCurve_
          if true the getPoint method evaluates if the new point is indeed on the curve.
 
Fields inherited from interface iaik.security.ecc.util.PointCoDec
COMPRESSED, PC_COMPRESSED, PC_UNCOMPRESSED, UNCOMPRESSED
 
Constructor Summary
protected PointCoDecImpl()
          Default constructor tries to load the decompressor class and if this succeeds the point compression will be available.
 
Method Summary
protected  AffineCoordinate compressed(byte[] point, EllipticCurve curve)
          Performs the Octet String to Point conversation for compressed points.
 AffineCoordinate decodePoint(byte[] encodedPoint, EllipticCurve curve)
          Performs the Octet String to Point conversation as defined in ANSI X9.62.
 byte[] encodePoint(AffineCoordinate coordinate, int compressionAlgorithm)
          Encodes the coordinates.
 int getSupportedCompressions()
          Returns all supported compression algorithms.
 boolean getVerifyPoint()
          The last step of the Octet String to Point conversation can check if the calculated point indeed is on the curve.
 void setVerifyPoint(boolean doCheck)
          The last step of the Octet String to Point conversation can check if the calculated point indeed is on the curve.
protected  AffineCoordinate uncompressed(byte[] point, EllipticCurve curve)
          Performs the Octet String to Point conversation for uncompressed points
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decompressor_

protected PointCompressor decompressor_
The compressor implementation. If null point compression is disabled.


supportedCompressions_

protected int supportedCompressions_
depends on the supported compression methods.


verifyOnCurve_

protected boolean verifyOnCurve_
if true the getPoint method evaluates if the new point is indeed on the curve.

Constructor Detail

PointCoDecImpl

protected PointCoDecImpl()
Default constructor tries to load the decompressor class and if this succeeds the point compression will be available.

Method Detail

decodePoint

public AffineCoordinate decodePoint(byte[] encodedPoint,
                                    EllipticCurve curve)
                             throws ECCException
Performs the Octet String to Point conversation as defined in ANSI X9.62. If the point uses a compressed format, this class tries to load the decompression classes by name, which might not be available in all distributions.

Specified by:
decodePoint in interface PointCoDec
Parameters:
encodedPoint - the encoded point as byte array.
curve - the elliptic curve containing the encoded point.
Returns:
the coordinates of the encoded point.
Throws:
ECCException - if the decoding algorithm is not implemented (e.g. point decompression)
See Also:
PointCompressor

encodePoint

public byte[] encodePoint(AffineCoordinate coordinate,
                          int compressionAlgorithm)
                   throws ECCException
Encodes the coordinates.

Specified by:
encodePoint in interface PointCoDec
Parameters:
coordinate - the X and Y coordinates to be encoded
compressionAlgorithm - the allowed compression algorithm(s). If more than one the uncompressed form will be used.
Returns:
the encoded point as required by the ASN.1 syntax.
Throws:
ECCException - if the point compression algorithm is not supported.
See Also:
PointCoDec.encodePoint(iaik.security.ecc.math.ecgroup.AffineCoordinate, int)

getSupportedCompressions

public int getSupportedCompressions()
Description copied from interface: PointCoDec
Returns all supported compression algorithms.

Specified by:
getSupportedCompressions in interface PointCoDec
Returns:
one of the defined constants or combination of them.
See Also:
PointCoDec.getSupportedCompressions()

getVerifyPoint

public boolean getVerifyPoint()
The last step of the Octet String to Point conversation can check if the calculated point indeed is on the curve.

Returns:
true if the check is enabled.

setVerifyPoint

public void setVerifyPoint(boolean doCheck)
The last step of the Octet String to Point conversation can check if the calculated point indeed is on the curve. With this method you can swith on/off this feature. On default this feature is disabled.

Parameters:
doCheck - if true the check will be performed

compressed

protected AffineCoordinate compressed(byte[] point,
                                      EllipticCurve curve)
                               throws ECCException
Performs the Octet String to Point conversation for compressed points. This may cause patent issues. Depending of the existence of the proper class this method may cause an exception.

Parameters:
point - the octet string to be converted into a point, including the PC byte.
curve - the elliptic curve, where the point should be on.
Throws:
ECCException - if the point data is invalid or the implementation is not available

uncompressed

protected AffineCoordinate uncompressed(byte[] point,
                                        EllipticCurve curve)
                                 throws ECCException
Performs the Octet String to Point conversation for uncompressed points

Parameters:
point - the octet string to be converted into a point, including the PC byte.
curve - the elliptic curve, where the point should be on.
Throws:
ECCException - if the point data is invalid

IAIK ECC
version 2.18

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