Commit 91b9852a authored by jan.koester's avatar jan.koester
Browse files

test

parent 02e69f94
Loading
Loading
Loading
Loading
+15 −2
Changes for plugins/survey/survey.cpp: 15 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -535,8 +535,21 @@ namespace blogi {

            // Sign with RSASSA-PKCS1-v1_5-SHA256 via libnetplus
            try {
                std::vector<uint8_t> pemBytes(privateKeyPem.begin(), privateKeyPem.end());
                netplus::rsa key(pemBytes);
                // PEM to DER: strip header/footer lines, base64-decode the body
                std::string pemBody;
                std::istringstream pemStream(privateKeyPem);
                std::string line;
                while (std::getline(pemStream, line)) {
                    // Remove trailing \r
                    if (!line.empty() && line.back() == '\r') line.pop_back();
                    if (line.find("-----") == 0) continue;
                    pemBody += line;
                }
                std::vector<uint8_t> derBytes;
                std::string decoded = base64Decode(pemBody);
                derBytes.assign(decoded.begin(), decoded.end());

                netplus::rsa key(derBytes);
                if (!key) {
                    std::cerr << "survey: failed to load RSA private key" << std::endl;
                    return "";