android.hardware.fingerprint.FingerprintManager#CryptoObject ( )源码实例Demo

下面列出了android.hardware.fingerprint.FingerprintManager#CryptoObject ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: programming   文件: FingerprintHandler.java
public void startAuth(FingerprintManager manager,
                      FingerprintManager.CryptoObject cryptoObject) {

    cancellationSignal = new CancellationSignal();

    if (ActivityCompat.checkSelfPermission(appContext,
            Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {

        Toast.makeText(appContext,
                appContext.getString(R.string.fingerprint_error_no_permission),
                Toast.LENGTH_LONG).show();

        return;
    }

    manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
 
源代码2 项目: LLApp   文件: RxFingerPrinter.java
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;

    }
 
源代码3 项目: programming   文件: MainActivity.java
private void inicializarSeguranca() {

        if (ActivityCompat.checkSelfPermission(this,
                Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {

            Toast.makeText(this,
                    getString(R.string.fingerprint_error_no_permission),
                    Toast.LENGTH_LONG).show();

            return;
        }

        keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
        fingerprintManager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);

        keystoreManager = new AndroidKeystoreManager(KEY_NAME);
        keystoreManager.generateKey();

        if (keystoreManager.cipherInit()) {
            cryptoObject = new FingerprintManager.CryptoObject(keystoreManager.getCipher());
        }
    }
 
源代码4 项目: leafpicrevived   文件: FingerprintHandler.java
public void startAuth() {
    if (fingerprintSupported) {
        try {

            generateKey();
        } catch (FingerprintException e) {
            e.printStackTrace();
        }
        if (initCipher()) {
            cryptoObject = new FingerprintManager.CryptoObject(cipher);
            doAuth(fingerprintManager, cryptoObject);
        }
    }
}
 
源代码5 项目: Sparkplug   文件: MainActivity.java
public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
    CancellationSignal cancellationSignal = new CancellationSignal();
    if (ActivityCompat.checkSelfPermission(appContext, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
        Log.e(TAG, "No permissions for USE_FINGERPRINT");
        return;
    }
    Log.d(TAG, "Attempting to authenticate...");
    manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}
 
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;
    }
}
 
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;
    }
}
 
@Override
public void onAuthenticated(FingerprintManager.CryptoObject cryptObj) {
    // Callback from FingerprintUiHelper. Let the activity know that authentication was
    // successful.
    ((FingerprintAuthProcessor)mActivity).processAuthentication(cryptObj);
    dismiss();
}
 
public void onResume() {
    if (isFingerPrint) {
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
            generateKey();
            if (cipherInit()) {
                FingerprintManager.CryptoObject cryptoObject = null;
                cryptoObject = new FingerprintManager.CryptoObject(cipher);
                helper = new FingerprintHandler(context);
                helper.startAuth(fingerprintManager, cryptoObject);
            }
        }
    }
}
 
源代码10 项目: Telegram   文件: FingerprintManagerCompatApi23.java
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;
    }
}
 
源代码11 项目: android-FingerprintDialog   文件: MainActivity.java
/**
 * Proceed the purchase operation
 *
 * @param withFingerprint {@code true} if the purchase was made by using a fingerprint
 * @param cryptoObject the Crypto object
 */
public void onPurchased(boolean withFingerprint,
        @Nullable FingerprintManager.CryptoObject cryptoObject) {
    if (withFingerprint) {
        // If the user has authenticated with fingerprint, verify that using cryptography and
        // then show the confirmation message.
        assert cryptoObject != null;
        tryEncrypt(cryptoObject.getCipher());
    } else {
        // Authentication happened with backup password. Just show the confirmation message.
        showConfirmation(null);
    }
}
 
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;
    }
}
 
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;
    }
}
 
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;
    }
}
 
源代码15 项目: keemob   文件: FingerprintUiHelper.java
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);
}
 
/**
 * Sets the crypto object to be passed in when authenticating with fingerprint.
 */
public void setCryptoObject(FingerprintManager.CryptoObject cryptoObject) {
    mCryptoObject = cryptoObject;
}
 
@TargetApi(Build.VERSION_CODES.M)
@Nullable
private FingerprintManager.CryptoObject getCryptoObject() {
    return cipherInit() ? new FingerprintManager.CryptoObject(mCipher) : null;
}
 
源代码18 项目: PasscodeView   文件: BoxFingerprint.java
@Override
public void onFingerprintAuthSuccess(FingerprintManager.CryptoObject cryptoObject) {
    onAuthenticationSuccess();
}
 
/**
 * Sets the crypto object to be passed in when authenticating with fingerprint.
 */
public void setCryptoObject(FingerprintManager.CryptoObject cryptoObject) {
    mCryptoObject = cryptoObject;
}
 
源代码20 项目: PasscodeView   文件: FingerPrintAuthHelper.java
/**
 * This method will occur whenever  user authentication is successful.
 *
 * @param cryptoObject {@link FingerprintManager.CryptoObject} associated with the scanned finger print.
 */
void onFingerprintAuthSuccess(FingerprintManager.CryptoObject cryptoObject);