Fix tests from https://codereview.chromium.org/166143002/

Didn't account for test's usage of PrivateKey.
BUG=341500

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251476 0039d316-1c4b-4281-b951-d872f2087c98
parent 052d7e30
......@@ -21,6 +21,7 @@ public class AndroidKeyStoreTestUtil {
private static final String TAG = "AndroidKeyStoreTestUtil";
private static final DefaultAndroidKeyStore sKeyStore = new DefaultAndroidKeyStore();
/**
* Called from native code to create a PrivateKey object from its
* encoded PKCS#8 representation.
......@@ -28,7 +29,7 @@ public class AndroidKeyStoreTestUtil {
* @return new PrivateKey handle, or null in case of error.
*/
@CalledByNative
public static PrivateKey createPrivateKeyFromPKCS8(int type, byte[] encodedKey) {
public static AndroidPrivateKey createPrivateKeyFromPKCS8(int type, byte[] encodedKey) {
String algorithm = null;
switch (type) {
case PrivateKeyType.RSA:
......@@ -48,7 +49,7 @@ public class AndroidKeyStoreTestUtil {
KeyFactory factory = KeyFactory.getInstance(algorithm);
KeySpec ks = new PKCS8EncodedKeySpec(encodedKey);
PrivateKey key = factory.generatePrivate(ks);
return key;
return sKeyStore.createKey(key);
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "Could not create " + algorithm + " factory instance!");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment