|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.jss.SecretDecoderRing.KeyManager
public class KeyManager
Creates, finds, and deletes keys for SecretDecoderRing.
Field Summary | |
---|---|
static KeyGenAlgorithm |
DEFAULT_KEYGEN_ALG
The default key generation algorithm, currently DES3. |
static int |
DEFAULT_KEYSIZE
The default key size (in bytes). |
Constructor Summary | |
---|---|
KeyManager(CryptoToken token)
Creates a new KeyManager using the given CryptoToken. |
Method Summary | |
---|---|
void |
deleteKey(byte[] keyID)
Deletes the key with the given keyID from this token. |
void |
deleteKey(javax.crypto.SecretKey key)
Deletes this key from this token. |
byte[] |
generateKey()
Generates an SDR key with the default algorithm and key size. |
byte[] |
generateKey(KeyGenAlgorithm alg,
int keySize)
Generates an SDR key with the given algorithm and key size. |
javax.crypto.SecretKey |
lookupKey(EncryptionAlgorithm alg,
byte[] keyid)
Looks up the key on this token with the given algorithm and key ID. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final KeyGenAlgorithm DEFAULT_KEYGEN_ALG
public static final int DEFAULT_KEYSIZE
Constructor Detail |
---|
public KeyManager(CryptoToken token)
token
- The token on which this KeyManager operates.Method Detail |
---|
public byte[] generateKey() throws TokenException
TokenException
public byte[] generateKey(KeyGenAlgorithm alg, int keySize) throws TokenException
keySize
- Length of key in bytes. This is only relevant for
algorithms that take more than one key size. Otherwise it can just
be set to 0.
TokenException
public javax.crypto.SecretKey lookupKey(EncryptionAlgorithm alg, byte[] keyid) throws TokenException
alg
- The algorithm that this key will be used for.
This is necessary because it will be stored along with the
key for later use by the security library. It should match
the actual algorithm of the key you are looking for. If you
pass in a different algorithm and try to use the key that is returned,
the results are undefined.
TokenException
public void deleteKey(byte[] keyID) throws TokenException, java.security.InvalidKeyException
java.security.InvalidKeyException
- If the key does not exist on this token.
TokenException
public void deleteKey(javax.crypto.SecretKey key) throws TokenException, java.security.InvalidKeyException
java.security.InvalidKeyException
- If the key does not reside on this token,
or is not a JSS key.
TokenException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |