问题原文
原帖链接 · Gabe Durazo · CC BY-SA 3.0
I was updating the authorized_keys file on my server with the public key for the new laptop I got and I was surprised to discover that the two public keys began the same:
# key 1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ....
#
# key 2
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ....
What's the story on AAAAB3... etc? With some searching online, I see that others keys start the same, too. Does it explain the algorithm or version or something?
已采纳解答
原帖链接 · Scott Pack · CC BY-SA 3.0
This is actually a header that defines what kind of key this is. If you check out the Public Key Algorithm section of RFC 4253 we can see that for RSA keys
The "ssh-rsa" key format has the following specific encoding:
string "ssh-rsa" mpint e mpint nHere the 'e' and 'n' parameters form the signature key blob.
In fact, if you Base64 decode the string "B3NzaC1yc2E" you will see it translates into ASCII as "ssh-rsa". Presumably the "AAAA" represents some kind of header so the application can know where exactly in the data stream to start processing the key.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
