Key (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacard.security
Interface Key

All Known Subinterfaces:
  AESKey, DESKey, DSAPrivateKey, DSAPublicKey, ECPrivateKey, ECPublicKey, HMACKey, KoreanSEEDKey, PrivateKey, PublicKey, RSAPrivateCrtKey, RSAPrivateKey, RSAPublicKey, SecretKey

    @TransactionType(value=NOT_SUPPORTED)
    @SensitiveType(sensitivity=INTEGRITY)
    public interface Key

The `Key` interface is the base interface for all keys.

A `Key` object sets its initialized state to true only when all the associated `Key` object parameters have been set at least once since the time the initialized state was set to false.

A newly created `Key` object sets its initialized state to false. Invocation of the `clearKey()` method sets the initialized state to false. A key with transient key data sets its initialized state to false on the associated clear events.

See Also:
  `KeyBuilder`

Method Summary
`void` | `clearKey()` Clears the key and sets its initialized state to false.
`short` | `getSize()` Returns the key size in number of bits.
`byte` | `getType()` Returns the key interface type.
`String` | `getTypeName()` Returns the name of the key interface type.
`boolean` | `isInitialized()` Reports the initialized state of the key.

Method Detail

### isInitialized

    boolean isInitialized()

  Reports the initialized state of the key. Keys must be initialized before being used.

  A `Key` object sets its initialized state to true only when all the associated `Key` object parameters have been set at least once since the time the initialized state was set to false.

  A newly created `Key` object sets its initialized state to false. Invocation of the `clearKey()` method sets the initialized state to false. A key with transient key data sets its initialized state to false on the associated clear events.

  Returns:
    `true` if the key has been initialized

### clearKey

    void clearKey()

  Clears the key and sets its initialized state to false.

### getType

    byte getType()

  Returns the key interface type. Pre-defined codes listed in `TYPE_*` constants, for example `TYPE_DES_TRANSIENT_RESET`.

  Returns:
    the key interface type; if the type is not one of the pre-defined types, `0` is returned.
  See Also:
    `KeyBuilder`

### getTypeName

    String getTypeName()

  Returns the name of the key interface type. Pre-defined names listed for each of the `TYPE_*` constants, for example `TYPE_DES_TRANSIENT_RESET`.

  New types may be defined through the Extensible Cryptography Framework.

  Returns:
    the name of the key interface type.
  See Also:
    `KeyBuilder`

### getSize

    short getSize()

  Returns the key size in number of bits. The size returned represents the capacity of the key.

  Returns:
    the key size in number of bits

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.