SunSPOT host API V3.0


com.sun.squawk.security.signing
Class ECKeyPair

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

public final class ECKeyPair
extends Object

This class is a container for a key pair (a public key and a private key). It does not enforce any security, and, when initialized, should be treated like a PrivateKey.

In addition, this class features a key generation method.

See Also:
PublicKey, PrivateKey

Field Summary
static byte ALG_EC_FP
          KeyPair object containing an EC key pair for EC operations over large prime fields.
 
Constructor Summary
ECKeyPair()
          Constructs a KeyPair instance for the specified algorithm and key length; the encapsulated keys are uninitialized.
ECKeyPair(ECPublicKey publicKey, ECPrivateKey privateKey)
          Constructs a new KeyPair object containing the specified public key and private key.
 
Method Summary
 void genKeyPair()
          (Re)Initializes the key objects encapsulated in this KeyPair instance with new key values.
 ECPrivateKey getPrivate()
          Returns a reference to the private key component of this KeyPair object.
 ECPublicKey getPublic()
          Returns a reference to the public key component of this KeyPair object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALG_EC_FP

public static final byte ALG_EC_FP
KeyPair object containing an EC key pair for EC operations over large prime fields.

See Also:
Constant Field Values
Constructor Detail

ECKeyPair

public ECKeyPair()
Constructs a KeyPair instance for the specified algorithm and key length; the encapsulated keys are uninitialized. To initialize the KeyPair instance use the genKeyPair() method.

The encapsulated key objects implement the appropriate Key interface associated with the specified algorithm (example - ECPublicKey interface for the public key and ECPrivateKey interface for the private key within an ALG_EC_FP key pair).

See Also:
Signature

ECKeyPair

public ECKeyPair(ECPublicKey publicKey,
                 ECPrivateKey privateKey)
Constructs a new KeyPair object containing the specified public key and private key.

Note that this constructor only stores references to the public and private key components in the generated KeyPair object. It does not throw an exception if the key parameter objects are uninitialized.

Parameters:
publicKey - the public key
privateKey - the private key
Method Detail

genKeyPair

public void genKeyPair()
(Re)Initializes the key objects encapsulated in this KeyPair instance with new key values. The initialized public and private key objects encapsulated in this instance will then be suitable for use with the Signature, Cipher and KeyAgreement objects. An internal secure random number generator is used during new key pair generation.

See Also:
Signature, javacardx.crypto.Cipher, ECKey

getPublic

public ECPublicKey getPublic()
Returns a reference to the public key component of this KeyPair object.

Returns:
a reference to the public key

getPrivate

public ECPrivateKey getPrivate()
Returns a reference to the private key component of this KeyPair object.

Returns:
a reference to the private key

SunSPOT host API V3.0


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