Advertisement
Sprenger120

Gen RSA-Keys + building ASN.1v8 structure of x.509 cert

Jul 31st, 2012
1,482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. /* *Generate RSA-Keys and building the ASN.1v8 structure of the x.509 certificate */
  2. /* *Using Crypto++ */
  3. #include <osrng.h>
  4. #include <rsa.h>
  5. #include <files.h>
  6. #include <sstream>
  7. using namespace CryptoPP;
  8. using std::stringstream;
  9.  
  10. AutoSeededRandomPool AutoSeedGen;
  11. RSA::PrivateKey RSA_PrivKey;
  12. stringstream output;
  13.  
  14. RSA_PrivKey.Initialize(AutoSeedGen,1024,65537);
  15.  
  16.  
  17. RSA::PublicKey RSA_PublicKey(RSA_PrivKey);
  18. _RSA_PublicKey->Save(FileSink(output));
  19.  
  20.  
  21. output.str() //Contains the ASN.1 structure of the x.509 certificate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement