summaryrefslogtreecommitdiff
path: root/keystore/java/android/security/LegacyVpnProfileStore.java
diff options
context:
space:
mode:
authorJanis Danisevskis <jdanis@google.com>2021-03-05 10:23:09 -0800
committerJanis Danisevskis <jdanis@google.com>2021-04-01 17:06:41 -0700
commita6dcf091f59083db52257bd5dc4af69cc22d7fd3 (patch)
treeb65b9b8e41f06b8de5cfbaab57f403a404ea1113 /keystore/java/android/security/LegacyVpnProfileStore.java
parentf11ccc456bfc5d0004d3ea398832e4ca16879b6e (diff)
Keystore 2.0: Remove Keystore 1.0 SPI with all remaining references
Bug: 171305684 Test: CtsKeystoreTestCases Change-Id: I337515dadc9e45b909bff058d4e13371b4fa843c
Diffstat (limited to 'keystore/java/android/security/LegacyVpnProfileStore.java')
-rw-r--r--keystore/java/android/security/LegacyVpnProfileStore.java37
1 files changed, 9 insertions, 28 deletions
diff --git a/keystore/java/android/security/LegacyVpnProfileStore.java b/keystore/java/android/security/LegacyVpnProfileStore.java
index 41cfb2707fcf..1d2738e71311 100644
--- a/keystore/java/android/security/LegacyVpnProfileStore.java
+++ b/keystore/java/android/security/LegacyVpnProfileStore.java
@@ -19,7 +19,6 @@ package android.security;
import android.annotation.NonNull;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
-import android.security.keystore.AndroidKeyStoreProvider;
import android.security.vpnprofilestore.IVpnProfileStore;
import android.util.Log;
@@ -53,13 +52,8 @@ public class LegacyVpnProfileStore {
*/
public static boolean put(@NonNull String alias, @NonNull byte[] profile) {
try {
- if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
- getService().put(alias, profile);
- return true;
- } else {
- return KeyStore.getInstance().put(
- alias, profile, KeyStore.UID_SELF, 0);
- }
+ getService().put(alias, profile);
+ return true;
} catch (Exception e) {
Log.e(TAG, "Failed to put vpn profile.", e);
return false;
@@ -77,11 +71,7 @@ public class LegacyVpnProfileStore {
*/
public static byte[] get(@NonNull String alias) {
try {
- if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
- return getService().get(alias);
- } else {
- return KeyStore.getInstance().get(alias, true /* suppressKeyNotFoundWarning */);
- }
+ return getService().get(alias);
} catch (ServiceSpecificException e) {
if (e.errorCode != PROFILE_NOT_FOUND) {
Log.e(TAG, "Failed to get vpn profile.", e);
@@ -100,12 +90,8 @@ public class LegacyVpnProfileStore {
*/
public static boolean remove(@NonNull String alias) {
try {
- if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
- getService().remove(alias);
- return true;
- } else {
- return KeyStore.getInstance().delete(alias);
- }
+ getService().remove(alias);
+ return true;
} catch (ServiceSpecificException e) {
if (e.errorCode != PROFILE_NOT_FOUND) {
Log.e(TAG, "Failed to remove vpn profile.", e);
@@ -124,16 +110,11 @@ public class LegacyVpnProfileStore {
*/
public static @NonNull String[] list(@NonNull String prefix) {
try {
- if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
- final String[] aliases = getService().list(prefix);
- for (int i = 0; i < aliases.length; ++i) {
- aliases[i] = aliases[i].substring(prefix.length());
- }
- return aliases;
- } else {
- final String[] result = KeyStore.getInstance().list(prefix);
- return result != null ? result : new String[0];
+ final String[] aliases = getService().list(prefix);
+ for (int i = 0; i < aliases.length; ++i) {
+ aliases[i] = aliases[i].substring(prefix.length());
}
+ return aliases;
} catch (Exception e) {
Log.e(TAG, "Failed to list vpn profiles.", e);
}