You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.




org.mozilla.jss.crypto
Interface KeyGenerator

All Known Implementing Classes:
PK11KeyGenerator

Deprecated. Use the JCA interface instead (KeyGenerator)

public interface KeyGenerator

Generates symmetric keys for encryption and decryption.


Nested Class Summary
static interface KeyGenerator.CharToByteConverter
          Deprecated. An interface for converting a password of Java characters into an array of bytes.
 
Method Summary
 SymmetricKey clone(SymmetricKey key)
          Deprecated. Allows a SymmetricKey to be cloned on a different token.
 SymmetricKey generate()
          Deprecated. Generates a symmetric key.
 byte[] generatePBE_IV()
          Deprecated. Generates an Initialization Vector using a PBE algorithm.
 void initialize(java.security.spec.AlgorithmParameterSpec parameters)
          Deprecated.  
 void initialize(int strength)
          Deprecated.  
 void sensitiveKeys(boolean sensitive)
          Deprecated. Tells the generator to generate sensitive or insensitive keys.
 void setCharToByteConverter(KeyGenerator.CharToByteConverter charToByte)
          Deprecated. Sets the character to byte converter for passwords.
 void setKeyUsages(SymmetricKey.Usage[] usages)
          Deprecated.  
 void temporaryKeys(boolean temp)
          Deprecated. Tells the generator to generate temporary or permanent keys.
 

Method Detail

initialize

void initialize(int strength)
                throws java.security.InvalidAlgorithmParameterException
Deprecated. 
Parameters:
strength - Key size in bits. Must be evenly divisible by 8.
Throws:
java.security.InvalidAlgorithmParameterException

initialize

void initialize(java.security.spec.AlgorithmParameterSpec parameters)
                throws java.security.InvalidAlgorithmParameterException
Deprecated. 
Throws:
java.security.InvalidAlgorithmParameterException

setKeyUsages

void setKeyUsages(SymmetricKey.Usage[] usages)
Deprecated. 
Parameters:
usages - The operations the key will be used for after it is generated. You have to specify these so that the key can be properly marked with the operations it supports. Some PKCS #11 tokens require that a key be marked for an operation before it can perform that operation. The default is SymmetricKey.Usage.SIGN and SymmetricKey.Usage.ENCRYPT.

temporaryKeys

void temporaryKeys(boolean temp)
Deprecated. 
Tells the generator to generate temporary or permanent keys. Temporary keys are not written permanently to the token. They are destroyed by the garbage collector. If this method is not called, the default is temporary keys.


sensitiveKeys

void sensitiveKeys(boolean sensitive)
Deprecated. 
Tells the generator to generate sensitive or insensitive keys. Certain attributes of a sensitive key cannot be revealed in plaintext outside the token. If this method is not called, the default is token dependent.


generate

SymmetricKey generate()
                      throws java.lang.IllegalStateException,
                             TokenException,
                             java.io.CharConversionException
Deprecated. 
Generates a symmetric key.

Throws:
java.lang.IllegalStateException
TokenException
java.io.CharConversionException

generatePBE_IV

byte[] generatePBE_IV()
                      throws java.lang.IllegalStateException,
                             TokenException,
                             java.io.CharConversionException
Deprecated. 
Generates an Initialization Vector using a PBE algorithm. In order to call this method, the algorithm must be a PBE algorithm, and the KeyGenerator must have been initialized with an instance of PBEKeyGenParams.

Returns:
The initialization vector derived from the password and salt using the PBE algorithm.
Throws:
java.lang.IllegalStateException - If the algorithm is not a PBE algorithm, or the KeyGenerator has not been initialized with an instance of PBEKeyGenParams.
TokenException - If an error occurs on the CryptoToken while generating the IV.
java.io.CharConversionException

clone

SymmetricKey clone(SymmetricKey key)
                   throws SymmetricKey.NotExtractableException,
                          java.security.InvalidKeyException,
                          TokenException
Deprecated. 
Allows a SymmetricKey to be cloned on a different token.

Throws:
SymmetricKey.NotExtractableException - If the key material cannot be extracted from the current token.
java.security.InvalidKeyException - If the owning token cannot process the key to be cloned.
TokenException

setCharToByteConverter

void setCharToByteConverter(KeyGenerator.CharToByteConverter charToByte)
Deprecated. 
Sets the character to byte converter for passwords. The default conversion is UTF8 with no null termination.