OSDN Git Service

Add new key purpose Wrap Key to KeyProperties.java and
authorCrystal Qin <crystalyq@google.com>
Tue, 3 Jan 2017 23:45:23 +0000 (15:45 -0800)
committerCrystal Qin <crystalyq@google.com>
Fri, 20 Jan 2017 05:02:10 +0000 (21:02 -0800)
KeymasterDefs.java.

Test: There will be a CTS test CL submitted together.
Change-Id: Ic60c3efc451cd7cbb04689b3d7bf9d607fae6c1f

api/current.txt
api/system-current.txt
api/test-current.txt
core/java/android/security/keymaster/KeymasterDefs.java
keystore/java/android/security/keystore/KeyProperties.java

index c3a8316..f6128eb 100644 (file)
@@ -35269,6 +35269,7 @@ package android.security.keystore {
     field public static final int PURPOSE_ENCRYPT = 1; // 0x1
     field public static final int PURPOSE_SIGN = 4; // 0x4
     field public static final int PURPOSE_VERIFY = 8; // 0x8
+    field public static final int PURPOSE_WRAP_KEY = 16; // 0x10
     field public static final java.lang.String SIGNATURE_PADDING_RSA_PKCS1 = "PKCS1";
     field public static final java.lang.String SIGNATURE_PADDING_RSA_PSS = "PSS";
   }
index ccfbf01..8c8e484 100644 (file)
@@ -38175,6 +38175,7 @@ package android.security.keystore {
     field public static final int PURPOSE_ENCRYPT = 1; // 0x1
     field public static final int PURPOSE_SIGN = 4; // 0x4
     field public static final int PURPOSE_VERIFY = 8; // 0x8
+    field public static final int PURPOSE_WRAP_KEY = 16; // 0x10
     field public static final java.lang.String SIGNATURE_PADDING_RSA_PKCS1 = "PKCS1";
     field public static final java.lang.String SIGNATURE_PADDING_RSA_PSS = "PSS";
   }
index b26760b..e52e505 100644 (file)
@@ -35390,6 +35390,7 @@ package android.security.keystore {
     field public static final int PURPOSE_ENCRYPT = 1; // 0x1
     field public static final int PURPOSE_SIGN = 4; // 0x4
     field public static final int PURPOSE_VERIFY = 8; // 0x8
+    field public static final int PURPOSE_WRAP_KEY = 16; // 0x10
     field public static final java.lang.String SIGNATURE_PADDING_RSA_PKCS1 = "PKCS1";
     field public static final java.lang.String SIGNATURE_PADDING_RSA_PSS = "PSS";
   }
index eb3d031..22f1bed 100644 (file)
@@ -132,6 +132,8 @@ public final class KeymasterDefs {
     public static final int KM_PURPOSE_DECRYPT = 1;
     public static final int KM_PURPOSE_SIGN = 2;
     public static final int KM_PURPOSE_VERIFY = 3;
+    public static final int KM_PURPOSE_DERIVE_KEY = 4;
+    public static final int KM_PURPOSE_WRAP_KEY = 5;
 
     // Key formats.
     public static final int KM_KEY_FORMAT_X509 = 0;
index d6b1cf1..bf7a779 100644 (file)
@@ -45,6 +45,7 @@ public abstract class KeyProperties {
                 PURPOSE_DECRYPT,
                 PURPOSE_SIGN,
                 PURPOSE_VERIFY,
+                PURPOSE_WRAP_KEY,
                 })
     public @interface PurposeEnum {}
 
@@ -69,6 +70,12 @@ public abstract class KeyProperties {
     public static final int PURPOSE_VERIFY = 1 << 3;
 
     /**
+     * Purpose of key: wrapping key for secure key import.
+     */
+    public static final int PURPOSE_WRAP_KEY = 1 << 4;
+
+
+    /**
      * @hide
      */
     public static abstract class Purpose {
@@ -84,6 +91,8 @@ public abstract class KeyProperties {
                     return KeymasterDefs.KM_PURPOSE_SIGN;
                 case PURPOSE_VERIFY:
                     return KeymasterDefs.KM_PURPOSE_VERIFY;
+                case PURPOSE_WRAP_KEY:
+                    return KeymasterDefs.KM_PURPOSE_WRAP_KEY;
                 default:
                     throw new IllegalArgumentException("Unknown purpose: " + purpose);
             }
@@ -99,6 +108,8 @@ public abstract class KeyProperties {
                     return PURPOSE_SIGN;
                 case KeymasterDefs.KM_PURPOSE_VERIFY:
                     return PURPOSE_VERIFY;
+                case KeymasterDefs.KM_PURPOSE_WRAP_KEY:
+                    return PURPOSE_WRAP_KEY;
                 default:
                     throw new IllegalArgumentException("Unknown purpose: " + purpose);
             }