use of javax.crypto.spec.SecretKeySpec in project nhin-d by DirectProject.
the class AbstractPKCS11TokenKeyStoreProtectionManager method setPrivateKeyProtectionKeyAsString.
/**
* {@inheritDoc}
*/
@Override
public void setPrivateKeyProtectionKeyAsString(String key) throws CryptoException {
try {
final Key keySpec = new SecretKeySpec(key.getBytes(), "");
safeSetKeyWithRetry(privateKeyPassPhraseAlias, keySpec);
} catch (CryptoException e) {
throw e;
} catch (Exception e) {
throw new CryptoException("Error storing key store protection into PKCS11 token", e);
}
}
use of javax.crypto.spec.SecretKeySpec in project nhin-d by DirectProject.
the class AbstractPKCS11TokenKeyStoreProtectionManager method setKeyStoreProtectionKeyAsBytes.
/**
* {@inheritDoc}
*/
@Override
public void setKeyStoreProtectionKeyAsBytes(byte[] key) throws CryptoException {
try {
final Key keySpec = new SecretKeySpec(key, "");
safeSetKeyWithRetry(keyStorePassPhraseAlias, keySpec);
} catch (CryptoException e) {
throw e;
} catch (Exception e) {
throw new CryptoException("Error storing key store protection into PKCS11 token", e);
}
}
use of javax.crypto.spec.SecretKeySpec in project nhin-d by DirectProject.
the class BootstrappedKeyStoreProtectionManager method setPrivateKeyProtectionKey.
/**
* Sets the pass phrase that protects the private keys in the key store as a byte array.
* @param privateKeyProtectionKey The pass phrase that protects the private keys in the key store as a byte array.
*/
public void setPrivateKeyProtectionKey(byte[] privateKeyProtectionKey) {
this.privateKeyProtectionKey = new SecretKeySpec(privateKeyProtectionKey, "");
keyEntries.put(PrivKeyProtKey, new SecretKeyEntry((SecretKey) this.privateKeyProtectionKey));
}
use of javax.crypto.spec.SecretKeySpec in project nhin-d by DirectProject.
the class BootstrappedKeyStoreProtectionManager method setPrivateKeyProtectionKey.
/**
* Sets the pass phrase that protects the private keys in the key store as a String.
* @param privateKeyProtectionKey The pass phrase that protects the private keys in the key store as a String.
*/
public void setPrivateKeyProtectionKey(String privateKeyProtectionKey) {
this.privateKeyProtectionKey = new SecretKeySpec(privateKeyProtectionKey.getBytes(), "");
keyEntries.put(PrivKeyProtKey, new SecretKeyEntry((SecretKey) this.privateKeyProtectionKey));
}
use of javax.crypto.spec.SecretKeySpec in project nhin-d by DirectProject.
the class BootstrappedKeyStoreProtectionManager method setKeyStoreProtectionKey.
/**
* Sets the pass phrase that protects the key store as a whole as a byte array.
* @param keyStoreProtectionKey The pass phrase that protects the key store as a whole as a byte array.
*/
public void setKeyStoreProtectionKey(byte[] keyStoreProtectionKey) {
this.keyStoreProtectionKey = new SecretKeySpec(keyStoreProtectionKey, "");
keyEntries.put(KeyStoreProtKey, new SecretKeyEntry((SecretKey) this.keyStoreProtectionKey));
}
Aggregations