RSA BSAFE CRYPTO-J

Cryptographic Components for Java

JSAFE Javadoc JCE Javadoc Search

JSAFE_PublicKey Class Reference

This class holds public keys for all asymmetric operations and implements the JSAFE_Key interface.

See Overview of Crypto-J for background and reference material on using and understanding Crypto-J.

Note: Not all Crypto-J transformations have OIDs assigned to them. See Crypto-J Transformations and Their Associated Classes for a list of transformations that have assigned OIDs.

Copyright © RSA Security Inc., 1997-2005. All rights reserved.

Inheritance diagram for JSAFE_PublicKey:

JSAFE_Object JSAFE_Key List of all members.

Public Methods

String JSAFE_PublicKey:: getDevice ()
 Returns the name of the device of record. More...

String [] JSAFE_PublicKey:: getDeviceList ()
 Returns a String array that describes all the devices used to execute the transformation. More...

abstract String JSAFE_PublicKey:: getAlgorithm ()
 Returns the standard algorithm name. More...

abstract Object JSAFE_PublicKey:: clone () throws CloneNotSupportedException;
 Overrides the default clone to produce a deep clone. More...

String JSAFE_PublicKey:: getKeyWrappingFormat (boolean ber)
 Returns the name of the format to use when getting the data for key wrapping. More...

abstract boolean JSAFE_PublicKey:: dataEquals (Object obj)
 Compares only the data of the objects, ignoring token info, if any. More...

void JSAFE_PublicKey:: clearSensitiveData ()
 Clears sensitive data from an object. More...


Static Public Methods

JSAFE_PublicKey JSAFE_PublicKey:: getInstance (byte[] berInfo, int offset, String device) throws JSAFE_UnimplementedException
 Builds an object that contains the public key that is defined in berInfo, beginning at offset. More...

int JSAFE_PublicKey:: getNextBEROffset (byte[] keyBER, int offset) throws JSAFE_UnimplementedException
 Gets the next offset after the algorithm ID. More...

JSAFE_PublicKey JSAFE_PublicKey:: getInstance (String transformation, String device) throws JSAFE_UnimplementedException
 Builds an object that holds a public key for the transformation on the given device. More...


Member Function Documentation

void JSAFE_PublicKey::clearSensitiveData   [inline];
 

Clears sensitive data from an object. Although the finalizer clears the data, there is no guarantee the garbage collector will quickly call the finalizer. Allows a user to clear data as soon as possible. After calling clearSensitiveData(), an Init (not a ReInit) method is called to perform other operations with the object.

Implements JSAFE_Key.

abstract Object JSAFE_PublicKey::clone   throws CloneNotSupportedException; [inline, pure virtual];
 

Overrides the default clone to produce a deep clone.

Returns:
A copy of this object.
Exceptions:
CloneNotSupportedException If the object cannot be cloned.

Reimplemented from JSAFE_Object.

abstract boolean JSAFE_PublicKey::dataEquals Object    obj [pure virtual];
 

Compares only the data of the objects, ignoring token info, if any. If both objects are empty, returns false.

Parameters:
obj The object to compare with.
Returns:
A boolean. Returns true if the two objects contain the same data; false otherwise.

abstract String JSAFE_PublicKey::getAlgorithm   [pure virtual];
 

Returns the standard algorithm name.

Returns:
A String describing the algorithm.

Implements JSAFE_Key.

String JSAFE_PublicKey::getDevice   [inline];
 

Returns the name of the device of record. The choices are as follows: "choice1[/choice2[...[/choicen]]]". Possible device values are:

  • Java
  • Native
  • name of the specified device

Returns:
The device name.

Implements JSAFE_Key.

String [] JSAFE_PublicKey::getDeviceList   [inline];
 

Returns a String array that describes all the devices used to execute the transformation. Because a transformation often consists of component algorithms, the implementation can consist of several component objects. A device can perform one or more of the algorithms, but it may let Java or another device perform one or more. For example, because padding is not time consuming, a device might let the Crypto-J implementation perform padding. Returns the names of the devices used by each component.

Returns:
A String array that describes the device used for a specific component.

JSAFE_PublicKey JSAFE_PublicKey::getInstance String    transformation,
String    device
throws JSAFE_UnimplementedException [inline, static];
 

Builds an object that holds a public key for the transformation on the given device.

Parameters:
transformation The representation of the desired operation (for example, "RSA").
device A list of devices used to build the object (for example, "Java", "Native/Java").
Returns:
A new JSAFE_PublicKey object to use with objects that perform the transformation.
Exceptions:
JSAFE_UnimplementedException If the device or devices cannot perform the designated algorithm.

JSAFE_PublicKey JSAFE_PublicKey::getInstance byte    berInfo[],
int    offset,
String    device
throws JSAFE_UnimplementedException [inline, static];
 

Builds an object that contains the public key that is defined in berInfo, beginning at offset. This is the BER encoding of the public-key information. The specified device is used.

Parameters:
berInfo A byte array containing the BER encoding of the key.
offset The offset into berInfo where the encoding begins.
device A list of devices used to build the object.
Returns:
A new JSAFE_PublicKey object for the specified algorithm.
Exceptions:
JSAFE_UnimplementedException If the device or devices cannot perform the designated algorithm, or the toolkit cannot decode the BER encoding.

String JSAFE_PublicKey::getKeyWrappingFormat boolean    ber [inline];
 

Returns the name of the format to use when getting the data for key wrapping. Uses ber to specify whether the data returned should be BER-encoded or not.

Parameters:
ber A boolean indicating whether the data is wrapped BER-encoded (true) or not (false).
Returns:
A String that is the format name.

Implements JSAFE_Key.

int JSAFE_PublicKey::getNextBEROffset byte    keyBER[],
int    offset
throws JSAFE_UnimplementedException [inline, static];
 

Gets the next offset after the algorithm ID. Given the berAlgID, the BER encoding of the algorithm ID, beginning at offset, returns the index to the next byte in the array.

Parameters:
keyBER A byte array containing the BER encoding of a public key.
offset The offset into keyBER where the encoding begins.
Returns:
The index into keyBER of the byte following the key.
Exceptions:
JSAFE_UnimplementedException If the toolkit cannot decode the BER encoding.


Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 038-001001-3500-001-000 - 3.5