This is an example which shows how to create a Certificate.
#include <blocxx/Logger.hpp>
#include <blocxx/AppenderLogger.hpp>
#include <blocxx/CerrLogger.hpp>
#include <blocxx/CerrAppender.hpp>
#include <blocxx/String.hpp>
#include <blocxx/PerlRegEx.hpp>
#include <iostream>
#include <fstream>
#include <unistd.h>
using namespace blocxx;
using namespace limal;
using namespace limal::ca_mgm;
using namespace std;
int main()
{
try
{
blocxx::StringArray cat;
cat.push_back("FATAL");
cat.push_back("ERROR");
cat.push_back("INFO");
"CreateCertificate",
LogAppender::ALL_COMPONENTS,
cat,
"%-5p %c - %m"
);
CA ca(
"Test_CA1",
"system",
"./TestRepos/");
List<RDNObject>::iterator dnit;
for(dnit = dnl.begin(); dnit != dnl.end(); ++dnit)
{
if((*dnit).getType() == "countryName")
{
(*dnit).setRDNValue("DE");
}
else if((*dnit).getType() == "commonName")
{
(*dnit).setRDNValue("Full Test Certificate");
}
else if((*dnit).getType() == "emailAddress")
{
(*dnit).setRDNValue("suse@suse.de");
}
}
cout << "RETURN Request " << endl;
NsCertTypeExt::emailCA |
NsCertTypeExt::sslCA);
sl.push_back("2.3.4.5");
sl.push_back("2.12.10.39");
sl.push_back("codeSigning");
sl.push_back("msCTLSign");
sl.push_back("nsSGC");
authorityKeyIdentifier(
AuthorityKeyIdentifierGenerateExt::KeyID_always,
AuthorityKeyIdentifierGenerateExt::Issuer_always);
List<LiteralValue> list;
list.push_back(
LiteralValue(
"URI",
"http://www.my-company.com/"));
List<AuthorityInformation> info;
"http://www.my-company.com/ocsp.pl")));
"http://www.my-company.com/caIssuer.html")));
List<LiteralValue> crldist;
"ldap://ldap.my-company.com/?ou=PKI%2ddc=my-company%2ddc=com"));
blocxx::List<CertificatePolicy> p;
slp.push_back("http://www.my-company.com/");
slp.push_back("http://www2.my-company.com/");
List<Int32> num;
num.push_back(1);
num.push_back(5);
num.push_back(8);
List<UserNotice> unl;
unl.push_back(un);
p.push_back(p2);
cout << "RETURN Certificate " << endl;
}
catch(Exception& e)
{
cerr << e << endl;
}
return 0;
}