SunSPOT host API V3.0


com.sun.squawk.security.signing
Class ECPrivateKey

java.lang.Object
  extended by com.sun.squawk.security.signing.ECPrivateKey

public final class ECPrivateKey
extends Object

The ECPrivateKey interface is used to generate signatures on data using the ECDSA (Elliptic Curve Digital Signature Algorithm) and to generate shared secrets using the ECDH (Elliptic Curve Diffie-Hellman) algorithm. An implementation of ECPrivateKey interface must also implement the ECKey interface methods.

When the component of the key (S) is set, the key is initialized and ready for use.

The notation used to describe parameters specific to the EC algorithm is based on the naming conventions established in [IEEE P1363].

See Also:
ECPublicKey, KeyBuilder, Signature, KeyAgreement

Field Summary
protected  int bitsize
          Key size in bits
protected  int bytesize
           
protected  com.sun.squawk.security.ecc.ECCurveFp curve
           
protected  com.sun.squawk.security.ecc.FFA ffa
           
protected  boolean initOk
          Flag indicating if the key has been initialized.
protected  int[] keyData
           
protected  int keyLength
           
 
Constructor Summary
ECPrivateKey()
           
 
Method Summary
 void clearKey()
          Clears the key
 com.sun.squawk.security.ecc.ECCurveFp getCurve()
           
 int[] getKeyData()
           
 int getS(byte[] buffer, int offset)
          Returns the point of the curve comprising the public key in plain text form.
 int getSize()
           
 boolean isInitialized()
           
 void setS(byte[] buffer, int offset, int length)
          Sets the value of the secret key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bitsize

protected int bitsize
Key size in bits


bytesize

protected int bytesize

initOk

protected boolean initOk
Flag indicating if the key has been initialized.


curve

protected com.sun.squawk.security.ecc.ECCurveFp curve

ffa

protected com.sun.squawk.security.ecc.FFA ffa

keyData

protected int[] keyData

keyLength

protected int keyLength
Constructor Detail

ECPrivateKey

public ECPrivateKey()
Method Detail

setS

public void setS(byte[] buffer,
                 int offset,
                 int length)
          throws CryptoException
Sets the value of the secret key. The plain text data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte). Input parameter data is copied into the internal representation.

Parameters:
buffer - the input buffer
offset - the offset into the input buffer at which the secret value is to begin
length - the byte length of the secret value
Throws:
javacard.security.CryptoException - with the following reason code:
  • CryptoException.ILLEGAL_VALUE if the input key data is inconsistent with the elliptic curve.
CryptoException

getS

public int getS(byte[] buffer,
                int offset)
         throws CryptoException
Returns the point of the curve comprising the public key in plain text form. The point is represented as an octet string in compressed or uncompressed forms as per ANSI X9.62. The data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte).

Parameters:
buffer - the output buffer
offset - the offset into the output buffer at which the point specification data is to begin
Returns:
the byte length of the point specificiation
Throws:
com.sun.squawk.security.signing.CryptoException - with the following reason code:
  • CryptoException.UNINITIALIZED_KEY if the point of the curve comprising the public key has not been successfully initialized since the time the initialized state of the key was set to false.
CryptoException

clearKey

public void clearKey()
Clears the key


isInitialized

public boolean isInitialized()
Returns:
true if the key is initialized

getCurve

public com.sun.squawk.security.ecc.ECCurveFp getCurve()
Returns:
the curve associated with the key

getKeyData

public int[] getKeyData()
Returns:
internal representation of the key

getSize

public int getSize()
Returns:
Size of the key in bits

SunSPOT host API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.