本文整理匯總了Java中android.hardware.fingerprint.FingerprintManager.CryptoObject方法的典型用法代碼示例。如果您正苦於以下問題:Java FingerprintManager.CryptoObject方法的具體用法?Java FingerprintManager.CryptoObject怎麽用?Java FingerprintManager.CryptoObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.hardware.fingerprint.FingerprintManager
的用法示例。
在下文中一共展示了FingerprintManager.CryptoObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startFingerprintAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.M)
private void startFingerprintAuth() throws GeneralSecurityException, IOException {
Signature signature = Signature.getInstance("SHA256withECDSA");
PrivateKey privateKey = fidoKeystore.getKeyPair(Preferences.getSettingsParam("username")).getPrivate();
signature.initSign(privateKey);
FingerprintAuthenticationDialogFragment fragment
= new FingerprintAuthenticationDialogFragment();
FingerprintManager.CryptoObject cryptoObj = new FingerprintManager.CryptoObject(signature);
fragment.setCryptoObject(cryptoObj);
fragment.setStage(
FingerprintAuthenticationDialogFragment.Stage.FINGERPRINT);
Log.d(TAG, "Showing fragment: " + fragment);
fragment.show(getFragmentManager(), DIALOG_FRAGMENT_TAG);
}
示例2: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager,
FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context,
Manifest.permission.USE_FINGERPRINT) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例3: setupFingerprintStuff
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.M)
public void setupFingerprintStuff() {
fingerprintManager = (FingerprintManager) this.getSystemService(Context.FINGERPRINT_SERVICE);
fingerprintHelper = new FingerprintHelper(this);
try {
generateKey();
if (cipherInit()) {
cryptoObject = new FingerprintManager.CryptoObject(cipher);
fingerprintHelper.startAuth(fingerprintManager, cryptoObject);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例4: begin
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public PublishSubject<Boolean> begin() {
if(publishSubject == null){
publishSubject = PublishSubject.create();
}
if (Build.VERSION.SDK_INT < 23){
publishSubject.onError(new FPerException(SYSTEM_API_ERROR));
}else {
initManager();
confirmFinger();
try {
CryptoObjectHelper helper = new CryptoObjectHelper();
FingerprintManager.CryptoObject cryptoObject = helper.buildCryptoObject();
startListening(cryptoObject);
} catch (Exception e) {
e.printStackTrace();
}
// startListening(null);
}
return publishSubject;
}
示例5: scanFingerprint
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
private boolean scanFingerprint() throws CertificateException, NoSuchAlgorithmException,
IOException, UnrecoverableKeyException, KeyStoreException, InvalidKeyException,
InvalidAlgorithmParameterException, NoSuchPaddingException {
FingerprintManager fingerprintManager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
//noinspection ResourceType
if (fingerprintManager.isHardwareDetected()) {
Cipher cipher = getCipherInstance();
IvParameterSpec ivSpec = new IvParameterSpec(mIvData);
SecretKey key = (SecretKey) mKeyStore.getKey(KEY_NAME, null);
cipher.init(Cipher.DECRYPT_MODE, key, ivSpec);
FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(cipher);
//noinspection ResourceType
fingerprintManager.authenticate(cryptoObject, mCancellationSignal, 0x0, mAuthenticationCallback, mHandler);
return true;
} else {
return false;
}
}
示例6: startListening
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
/**
* Starts listening to {@link FingerprintManager}
*
* @throws SecurityException If the hardware is not available, or the permission are not set
*/
public void startListening() throws SecurityException {
if (initCipher()) {
FingerprintManager.CryptoObject cryptoObject = new FingerprintManager.CryptoObject(mCipher);
if (!isFingerprintAuthAvailable()) {
return;
}
mCancellationSignal = new CancellationSignal();
mSelfCancelled = false;
mFingerprintManager.authenticate(cryptoObject, mCancellationSignal, 0 /* flags */, this, null);
mIcon.setImageResource(R.drawable.ic_fp_40px);
}
}
示例7: startListening
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.M)
public void startListening(FingerprintManager.CryptoObject cryptoObject) {
//android studio 上,沒有這個會報錯
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT)
!= PackageManager.PERMISSION_GRANTED) {
throw new FPerException(PERMISSION_DENIED_ERROE);
}
manager.authenticate(cryptoObject, null, 0, mSelfCancelled, null);
}
示例8: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
if (mContext != null)
if (mContext.checkSelfPermission(Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(mContext, "Fingerprint permission denied", Toast.LENGTH_SHORT).show();
return;
}
cancellationSignal = new CancellationSignal();
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例9: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@TargetApi(23)
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
CancellationSignal cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例10: startAuth
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例11: wrapCryptoObject
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
private static FingerprintManager.CryptoObject wrapCryptoObject(CryptoObject cryptoObject) {
if (cryptoObject == null) {
return null;
} else if (cryptoObject.getCipher() != null) {
return new FingerprintManager.CryptoObject(cryptoObject.getCipher());
} else if (cryptoObject.getSignature() != null) {
return new FingerprintManager.CryptoObject(cryptoObject.getSignature());
} else if (cryptoObject.getMac() != null) {
return new FingerprintManager.CryptoObject(cryptoObject.getMac());
} else {
return null;
}
}
示例12: onFingerprintAuthSuccess
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
@Override
public void onFingerprintAuthSuccess(FingerprintManager.CryptoObject cryptoObject) {
mCurrentStatusText = "Fingerprint recognized";
getRootView().invalidate();
new android.os.Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (mAuthListener != null) mAuthListener.onAuthenticationSuccessful();
mCurrentStatusText = mNormalStatusText;
getRootView().invalidate();
}
}, 1000);
}
示例13: unwrapCryptoObject
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
private static CryptoObject unwrapCryptoObject(FingerprintManager.CryptoObject cryptoObject) {
if (cryptoObject == null) {
return null;
} else if (cryptoObject.getCipher() != null) {
return new CryptoObject(cryptoObject.getCipher());
} else if (cryptoObject.getSignature() != null) {
return new CryptoObject(cryptoObject.getSignature());
} else if (cryptoObject.getMac() != null) {
return new CryptoObject(cryptoObject.getMac());
} else {
return null;
}
}
示例14: startListening
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
/**
* @param manager FingerprintManager instance
* @param cryptoObject Crypto object
*/
public void startListening(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
listeningState = true;
cancellationSignal = new CancellationSignal();
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
return;
}
manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
示例15: startListening
import android.hardware.fingerprint.FingerprintManager; //導入方法依賴的package包/類
public void startListening(FingerprintManager.CryptoObject cryptoObject) {
if (!isFingerprintAuthAvailable()) {
return;
}
mCancellationSignal = new CancellationSignal();
mSelfCancelled = false;
mFingerprintManager
.authenticate(cryptoObject, mCancellationSignal, 0 /* flags */, this, null);
int ic_fp_40px_id = mContext.getResources()
.getIdentifier("ic_fp_40px", "drawable", FingerprintAuth.packageName);
mIcon.setImageResource(ic_fp_40px_id);
}