[Botan-devel] error C2065: 'LibraryInitializer' :undeclared identifier

Gustavo Salmerón Prieto gsalmeron at contraloriadf.gob.mx
Fri Feb 15 19:48:01 EST 2008

Thanks Joel.


I traed but didn’t Works.


I down Current Stable Release: 1.6.3

Then I’ve tried with the some examples but didn’t work


Generate a 1024 bit RSA key, and then create a PKCS #10 certificate request

that key. The private key will be stored as an encrypted PKCS #8 object, and

stored in another file.


Written by Jack Lloyd (lloyd at randombit.net), April 7, 2003


This file is in the public domain


#include <botan/x509self.h>

#include <botan/rsa.h>

#include <botan/dsa.h>

#include <botan/botan.h>

#include <botan/build.h>

#include <stdafx.h>

#include <iterator>

using namespace Botan;

#  pragma comment ( lib, "libbotan" )


int main(int argc, char* argv[])


   if(argc != 6)


      std::cout << "Usage: " << argv[0] <<

         " passphrase name country_code organization email" << std::endl;

      return 1;



   try {

      //LibraryInitializer init;



      RSA_PrivateKey priv_key(1024);

      // If you want a DSA key instead of RSA, comment out the above line

      // uncomment this one:

      //DSA_PrivateKey priv_key(get_dl_group("DSA-1024"));


      std::ofstream key_file("private.pem");

      key_file << PKCS8::PEM_encode(priv_key, argv[1]);


      X509_Cert_Options opts;


      opts.common_name = argv[2];

      opts.country = argv[3];

      opts.organization = argv[4];

      opts.email = argv[5];


      /* Some hard-coded options, just to give you an idea of what's there

      opts.challenge = "a fixed challenge passphrase";

      opts.locality = "Baltimore";

      opts.state = "MD";

      opts.org_unit = "Testing";





      PKCS10_Request req = X509::create_cert_req(opts, priv_key);


      std::ofstream req_file("req.pem");

      req_file << req.PEM_encode();


   catch(std::exception& e)


      std::cout << e.what() << std::endl;

      return 1;


   return 0;



When I tried to compiling send this error:

error C2871: 'Botan' : a namespace with this name does not exist

I’m using Microsoft Visual C++ 2005.








De: botan-devel-bounces at randombit.net
[mailto:botan-devel-bounces at randombit.net] En nombre de Joel Low
Enviado el: Viernes, 15 de Febrero de 2008 06:23 p.m.
Para: 'Botan development list'
Asunto: RE: [Botan-devel] error C2065: 'LibraryInitializer' :undeclared


#include <botan/botan.h>

using namespace Botan;

//or Botan::LibraryInitializer init;


Try that.





From: botan-devel-bounces at randombit.net
[mailto:botan-devel-bounces at randombit.net] On Behalf Of Gustavo Salmerón
Sent: Saturday, 16 February, 2008 8:22 AM
To: botan-devel at randombit.net
Subject: [Botan-devel] error C2065: 'LibraryInitializer' : undeclared




I’m using Visual Studio 2005, but I can’t compiling pcks10.cpp. I have WinXP
with SP2.


The error message is:

error C2065: 'LibraryInitializer' : undeclared identifier



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20080215/2be716a1/attachment.html>

More information about the botan-devel mailing list