# What is contained in a RSA key file? [duplicate]

Consider a RSA key file like this:

-----BEGIN PUBLIC KEY-----
MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQBUndTbDYZ9HM8WxZRHi6ir
Oi1XbiZzRk+ABErWWDxbDc+wo9jM4FSXEPiaZsBtrjgggZu9naCoKTue2BC7FEGh
wuRazFP5OnGp9ojq8xoDKtWcREtyfLC2UdYNuA0WrJBr7gUol+Mn5DTKxUFV5KLj
45JDiB2zYPDLzxWWTggjp2pK7u0jHOThMy+Af7Q886itbFrbbesj30VTLRSXn7sm
LkuQU8g0IyiQeCZuPACjqFkYFa68DjqAZlRr5EoZp88IRoNonWQv14GBv+kDBeUu
2fYZpet0z3srNyjgWPsEQLBUPPWyxcrtwhJpu5I6wLqs91w49LMsbkec8nwjqDgL
AgMBAAE=
-----END PUBLIC KEY-----


How does that tell a program how to encrypt? Can I decode this key and see the its components?

• Why downvote, please tell me – NetCoder Jan 25 '15 at 10:13
• this might help: stackoverflow.com/questions/1193529/… – Mints97 Jan 25 '15 at 10:14
• thanks, you but put that in a answer – NetCoder Jan 25 '15 at 10:14
• This isn't how it works. We try to avoid duplicate questions and answer. @Mints97 provided a reference to a very useful answer. If after you read the link you don't understand something, you ask it here. – cygnusv Jan 26 '15 at 9:07

An RSA public key contains the modulus ($n$) and the public exponent ($e$, usually $65537$). It is formatted differently in different implementations, most commonly, it is a dump of the data and its length, encoded with base64. For an example, see https://stackoverflow.com/questions/1193529/how-to-store-retreieve-rsa-public-private-key/13104466#13104466