This example shows how to export CAs, keys, certificates and CRLs from the repository
#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");
"Export",
LogAppender::ALL_COMPONENTS,
cat,
"%-5p %c - %m"
);
CA ca(
"MyRootCA",
"system");
LocalManagement::writeFile(ba, "./CAKey.key");
LocalManagement::writeFile(ba, "./CAKey2.key");
LocalManagement::writeFile(ba, "./CAKeyDER.key");
LocalManagement::writeFile(ba, "./CA.p12");
LocalManagement::writeFile(ba, "./TestRepos3/testCAChain.p12");
CA ca2(
"MyUserCA",
"system");
"system", "");
LocalManagement::writeFile(ba, "./Key.key");
"system", "tralla");
LocalManagement::writeFile(ba, "./Key2.key");
"system");
LocalManagement::writeFile(ba, "./TestRepos3/KeyDER.key");
"system", "tralla", false);
LocalManagement::writeFile(ba, "./Cert.p12");
"system", "tralla", true);
LocalManagement::writeFile(ba, "./TestRepos3/CertChain.p12");
}
catch(Exception& e)
{
cerr << e << endl;
}
return 0;
}