如果您想了解如何从Java生成与ssh兼容的id_rsa和.pub的知识,那么本篇文章将是您的不二之选。我们将深入剖析如何从Java生成与ssh兼容的id_rsa的各个方面,并为您解答.pub的疑在这
如果您想了解如何从Java生成与ssh兼容的id_rsa和.pub的知识,那么本篇文章将是您的不二之选。我们将深入剖析如何从Java生成与ssh兼容的id_rsa的各个方面,并为您解答.pub的疑在这篇文章中,我们将为您介绍如何从Java生成与ssh兼容的id_rsa的相关知识,同时也会详细的解释.pub的运用方法,并给出实际的案例分析,希望能帮助到您!
本文目录一览:- 如何从Java生成与ssh兼容的id_rsa(.pub)(java ssh client)
- android – 使用SHA256withRSA而不是SHA1withRSA生成签名
- ansible Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak
- c – openSSL:PEM_write_RSAPublicKey和PEM_write_RSA_PUBKEY之间的区别
- Git Permissions 0644 for ‘/root/.ssh/id_rsa’ ar...
如何从Java生成与ssh兼容的id_rsa(.pub)(java ssh client)
我正在寻找一种以编程方式在Java中创建与ssh兼容的id_rsa和id_rsa.pub文件的方法。
我可以创建KeyPair:
KeyPairGenerator generator;
generator = KeyPairGenerator.getInstance("RSA");
// or: generator = KeyPairGenerator.getInstance("DSA");
generator.initialize(2048);
keyPair = generator.genKeyPair();
但是我不知道如何在KeyPair中创建PrivateKey和PublicKey的String表示形式。
android – 使用SHA256withRSA而不是SHA1withRSA生成签名
keytool -list -v -keystore "C:\Users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
输出应该与此类似(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,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
我的输出:
Alias name: androiddebugkey Creation date: 12-Jun-2013 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate[1]: Owner: CN=Android Debug,C=US Issuer: CN=Android Debug,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 ] ]
但在我的情况下,输出类似,但除外.
Signature algorithm name:SHA256withRSA
有人能告诉我如何通过SHA1withRSA生成密钥.问这个问题的原因是我想在我的Android应用程序中使用谷歌地图v2.显示以下错误.我猜SHA256withRSA可能是造成这个错误的原因.我被困在授权失败的几天.如果有人可以帮助我真的很棒..谢谢..
Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
解决方法
我想出了如何使用SHA1生成正确的调试密钥库.这是我使用的命令:
keytool -genkey -v -keyalg RSA -sigalg SHA1withRSA -keystore "%USERPROFILE%\.android\debug.keystore" -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,C=US"
生成它之后,您可以使用以下命令查看它:
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
签名算法现在应为“SHA1withRSA”.复制SHA1指纹并将其粘贴到Google控制台“Android应用程序密钥”中,您应该很高兴.
请注意:确保在使用上面的第一个-genkey命令创建新的之前删除debug.keystore(如果已存在).如果密钥库已经存在,它将使用给定的-alias androiddebugkey给出密钥库已存在的错误
ansible Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak
中控机和远端主机配置完密钥后,在中控台上通过ansible检测联通性
ansible -i inventory.cfg all -m ping
10.1.1.1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak: No such file or directory\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
}
通过调试选项查看
ansible -vvv -i inventory.cfg all -m ping
ansible 2.6.2
config file = /home/bichenchen001/mongodb_auto_deploy/ansible.cfg
configured module search path = [u''/root/.ansible/plugins/modules'', u''/usr/share/ansible/plugins/modules'']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /home/bichenchen001/mongodb_auto_deploy/ansible.cfg as config file
Parsed /home/bichenchen001/mongodb_auto_deploy/inventory.cfg inventory source with ini plugin
META: ran handlers
<10.1.1.1> ESTABLISH SSH CONNECTION FOR USER: None
<10.1.1.1> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o ''IdentityFile="/root/.ssh/id_rsa.bak"'' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o
发现会指定 /root/.ssh/id_rsa.bak 手动创建文件解决问题
cp /root/.ssh/id_rsa /root/.ssh/id_rsa.bak
c – openSSL:PEM_write_RSAPublicKey和PEM_write_RSA_PUBKEY之间的区别
int PEM_write_RSAPublicKey(FILE *fp,RSA *x); int PEM_write_RSA_PUBKEY(FILE *fp,RSA *x);
在文档中,我可以看到:
The RSAPublicKey functions process an RSA public key using an RSA
structure. The public key is encoded using a PKCS#1 RSAPublicKey
structure.The RSA_PUBKEY functions also process an RSA public key using an RSA
structure. However the public key is encoded using a
SubjectPublicKeyInfo structure and an error occurs if the public key
is not RSA
但我不明白是什么
SubjectPublicKeyInfo
两种方法之间的基本面差异是什么!
解决方法
Git Permissions 0644 for ‘/root/.ssh/id_rsa’ ar...
下载项目时出现:Permissions 0644 for ‘/root/.ssh/id_rsa’ are too open
只要把权限降到 0600 就 ok 了
chmod 0600 ~/.ssh/id_rsa
今天关于如何从Java生成与ssh兼容的id_rsa和.pub的介绍到此结束,谢谢您的阅读,有关android – 使用SHA256withRSA而不是SHA1withRSA生成签名、ansible Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak、c – openSSL:PEM_write_RSAPublicKey和PEM_write_RSA_PUBKEY之间的区别、Git Permissions 0644 for ‘/root/.ssh/id_rsa’ ar...等更多相关知识的信息可以在本站进行查询。
本文标签: