How does RSA public and private key structure look like? So I was reading this wiki about the RSA algorithm and I read this article to understand it better. My goal was to create a simple program that would generate private and public keys. I got to the point where I have the e and n variables for the public key but I have no idea what should I do with them. What's the rule to follow while connecting two of this variables? Sure I can just do it my way because it's not a big deal to transform them into strings and put "&amp;" between them, but this way this key would be readable only by my program and this is not what I try to accomplish. I can't find anything about it on the internet so I ask here for help.
Probably the most widely used standard for this is defined in PKCS#1 (available as RFC8017 as well as PDF from RSA Labs).

In apppendix A, the ASN.1 syntax for the keys is defined to be 

RSAPublicKey ::= SEQUENCE {
             modulus           INTEGER,  -- n
             publicExponent    INTEGER   -- e
         } 


for public keys. Usually DER is used as the ASN.1 encoding rule. And of course, implementing ASN.1 in all its generality is not particularly easy, but implementing this subfunctionality shouldn't be too hard.