This example show how to revoke a certificate and create a certificate revocation list (CRL)
#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");
"RevokeCertificate",
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)
{
cout << "DN Key " << (*dnit).getType() << endl;
if((*dnit).getType() == "countryName")
{
(*dnit).setRDNValue("DE");
}
else if((*dnit).getType() == "commonName")
{
(*dnit).setRDNValue("Test Certificate for revocation 2");
}
else if((*dnit).getType() == "emailAddress")
{
(*dnit).setRDNValue("suse@suse.de");
}
}
cout << "RETURN Certificate " << endl;
}
catch(Exception& e)
{
cerr << e << endl;
}
return 0;
}