1

Thanks for your time, everyone. My goal is to end up with, either as a byte array or string, my public key.

RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
string publicxml = rsa.ToXmlString(false);

string publicxml now contains a modulus and exponent. My question is, using these values, how can I generate a single public key to distribute to those who need it?

In a more general sense, how do we generally combine exponents and moduli to make public keys?

Thanks!

user353gre3
  • 2,747
  • 4
  • 24
  • 27
  • 2
    "Public keys" come in many formats. It could be OpenPGP, or PKCS #1, or anything else that allows you to transport the modulus and exponent. Heck, it could just be a JSON object that has those two values encoded as strings. It all depends on how "those who need it" wants to process them. – C. K. Young Dec 09 '14 at 16:17
  • 2
    `key = mod + exp`, how you encode is up to you, see http://stackoverflow.com/questions/1193529/how-to-store-retreieve-rsa-public-private-key – Alex K. Dec 09 '14 at 16:23

1 Answers1

1

publicxml is already a single value comprised of many bits. You can distribute it to those who need it. There are many possible encodings. You should decide for yourself which one you want to use. This may depend on many factors such as support for different public key encodings on those platforms that you want to use.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222