Exemplo n.º 1
0
uint32_t InitCVNWithCertificate(const string &strFasitoPassword)
{
    boost::filesystem::path privkeyFile = GetDataDir() / GetArg("-cvnkeyfile", "cvn.pem");
    FILE* file = fopen(privkeyFile.string().c_str(), "r");
    if (!file) {
        LogPrintf("ERROR: key file not found: %s, is -cvnkeyfile set correctly?\n", privkeyFile);
        return 0;
    }

    X509 *x509Cert = ParseCertificate(file, false, strFasitoPassword);

    if (x509Cert) {
        cvnPubKey = cvnPrivKey.GetRawPubKey();
        return ExtractIdFromCertificate(x509Cert, false);
    }

    return 0;
}
Exemplo n.º 2
0
uint32_t InitChainAdminWithCertificate(const string& strPassword, string &strError)
{
    boost::filesystem::path privkeyFile = GetDataDir() / GetArg("-adminkeyfile", "admin.pem");
    FILE* file = fopen(privkeyFile.string().c_str(), "r");
    if (!file) {
        strprintf(strError, "key file not found: %s, is -adminkeyfile set correctly?", privkeyFile);
        LogPrintf("%s\n", strError);
        return 0;
    }

    X509 *x509Cert = ParseCertificate(file, true, strPassword);

    if (x509Cert) {
        adminPubKey = adminPrivKey.GetRawPubKey();
        return ExtractIdFromCertificate(x509Cert, true);
    }

    strError = "Could not parse the certificate file. Please see the log file for details.";

    return 0;
}