Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: net/android/java/src/org/chromium/net/AndroidKeyStore.java

Issue 2391213002: Report curve types in ECDSA SSLPrivateKeys. (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/android/ssl_client_certificate_request.cc ('k') | net/android/keystore.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/android/java/src/org/chromium/net/AndroidKeyStore.java
diff --git a/net/android/java/src/org/chromium/net/AndroidKeyStore.java b/net/android/java/src/org/chromium/net/AndroidKeyStore.java
index b238d780b9ae59c8fde3f88786bd55fcfbf15ec3..1b1e23703c96b0a7c634b2abc5f63b6a9fbbc8c3 100644
--- a/net/android/java/src/org/chromium/net/AndroidKeyStore.java
+++ b/net/android/java/src/org/chromium/net/AndroidKeyStore.java
@@ -12,10 +12,7 @@ import java.lang.reflect.Method;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
-import java.security.interfaces.ECKey;
-import java.security.interfaces.RSAKey;
import java.security.interfaces.RSAPrivateKey;
-import java.security.spec.ECParameterSpec;
/**
* Specifies all the dependencies from the native OpenSSL engine on an Android KeyStore.
@@ -25,43 +22,6 @@ public class AndroidKeyStore {
private static final String TAG = "AndroidKeyStore";
/**
- * Returns the public modulus of a given RSA private key as a byte
- * buffer.
- * This can be used by native code to convert the modulus into
- * an OpenSSL BIGNUM object. Required to craft a custom native RSA
- * object where RSA_size() works as expected.
- *
- * @param privateKey A PrivateKey instance, must implement RSAKey.
- * @return A byte buffer corresponding to the modulus. This is
- * big-endian representation of a BigInteger.
- */
- @CalledByNative
- private static byte[] getRSAKeyModulus(PrivateKey privateKey) {
- if (privateKey instanceof RSAKey) {
- return ((RSAKey) privateKey).getModulus().toByteArray();
- }
- Log.w(TAG, "Not a RSAKey instance!");
- return null;
- }
-
- /**
- * Returns the 'order' parameter of a given ECDSA private key as a
- * a byte buffer.
- * @param privateKey A PrivateKey instance. Must implement ECKey.
- * @return A byte buffer corresponding to the 'order' parameter.
- * This is a big-endian representation of a BigInteger.
- */
- @CalledByNative
- private static byte[] getECKeyOrder(PrivateKey privateKey) {
- if (privateKey instanceof ECKey) {
- ECParameterSpec params = ((ECKey) privateKey).getParams();
- return params.getOrder().toByteArray();
- }
- Log.w(TAG, "Not an ECKey instance!");
- return null;
- }
-
- /**
* Sign a given message with a given PrivateKey object. This method
* shall only be used to implement signing in the context of SSL
* client certificate support.
@@ -126,25 +86,6 @@ public class AndroidKeyStore {
}
}
- /**
- * Return the type of a given PrivateKey object. This is an integer
- * that maps to one of the values defined by org.chromium.net.PrivateKeyType,
- * which is itself auto-generated from net/android/private_key_type_list.h
- * @param privateKey The PrivateKey handle
- * @return key type, or PrivateKeyType.INVALID if unknown.
- */
- @CalledByNative
- private static int getPrivateKeyType(PrivateKey privateKey) {
- String keyAlgorithm = privateKey.getAlgorithm();
- if ("RSA".equalsIgnoreCase(keyAlgorithm)) {
- return PrivateKeyType.RSA;
- } else if ("EC".equalsIgnoreCase(keyAlgorithm)) {
- return PrivateKeyType.ECDSA;
- } else {
- return PrivateKeyType.INVALID;
- }
- }
-
private static Object getOpenSSLKeyForPrivateKey(PrivateKey privateKey) {
// Sanity checks
if (privateKey == null) {
« no previous file with comments | « chrome/browser/ui/android/ssl_client_certificate_request.cc ('k') | net/android/keystore.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698