如何从公私密钥对检索Facebook上的签名哈希? [英] How to retrieve a signature hash for facebook from a public private key pair?

查看:292
本文介绍了如何从公私密钥对检索Facebook上的签名哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个版本的 signapk 为我的项目之一。我签我的APK与公共,私有密钥对(.pk8&安培;质子交换膜)。

I'm using a version of signapk for one of my projects. I sign my apk with a public, private key pair (.pk8 & .pem).

我的应用程序使用的机制,Facebook的单点登录,我需要与Facebook注册的签名证书的哈希值,以确保正确的应用程序正在启动过程上的单点登录。
Facebook的给出了下面的例子code生成此哈希:

My application uses the facebook single sign on mechanism and I need a hash of the signing certificate registered with facebook to ensure that the correct app is starting the single sign on process. Facebook gives the following example code for generating this hash:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore 
| openssl sha1 -binary
| openssl base64

我如何从我的公钥,我使用的签名私钥对生成适当的散列有点困惑。

I'm a little bit confused on how to generate the appropriate hash from my public key, private key pair that I use for signing.

推荐答案

本方法适用于您的APK与PK8 + PEM密钥对签名。或与任何其他(正常)签署的APK

This method works for you APK signed with your PK8 + PEM key pair. Or with any other (correctly) signed APK


  1. 证书可以从* .apk文件被称为

  1. Certificate could be known from *.apk file


  1. 解压apk文件并提取META-INF \\ CERT.RSA文件

  2. 执行

  1. Unzip apk file and extract META-INF\CERT.RSA file
  2. execute:

    keytool -printcert -file CERT.RSA

检查SHA1字节

Check sha1 bytes

需要在SHA1指纹签名字节写sha1.bin(你可以使用一个十六进制编辑器)

  • the bytes at sha1 fingerprint signature are needed to write to sha1.bin (you can use an hexadecimal editor)

    只是执行:

    openssl base64 -in sha1.bin -out base64.txt
    


  • 所以,base64.txt包含APK的FB KeyHash

    so, base64.txt contains the APK's FB KeyHash

    这篇关于如何从公私密钥对检索Facebook上的签名哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆