For educational reasons I've decided to create my own CA. Here is what I learned.
Lets get some context first.
#include <windows.h> | |
#include <time.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
// http://www.programmingforums.org/post45492.html | |
static const int64_t EPOCH_DIFF = 0x019DB1DED53E8000LL; // 116444736000000000 nsecs | |
static const int RATE_DIFF = 10000000; // 100 nsecs | |
time_t tmToUnixTime(const struct tm& stm) { |
// Convert a wide Unicode string to an UTF8 string | |
std::string utf8_encode(const std::wstring &wstr) | |
{ | |
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); | |
std::string strTo(size_needed, 0); | |
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL); | |
return strTo; | |
} | |
// Convert an UTF8 string to a wide Unicode String |