org.mozilla.jss.pkcs11

Class PK11KeyGenerator

public final class PK11KeyGenerator extends Object implements KeyGenerator

Method Summary
SymmetricKeyclone(SymmetricKey key)
Allows a SymmetricKey to be cloned on a different token.
static SymmetricKeyclone(SymmetricKey key, PK11Token token)
Allows a SymmetricKey to be cloned on a different token.
SymmetricKeygenerate()
Generates the key.
byte[]generatePBE_IV()
Generates an Initialization Vector using a PBE algorithm.
voidinitialize(int strength)
voidinitialize(AlgorithmParameterSpec parameters)
voidsensitiveKeys(boolean sensitive)
voidsetCharToByteConverter(KeyGenerator.CharToByteConverter charToByte)
Sets the character to byte converter for passwords.
voidsetKeyUsages(SymmetricKey.Usage[] usages)
voidtemporaryKeys(boolean temp)

Method Detail

clone

public SymmetricKey clone(SymmetricKey key)
Allows a SymmetricKey to be cloned on a different token.

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

clone

public static SymmetricKey clone(SymmetricKey key, PK11Token token)
Allows a SymmetricKey to be cloned on a different token.

Parameters: key The key to clone. token The token on which to clone the key.

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

generate

public SymmetricKey generate()
Generates the key. This is the public interface, the actual work is done by native methods.

generatePBE_IV

public byte[] generatePBE_IV()
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.

initialize

public void initialize(int strength)

Parameters: strength Key size in bits. Must be evenly divisible by 8.

initialize

public void initialize(AlgorithmParameterSpec parameters)

sensitiveKeys

public void sensitiveKeys(boolean sensitive)

setCharToByteConverter

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

setKeyUsages

public void setKeyUsages(SymmetricKey.Usage[] usages)

temporaryKeys

public void temporaryKeys(boolean temp)