Java Card 2.1 Platform
Final Revision 1.0

javacard.security
Class KeyBuilder

java.lang.Object
  |
  +--javacard.security.KeyBuilder

public class KeyBuilder
extends Object

The KeyBuilder class is a key object factory.


Field Summary
static short LENGTH_DES
          DES Key Length LENGTH_DES = 64.
static short LENGTH_DES3_2KEY
          DES Key Length LENGTH_DES3_2KEY = 128.
static short LENGTH_DES3_3KEY
          DES Key Length LENGTH_DES3_3KEY = 192.
static short LENGTH_DSA_1024
          DSA Key Length LENGTH_DSA_1024 = 1024.
static short LENGTH_DSA_512
          DSA Key Length LENGTH_DSA_512 = 512.
static short LENGTH_DSA_768
          DSA Key Length LENGTH_DSA_768 = 768.
static short LENGTH_RSA_1024
          RSA Key Length LENGTH_RSA_1024 = 1024.
static short LENGTH_RSA_2048
          RSA Key Length LENGTH_RSA_2048 = 2048.
static short LENGTH_RSA_512
          RSA Key Length LENGTH_RSA_512 = 512.
static short LENGTH_RSA_768
          RSA Key Length LENGTH_RSA_768 = 768.
static byte TYPE_DES
          Key object which implements interface type DESKey with persistent key data.
static byte TYPE_DES_TRANSIENT_DESELECT
          Key object which implements interface type DESKey with CLEAR_ON_DESELECT transient key data.
static byte TYPE_DES_TRANSIENT_RESET
          Key object which implements interface type DESKey with CLEAR_ON_RESET transient key data.
static byte TYPE_DSA_PRIVATE
          Key object which implements the interface type DSAPrivateKey for the DSA algorithm.
static byte TYPE_DSA_PUBLIC
          Key object which implements the interface type DSAPublicKey for the DSA algorithm.
static byte TYPE_RSA_CRT_PRIVATE
          Key object which implements interface type RSAPrivateCrtKey which uses Chinese Remainder Theorem.
static byte TYPE_RSA_PRIVATE
          Key object which implements interface type RSAPrivateKey which uses modulus/exponent form.
static byte TYPE_RSA_PUBLIC
          Key object which implements interface type RSAPublicKey.
 
Method Summary
static Key buildKey(byte keyType, short keyLength, boolean keyEncryption)
          Creates cryptographic keys for signature and cipher algorithms.
 
Methods inherited from class java.lang.Object
equals
 

Field Detail

TYPE_DES_TRANSIENT_RESET

public static final byte TYPE_DES_TRANSIENT_RESET
Key object which implements interface type DESKey with CLEAR_ON_RESET transient key data.

This Key object implicitly performs a clearKey() on power on or card reset.


TYPE_DES_TRANSIENT_DESELECT

public static final byte TYPE_DES_TRANSIENT_DESELECT
Key object which implements interface type DESKey with CLEAR_ON_DESELECT transient key data.

This Key object implicitly performs a clearKey() on power on, card reset and applet deselection.


TYPE_DES

public static final byte TYPE_DES
Key object which implements interface type DESKey with persistent key data.

TYPE_RSA_PUBLIC

public static final byte TYPE_RSA_PUBLIC
Key object which implements interface type RSAPublicKey.

TYPE_RSA_PRIVATE

public static final byte TYPE_RSA_PRIVATE
Key object which implements interface type RSAPrivateKey which uses modulus/exponent form.

TYPE_RSA_CRT_PRIVATE

public static final byte TYPE_RSA_CRT_PRIVATE
Key object which implements interface type RSAPrivateCrtKey which uses Chinese Remainder Theorem.

TYPE_DSA_PUBLIC

public static final byte TYPE_DSA_PUBLIC
Key object which implements the interface type DSAPublicKey for the DSA algorithm.

TYPE_DSA_PRIVATE

public static final byte TYPE_DSA_PRIVATE
Key object which implements the interface type DSAPrivateKey for the DSA algorithm.

LENGTH_DES

public static final short LENGTH_DES
DES Key Length LENGTH_DES = 64.

LENGTH_DES3_2KEY

public static final short LENGTH_DES3_2KEY
DES Key Length LENGTH_DES3_2KEY = 128.

LENGTH_DES3_3KEY

public static final short LENGTH_DES3_3KEY
DES Key Length LENGTH_DES3_3KEY = 192.

LENGTH_RSA_512

public static final short LENGTH_RSA_512
RSA Key Length LENGTH_RSA_512 = 512.

LENGTH_RSA_768

public static final short LENGTH_RSA_768
RSA Key Length LENGTH_RSA_768 = 768.

LENGTH_RSA_1024

public static final short LENGTH_RSA_1024
RSA Key Length LENGTH_RSA_1024 = 1024.

LENGTH_RSA_2048

public static final short LENGTH_RSA_2048
RSA Key Length LENGTH_RSA_2048 = 2048.

LENGTH_DSA_512

public static final short LENGTH_DSA_512
DSA Key Length LENGTH_DSA_512 = 512.

LENGTH_DSA_768

public static final short LENGTH_DSA_768
DSA Key Length LENGTH_DSA_768 = 768.

LENGTH_DSA_1024

public static final short LENGTH_DSA_1024
DSA Key Length LENGTH_DSA_1024 = 1024.
Method Detail

buildKey

public static Key buildKey(byte keyType,
                           short keyLength,
                           boolean keyEncryption)
                    throws CryptoException
Creates cryptographic keys for signature and cipher algorithms. Instances created by this method may be the only key objects used to initialize instances of Signature and Cipher. Note that the object returned must be cast to their appropriate key type interface.
Parameters:
keyType - the type of key to be generated. Valid codes listed in TYPE.. constants.
keyLength - the key size in bits. The valid key bit lengths are key type dependent. See above.
keyEncryption - if true this boolean requests a key implementation which implements the javacardx.cipher.KeyEncryption interface.
Returns:
the key object instance of the requested key type, length and encrypted access.
Throws:
CryptoException - with the following reason codes:
  • CryptoException.NO_SUCH_ALGORITHM if the requested algorithm associated with the specified type, size of key and key encryption interface is not supported.

Submit a bug or feature

Java and Java Card are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc.
901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
All Rights Reserved.