Skip to content

Commit 2822960

Browse files
committed
Remove provider and let Chiper to traverse the providers list to find the most preferred one
1 parent c17ddfb commit 2822960

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

skygear/src/main/java/io/skygear/skygear/SecurePersistentStore.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ private Decryptor getDecryptor() {
150150
return decryptor;
151151
}
152152

153-
private String getRSACipherProvider() {
154-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
155-
return "AndroidOpenSSL";
156-
} else {
157-
return "AndroidKeyStoreBCWorkaround";
158-
}
159-
}
160-
161153
class Decryptor {
162154

163155
private KeyStore keyStore;
@@ -172,7 +164,7 @@ private byte[] rsaDecrypt(byte[] encrypted) throws KeyStoreException,
172164
}
173165
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStore.getEntry(
174166
KEY_ALIAS, null);
175-
Cipher output = Cipher.getInstance(RSA_MODE, getRSACipherProvider());
167+
Cipher output = Cipher.getInstance(RSA_MODE);
176168
output.init(Cipher.DECRYPT_MODE, privateKeyEntry.getPrivateKey());
177169
CipherInputStream cipherInputStream = new CipherInputStream(
178170
new ByteArrayInputStream(encrypted), output);
@@ -241,7 +233,7 @@ private byte[] rsaEncrypt(byte[] secret) throws NoSuchAlgorithmException,
241233
InvalidKeyException, InvalidAlgorithmParameterException, CertificateException,
242234
KeyStoreException, UnrecoverableEntryException {
243235
PublicKey publicKey = getRSAPublicKey();
244-
Cipher inputCipher = Cipher.getInstance(RSA_MODE, getRSACipherProvider());
236+
Cipher inputCipher = Cipher.getInstance(RSA_MODE);
245237
inputCipher.init(Cipher.ENCRYPT_MODE, publicKey);
246238

247239
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

0 commit comments

Comments
 (0)