SHA-1 fingerprint of keystore certificate

前端 未结 30 3030
长发绾君心
长发绾君心 2020-11-21 23:36

Is the method for getting a SHA-1 fingerprint the same as the method of getting the a fingerprint? Previously, I was running this command:

30条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 00:05

    First there is same .jar file that in fb-sdk android-support-v4.jar.
    Then generate SHA1 key using:

    PackageInfo info;
    try {
    
        info = getPackageManager().getPackageInfo(
            "com.example.worldmission", PackageManager.GET_SIGNATURES);
    
        for (Signature signature : info.signatures) {
            MessageDigest md;
            md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            String something = new String(Base64.encode(md.digest(), 0));
            Log.e("Hash key", something);
            System.out.println("Hash key" + something);
        }
    
    } catch (NameNotFoundException e1) {
        Log.e("name not found", e1.toString());
    } catch (NoSuchAlgorithmException e) {
        Log.e("no such an algorithm", e.toString());
    } catch (Exception e) {
        Log.e("exception", e.toString());
    }
    

提交回复
热议问题