use of java.security.KeyStore.SecretKeyEntry in project platform_frameworks_base by android.
the class AndroidKeyStoreSpi method engineSetEntry.
@Override
public void engineSetEntry(String alias, Entry entry, ProtectionParameter param) throws KeyStoreException {
if (entry == null) {
throw new KeyStoreException("entry == null");
}
Credentials.deleteAllTypesForAlias(mKeyStore, alias, mUid);
if (entry instanceof java.security.KeyStore.TrustedCertificateEntry) {
java.security.KeyStore.TrustedCertificateEntry trE = (java.security.KeyStore.TrustedCertificateEntry) entry;
engineSetCertificateEntry(alias, trE.getTrustedCertificate());
return;
}
if (entry instanceof PrivateKeyEntry) {
PrivateKeyEntry prE = (PrivateKeyEntry) entry;
setPrivateKeyEntry(alias, prE.getPrivateKey(), prE.getCertificateChain(), param);
} else if (entry instanceof SecretKeyEntry) {
SecretKeyEntry secE = (SecretKeyEntry) entry;
setSecretKeyEntry(alias, secE.getSecretKey(), param);
} else {
throw new KeyStoreException("Entry must be a PrivateKeyEntry, SecretKeyEntry or TrustedCertificateEntry" + "; was " + entry);
}
}
use of java.security.KeyStore.SecretKeyEntry 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 java.security.KeyStore.SecretKeyEntry 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 java.security.KeyStore.SecretKeyEntry 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));
}
use of java.security.KeyStore.SecretKeyEntry in project android_frameworks_base by DirtyUnicorns.
the class AndroidKeyStoreSpi method engineSetEntry.
@Override
public void engineSetEntry(String alias, Entry entry, ProtectionParameter param) throws KeyStoreException {
if (entry == null) {
throw new KeyStoreException("entry == null");
}
Credentials.deleteAllTypesForAlias(mKeyStore, alias, mUid);
if (entry instanceof java.security.KeyStore.TrustedCertificateEntry) {
java.security.KeyStore.TrustedCertificateEntry trE = (java.security.KeyStore.TrustedCertificateEntry) entry;
engineSetCertificateEntry(alias, trE.getTrustedCertificate());
return;
}
if (entry instanceof PrivateKeyEntry) {
PrivateKeyEntry prE = (PrivateKeyEntry) entry;
setPrivateKeyEntry(alias, prE.getPrivateKey(), prE.getCertificateChain(), param);
} else if (entry instanceof SecretKeyEntry) {
SecretKeyEntry secE = (SecretKeyEntry) entry;
setSecretKeyEntry(alias, secE.getSecretKey(), param);
} else {
throw new KeyStoreException("Entry must be a PrivateKeyEntry, SecretKeyEntry or TrustedCertificateEntry" + "; was " + entry);
}
}
Aggregations