Add javax.crypto.Mac as a supported CryptoObject to Fingerprint

Fixes bug 20660180

Change-Id: I421c246ef776847835ede4be1d72721c35cf951c
This commit is contained in:
Jim Miller
2015-04-28 20:05:53 -07:00
parent 86f059a1b0
commit 0ecd5c20d9
3 changed files with 25 additions and 3 deletions

View 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();
}

View 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();
}

View 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;
}
/**
@ -221,6 +230,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;
};
/**