当前位置: 首页 > 知识库问答 >
问题:

如何在android studio中获取SHA1指纹证书

齐成和
2023-03-14
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

SHA1发布

keytool -list -v -keystore "/home/compe18/Keystore folder/keystore.jks" -alias keystore Alias Name -storepass password -keypass password

注意:storepass和keypass是应用Keystore密码,Keystore=Keystore路径,alias=密钥别名(创建Keystore时使用的名称).....

共有1个答案

南门鸿哲
2023-03-14
try {
         PackageInfo info = getPackageManager().getPackageInfo(
                           "yourpackagename", 
                            PackageManager.GET_SIGNATURES);
         for (Signature signature : info.signatures) {
                    MessageDigest md = MessageDigest.getInstance("SHA");
                    md.update(signature.toByteArray());
                        Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
                  }
            } catch (NameNotFoundException e) {

      } catch (NoSuchAlgorithmException e) {}    
}
 类似资料: