My friend and I have been generating a few SSH2 RSA keys and noticed all the public keys begin with AAAAB3NzaC1yc, with the similarity extending to AAAAB3NzaC1yc2EAAAABIwAAAQEA between two keys generated on the same machine in two successive attempts (googling AAAAB3Nz ends up getting a few hits as well).

Is this normal or are we doing something wrong while generating, such as suffering from insufficient entropy?

  • $\begingroup$ What are you using to generate them? Openssl, openssh, pgp? It is probably an encoding. $\endgroup$
    – mikeazo
    Jan 8, 2013 at 17:39
  • $\begingroup$ We used puTTYgen on two different windows machine and ssh-keygen on a linux machine. $\endgroup$
    – Lord Loh.
    Jan 8, 2013 at 18:23

1 Answer 1


The public key blob doesn't consist of just the numbers that make up the public key: it begins with a header that says “this is an SSH public key”. The repeated prefix encodes this header.

RFC 4254 specifies the encoding of public key in SSH key format.

The "ssh-rsa" key format has the following specific encoding:

 string    "ssh-rsa"
 mpint     e
 mpint     n

Here the 'e' and 'n' parameters form the signature key blob.

The string is encoded as 32-bit big endian length followed by the literal string:


Encoding this sequence of bytes in Base64 gives:


The public exponent is also usually the same, so the common prefix is even longer. The bulk of the key is the public modulus, and that is completely different in different keys.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.