0
$\begingroup$

I use putty gen to generate RSA key, I choose length of key is 2048 bit, it generate public key:

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA10prz5/FvHX7cx5aowiF+eO8uQuKTYSU0rA0x5yNPD5yTI0HGmEBTnhia4iOhOzwg0BevOZR1SClBpCRTZViym2Z+ohAGt65mWq+2LLhRf3MNpcM6Ttm8IXFxRiVR9iALk9cPsXu6zz4x7RT9vZG7rE1+KbeeSn1gacpCeudsEYCDOrgenH78hNXCLcc6TdKOWnBlASf8coj/T1czUW78S9tcqu7bFrR7N6xfj9M0d8e8oyBOqYrhv3uFmLxvVQ2yxZrJ0ILhAf8KhrflX6SytO5s/K5zTWRkjhwg83V8Qs30LWd79xJgpaUESaWFeS17x6iit8uEjMtPqBGnqLryw== rsa-key-20160620

I don't know why this key is 2048 bits?

$\endgroup$
1
$\begingroup$

The binary base 64 encoded blob contains a modulus which is 257 bytes in size:

00D74A6BCF9FC5BC75FB731E5AA30885F9E3BCB90B8A4D8494D2B034C79C8D3C3E724C8D071A61014E78626B888E84ECF083405EBCE651D520A50690914D9562CA6D99FA88401ADEB9996ABED8B2E145FDCC36970CE93B66F085C5C5189547D8802E4F5C3EC5EEEB3CF8C7B453F6F646EEB135F8A6DE7929F581A72909EB9DB046020CEAE07A71FBF2135708B71CE9374A3969C194049FF1CA23FD3D5CCD45BBF12F6D72ABBB6C5AD1ECDEB17E3F4CD1DF1EF28C813AA62B86FDEE1662F1BD5436CB166B27420B8407FC2A1ADF957E92CAD3B9B3F2B9CD359192387083CDD5F10B37D0B59DEFDC4982969411269615E4B5EF1EA28ADF2E12332D3EA0469EA2EBCB

The first byte is set to 00 to indicate that it is a positive number. 256 bytes equals 2048 bits, which is the size of the modulus. The modulus in turn defines the key size of RSA.

$\endgroup$
  • $\begingroup$ Would you like to give me some scripts for demonstration? $\endgroup$ – user2693571 Jun 20 '16 at 10:40
  • $\begingroup$ Sorry, previous comments were about PGP instead of SSH (they use a binary format that has some identical features). I did not use a script for this, I just looked at the binary values. $\endgroup$ – Maarten Bodewes Jun 20 '16 at 12:37
  • $\begingroup$ @dave_thompson_085 I deleted the previous comments about PGP. I was indicating that I was wrong footed and that those should be ignored to the author. Nothing more. Yes of course big endian two complement 8 bit bytes etc etc. $\endgroup$ – Maarten Bodewes Jun 20 '16 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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