与SHA256withRSA而不是SHA1withRSA生成签名 [英] generating signature with SHA256withRSA rather than SHA1withRSA

查看:14310
本文介绍了与SHA256withRSA而不是SHA1withRSA生成签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图生成使用的Windows7上的谷歌地图V2的SHA1密钥。据谷歌文档以下命令运行后:

 的keytool -list -v -keystoreC:\\用户\\ your_user_name \\ .android \\ debug.keystore-alias androiddebugkey -storepass的android -keypass android的

输出应该是与此类似(<一个href=\"https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2\" rel=\"nofollow\">https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2)

 别名:androiddebugkey
 创建日期:2013年1月1日
 条目类型:PrivateKeyEntry
 证书链长:1
 证书[1]:
 业主:CN = Android的调试,O =机器人,C = US
 发行人:CN ​​= Android的调试,O =机器人,C = US
 编号:4aa9b300
 有效期从:星期一1月1日8时04分04秒UTC 2013至:星期一1月1日18时04分04秒的PST 2033
 证书指纹:
      MD5:AE:9F:95:D0:A6:86:89:BC:A8:70:BA:34:FF:6A:AC:F9
      SHA1:BB:0D:AC:74:D3:21:E1:43:07:71:9B:62:90:AF:A1:66:6E:44:5D:75
      签名算法名:SHA1withRSA
      版本:3

我的输出:

 别名:androiddebugkey
    创建日期:12军2013
    条目类型:PrivateKeyEntry
    证书链长:1
    证书[1]:
    业主:CN = Android的调试,O =机器人,C = US
    发行人:CN ​​= Android的调试,O =机器人,C = US
    编号:57376504
    有效期从:周三6月12日16时22分47秒BST 2013至:周五6月5日16时22分47秒BST 2043
    证书指纹:
             MD5:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
             SHA1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
             签名算法名:SHA256withRSA
             版本:3   扩展:   #1:的ObjectId:2.5.29.14临界= FALSE
   执行subjectKeyIdentifier [
   KeyIdentifier [
   0000:5D 1C 48 72 D9 E2 F0 1A 12 CE 97 CC 1F DA DD F6] .HR ............
   0010:C9 D0 1E 62。B
   ]
   ]

但在我的情况下,输出的是类似的,但除。

 签名算法名:SHA256withRSA

有人能告诉我如何通过关键产生SHA1withRSA。问这个问题的原因是,当我尝试使用谷歌地图V2在我的Andr​​oid应用程序。将显示以下错误。我猜SHA256withRSA可能是这个error.Its过几天我坚持授权failure.It将是非常巨大的,如果有人能帮助我的理由..谢谢..

 授权失败。请参阅https://developers.google.com/maps/documentation/android/start对于如何正确设置地图。


解决方案

对于其他人遇到这样的问题:我有一个很难得到谷歌地图API第2版使用JDK 1.7的工作 - 我一直得到授权失败消息。问题是,事实上,签名算法名。

我想出如何生成合适的调试密钥库,使用SHA1。下面是我使用的命令:

 的keytool -genkey -v -keyalg RSA -sigalg SHA1withRSA -keystore%USERPROFILE%\\。机器人\\ debug.keystore-storepass android的-alias androiddebugkey -keypass android的-dnameCN = Android的调试,O =机器人,C = US

生成后,您可以通过使用命令看看吧:

 的keytool -list -v -keystore%USERPROFILE%\\。机器人\\ debug.keystore-alias androiddebugkey -storepass的android -keypass android的

签名算法现在应该改为SHA1withRSA。复制SHA1指纹,并粘贴在谷歌控制台for Android应用程序键,你应该是好去。

请注意:请确保您删除debug.keystore如果创建使用上面的第一个-genkey命令创建一个新的人之前已经存在。如果密钥库已经存在,它会给你的密钥库的错误已经给定-alias androiddebugkey

存在

I been trying to generate the sha1 key for using google maps v2 on windows7. According to google docs after running below command:

keytool -list -v -keystore "C:\Users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

the output should be similar to this(https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2)

 Alias name: androiddebugkey
 Creation date: Jan 01, 2013
 Entry type: PrivateKeyEntry
 Certificate chain length: 1
 Certificate[1]:
 Owner: CN=Android Debug, O=Android, C=US
 Issuer: CN=Android Debug, O=Android, C=US
 Serial number: 4aa9b300
 Valid from: Mon Jan 01 08:04:04 UTC 2013 until: Mon Jan 01 18:04:04 PST 2033
 Certificate fingerprints:
      MD5:  AE:9F:95:D0:A6:86:89:BC:A8:70:BA:34:FF:6A:AC:F9
      SHA1: BB:0D:AC:74:D3:21:E1:43:07:71:9B:62:90:AF:A1:66:6E:44:5D:75
      Signature algorithm name: SHA1withRSA
      Version: 3 

My Output:

    Alias name: androiddebugkey
    Creation date: 12-Jun-2013
    Entry type: PrivateKeyEntry
    Certificate chain length: 1
    Certificate[1]:
    Owner: CN=Android Debug, O=Android, C=US
    Issuer: CN=Android Debug, O=Android, C=US
    Serial number: 57376504
    Valid from: Wed Jun 12 16:22:47 BST 2013 until: Fri Jun 05 16:22:47 BST 2043
    Certificate fingerprints:
             MD5:  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
             SHA1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
             Signature algorithm name: SHA256withRSA
             Version: 3    

   Extensions:

   #1: ObjectId: 2.5.29.14 Criticality=false
   SubjectKeyIdentifier [
   KeyIdentifier [
   0000: 5D 1C 48 72 D9 E2 F0 1A   12 CE 97 CC 1F DA DD F6  ].Hr............
   0010: C9 D0 1E 62                                        ...b
   ]
   ]

But in my case the the output is similar but except.

Signature algorithm name:SHA256withRSA

Can someone tell me how to key generated by SHA1withRSA. The reason to ask this question was when i am trying to use the google maps v2 in my android application. The following error is displayed. I am guessing SHA256withRSA could be a reason for this error.Its been a couple of days i am stuck with authorization failure.It would be really great if someone can help me.. Thanks..

Authorization failure.  Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.

解决方案

For others encountering this problem: I was having a hard time getting Google Maps API v.2 to work using JDK 1.7 -- I kept getting an Authorization Failure message. The problem was, in fact, the signature algorithm name.

I figured out how to generate the right debug keystore, using SHA1. Here's the command I used:

keytool -genkey -v -keyalg RSA -sigalg SHA1withRSA -keystore "%USERPROFILE%\.android\debug.keystore" -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"

After generating it, you can see it by using the command:

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

The Signature algorithm should now read "SHA1withRSA". Copy the SHA1 fingerprint and paste it in the Google console "Key for Android apps", and you should be good to go.

Please note: Make sure you delete the debug.keystore if it already exists before creating a new one using the first -genkey command above. If the keystore already exists, it will give you an error of keystore already exists with the given -alias androiddebugkey

这篇关于与SHA256withRSA而不是SHA1withRSA生成签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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