Boost logo

Boost :

Subject: Re: [boost] Crypto Proposal
From: Chad Seibert (chadseibert_at_[hidden])
Date: 2010-04-11 12:53:36


> Hi,
>
> Perhaps this link will work:
>
> http://socghop.appspot.com/gsoc/student_proposal/show/google/gsoc2010/chadseibert/t127072694183
> Yep, it worked, thanks.
> Thanks to all who gave advice, please ask if you have any questions!
> It all sounds very good. Can you give an example of what porting some
> Botan functionality would look like? Would it be as simple as replacing
> the namespace Botan with boost::crypto/whatever in the source code?
> An example of what one of the Botan tutorial examples would look like in
> the new world would be nice.
> Honestly, I think there is no point if you can't commit to part 2.
> However, splitting it up into GSoC/non-GSoC is smart on your part. How
> do you plan to commit to part 2?
> Thanks and good luck :)

Here's an example of boostified code, from one of the examples on the site. It's not too different from the original code (it's just commented out); this is because I don't want it to be a chore to port from Botan to Boost.Botan. Also, it is intuitively designed and I see no reason to change it. Of course, if it needs redesigning, we can discuss that afterwards. Also, there are at least 600 files to move that total 2 mb's of source, so it'll take a while, even if it is just changing namespaces and the like. But I'll get started on part 2 if part 1 finishes early.

As for committing to part 2, I have some (rough) guidelines for the work to be done afterwards. I'm also taking a lighter courseload so I can spend more time working. I don't know how else to convince you.

Anyways, thank you for considering my proposal!
Chad Seibert

#include <boost/botan.h>

#include <iostream>
#include <memory>

int main(int argc, char* argv[])
   {
   if(argc != 5)
      {
      std::cout << "Usage: " << argv[0] << " <passphrase> "
                << "<ca cert> <ca key> <pkcs10>" << std::endl;
      return 1;
      }

   try
      {
      const std::string arg_passphrase = argv[1];
      const std::string arg_ca_cert = argv[2];
      const std::string arg_ca_key = argv[3];
      const std::string arg_req_file = argv[4];

      //AutoSeeded_RNG rng;
      boost::botan::rng::auto_seeded rng;

      //X509_Certificate ca_cert(arg_ca_cert);
      boost::botan::x509::certificate ca_cert(arg_ca_cert);

      //std::auto_ptr<PKCS8_PrivateKey> privkey(PKCS8::load_key(arg_ca_key, rng, arg_passphrase));
      std::auto_ptr<boost::botan::pkcs8::private_key> privkey(pkcs8::load_key(arg_ca_key, rng, arg_passphrase));

      //X509_CA ca(ca_cert, *privkey);
      boost::botan::x509::ca ca(ca_cert, *privkey);

      // got a request
      //PKCS10_Request req(arg_req_file);
      boost::botan::pkcs10::request req(arg_req_file);

      // you would insert checks here, and perhaps modify the request
      // (this example should be extended to show how)

      // now sign the request
      //X509_Time start_time(system_time());
      //X509_Time end_time(system_time() + 365 * 60 * 60 * 24);
      //X509_Certificate new_cert = ca.sign_request(req, rng,start_time, end_time);

      boost::botan::x509::time start_time(system_time());
      boost::botan::x509::time end_time(system_time() + 365*60*60*24);
      boost::botan::x509::certificate new_cert = ca.sign_request(req, rng, start_time, end_time);

      // send the new cert back to the requestor
      //std::cout << new_cert.PEM_encode();
      std::cout << new_cert.pem_encode();
   }
   catch(std::exception& e)
      {
      std::cout << e.what() << std::endl;
      return 1;
      }
   return 0;
   }

                                               
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk