private boolean verifyFingreprint ( ) { try { PackageInfo info = context . getPackageManager ( ) . getPackageInfo ( NOKIA_INSTALLER , PackageManager . GET_SIGNATURES ) ; if ( info . signatures . length == 1 ) { byte [ ] cert = info . signatures [ 0 ] . toByteArray ( ) ; MessageDigest digest ; digest = MessageDigest . getInstance ( "SHA1" ) ; byte [ ] ENABLER_FINGERPRINT = digest . digest ( cert ) ; byte [ ] EXPECTED_FINGERPRINT = hexStringToByteArray ( EXPECTED_SHA1_FINGERPRINT ) ; if ( Arrays . equals ( ENABLER_FINGERPRINT , EXPECTED_FINGERPRINT ) ) { Logger . i ( "isBillingAvailable" , "NIAP signature verified" ) ; return true ; } } } catch ( NoSuchAlgorithmException e ) { e . printStackTrace ( ) ; } catch ( PackageManager . NameNotFoundException e ) { e . printStackTrace ( ) ; } return false ; }
Checks SHA1 fingerprint of the enabler