Merge "Keystore 2.0: Fix diagnosing invalid key in CipherSpiBase."
This commit is contained in:
@@ -123,8 +123,9 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
|
||||
throws InvalidKeyException {
|
||||
resetAll();
|
||||
|
||||
if (!(key instanceof AndroidKeyStorePrivateKey
|
||||
|| key instanceof AndroidKeyStoreSecretKey)) {
|
||||
// Public key operations get diverted to the default provider.
|
||||
if (opmode == Cipher.ENCRYPT_MODE
|
||||
&& (key instanceof PrivateKey || key instanceof PublicKey)) {
|
||||
try {
|
||||
mCipher = Cipher.getInstance(getTransform());
|
||||
String transform = getTransform();
|
||||
@@ -184,8 +185,9 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
|
||||
SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
resetAll();
|
||||
|
||||
if (!(key instanceof AndroidKeyStorePrivateKey
|
||||
|| key instanceof AndroidKeyStoreSecretKey)) {
|
||||
// Public key operations get diverted to the default provider.
|
||||
if (opmode == Cipher.ENCRYPT_MODE
|
||||
&& (key instanceof PrivateKey || key instanceof PublicKey)) {
|
||||
try {
|
||||
mCipher = Cipher.getInstance(getTransform());
|
||||
mCipher.init(opmode, key, params, random);
|
||||
@@ -213,8 +215,9 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
|
||||
SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
resetAll();
|
||||
|
||||
if (!(key instanceof AndroidKeyStorePrivateKey
|
||||
|| key instanceof AndroidKeyStoreSecretKey)) {
|
||||
// Public key operations get diverted to the default provider.
|
||||
if (opmode == Cipher.ENCRYPT_MODE
|
||||
&& (key instanceof PrivateKey || key instanceof PublicKey)) {
|
||||
try {
|
||||
mCipher = Cipher.getInstance(getTransform());
|
||||
mCipher.init(opmode, key, params, random);
|
||||
|
||||
Reference in New Issue
Block a user