public interface CryptoStore
| Modifier and Type | Method and Description |
|---|---|
void |
deleteCert(X509Certificate cert)
Deletes a certificate from a token.
|
void |
deletePrivateKey(PrivateKey key)
Deletes the given PrivateKey from the CryptoToken.
|
X509Certificate[] |
getCertificates()
Returns all user certificates stored on this token.
|
byte[] |
getEncryptedPrivateKeyInfo(KeyGenerator.CharToByteConverter conv,
Password pw,
Algorithm alg,
int n,
PrivateKey k)
Get an encrypted private key, with optional password
conversion.
|
byte[] |
getEncryptedPrivateKeyInfo(X509Certificate cert,
PBEAlgorithm pbeAlg,
Password pw,
int iteration)
Get an encrypted private key for the given cert.
|
PrivateKey[] |
getPrivateKeys()
Returns all private keys stored on this token.
|
SymmetricKey[] |
getSymmetricKeys()
Returns all symmetric keys stored on this token.
|
void |
importEncryptedPrivateKeyInfo(KeyGenerator.CharToByteConverter conv,
Password pw,
java.lang.String nickname,
java.security.PublicKey pubKey,
byte[] epkiBytes) |
PrivateKey |
importPrivateKey(byte[] key,
PrivateKey.Type type)
Imports a raw private key into this token (permanently).
|
PrivateKey |
importPrivateKey(byte[] key,
PrivateKey.Type type,
boolean temporary)
Imports a raw private key into this token.
|
PrivateKey importPrivateKey(byte[] key, PrivateKey.Type type) throws TokenException, KeyAlreadyImportedException
key - The private key.TokenException - If the key cannot be imported to this token.KeyAlreadyImportedException - If the key already exists on this token.PrivateKey importPrivateKey(byte[] key, PrivateKey.Type type, boolean temporary) throws TokenException, KeyAlreadyImportedException
key - The private key.temporary - Whether the key should be temporary.TokenException - If the key cannot be imported to this token.KeyAlreadyImportedException - If the key already exists on this token.PrivateKey[] getPrivateKeys() throws TokenException
TokenException - If an error occurs on the token while
gathering the keys.SymmetricKey[] getSymmetricKeys() throws TokenException
TokenException - If an error occurs on the token while
gathering the keys.void deletePrivateKey(PrivateKey key) throws NoSuchItemOnTokenException, TokenException
key - A PrivateKey to be permanently deleted. It must reside
on this token.NoSuchItemOnTokenException - If the given private key does
not reside on this token.TokenException - If an error occurs on the token while
deleting the key.byte[] getEncryptedPrivateKeyInfo(X509Certificate cert, PBEAlgorithm pbeAlg, Password pw, int iteration) throws CryptoManager.NotInitializedException, ObjectNotFoundException, TokenException
cert - Certificate of key to be exportedpbeAlg - The PBEAlgorithm to usepw - The password to encrypt withiteration - Iteration count; default of 2000 if le 0CryptoManager.NotInitializedExceptionObjectNotFoundExceptionTokenExceptionbyte[] getEncryptedPrivateKeyInfo(KeyGenerator.CharToByteConverter conv, Password pw, Algorithm alg, int n, PrivateKey k)
conv - Password converter. If null, pw.getByteCopy()
will be used to get password bytes.pw - The passwordalg - The encryption algorithmn - Iteration count; default of 2000 if le 0k - The private keyvoid importEncryptedPrivateKeyInfo(KeyGenerator.CharToByteConverter conv, Password pw, java.lang.String nickname, java.security.PublicKey pubKey, byte[] epkiBytes)
conv - Password converter. If null, pw.getByteCopy()
will be used to get password bytes.pw - The passwordnickname - Nickname to use for private keypubKey - Public key corresponding to private keyX509Certificate[] getCertificates() throws TokenException
TokenException - If an error occurs on the token while
gathering the certificates.void deleteCert(X509Certificate cert) throws NoSuchItemOnTokenException, TokenException
cert - A certificate to be deleted from this token. The cert
must actually reside on this token.NoSuchItemOnTokenException - If the given cert does not
reside on this token.TokenException - If an error occurred on the token while
deleting the certificate.