OSDN Git Service

Add javax.crypto.Mac as a supported CryptoObject to Fingerprint
authorJim Miller <jaggies@google.com>
Wed, 29 Apr 2015 03:05:53 +0000 (20:05 -0700)
committerJim Miller <jaggies@google.com>
Thu, 30 Apr 2015 01:51:19 +0000 (18:51 -0700)
Fixes bug 20660180

Change-Id: I421c246ef776847835ede4be1d72721c35cf951c

api/current.txt
api/system-current.txt
core/java/android/hardware/fingerprint/FingerprintManager.java

index 085b64d..860ae62 100644 (file)
@@ -13904,7 +13904,9 @@ package android.hardware.fingerprint {
   public static class FingerprintManager.CryptoObject {
     ctor public FingerprintManager.CryptoObject(java.security.Signature);
     ctor public FingerprintManager.CryptoObject(javax.crypto.Cipher);
+    ctor public FingerprintManager.CryptoObject(javax.crypto.Mac);
     method public javax.crypto.Cipher getCipher();
+    method public javax.crypto.Mac getMac();
     method public java.security.Signature getSignature();
   }
 
index b9c1423..1eb847a 100644 (file)
@@ -14204,7 +14204,9 @@ package android.hardware.fingerprint {
   public static class FingerprintManager.CryptoObject {
     ctor public FingerprintManager.CryptoObject(java.security.Signature);
     ctor public FingerprintManager.CryptoObject(javax.crypto.Cipher);
+    ctor public FingerprintManager.CryptoObject(javax.crypto.Mac);
     method public javax.crypto.Cipher getCipher();
+    method public javax.crypto.Mac getMac();
     method public java.security.Signature getSignature();
   }
 
index 2257b0a..9f344ad 100644 (file)
@@ -42,6 +42,7 @@ import java.util.HashMap;
 import java.util.List;
 
 import javax.crypto.Cipher;
+import javax.crypto.Mac;
 
 /**
  * A class that coordinates access to the fingerprint hardware.
@@ -195,18 +196,26 @@ public class FingerprintManager {
 
     /**
      * A wrapper class for the crypto objects supported by FingerprintManager. Currently the
-     * framework supports {@link Signature} and {@link Cipher} objects.
+     * framework supports {@link Signature}, {@link Cipher} and {@link Mac} objects.
      */
     public static class CryptoObject {
 
-        public CryptoObject(Signature signature) {
+        public CryptoObject(@NonNull Signature signature) {
             mSignature = signature;
             mCipher = null;
+            mMac = null;
         }
 
-        public CryptoObject(Cipher cipher) {
+        public CryptoObject(@NonNull Cipher cipher) {
             mCipher = cipher;
             mSignature = null;
+            mMac = null;
+        }
+
+        public CryptoObject(@NonNull Mac mac) {
+            mMac = mac;
+            mCipher = null;
+            mSignature = null;
         }
 
         /**
@@ -222,6 +231,12 @@ public class FingerprintManager {
         public Cipher getCipher() { return mCipher; }
 
         /**
+         * Get {@link Mac} object.
+         * @return {@link Mac} object or null if this doesn't contain one.
+         */
+        public Mac getMac() { return mMac; }
+
+        /**
          * @hide
          * @return the opId associated with this object or 0 if none
          */
@@ -230,12 +245,15 @@ public class FingerprintManager {
                 return AndroidKeyStoreProvider.getKeyStoreOperationHandle(mSignature);
             } else if (mCipher != null) {
                 return AndroidKeyStoreProvider.getKeyStoreOperationHandle(mCipher);
+            } else if (mMac != null) {
+                return AndroidKeyStoreProvider.getKeyStoreOperationHandle(mMac);
             }
             return 0;
         }
 
         private final Signature mSignature;
         private final Cipher mCipher;
+        private final Mac mMac;
     };
 
     /**