-// RecombineToClearSignedFile - combine data/signature to message /*{{{*/
-bool RecombineToClearSignedFile(std::string const &OutFile, int const ContentFile,
- std::vector<std::string> const &ContentHeader, int const SignatureFile)
-{
- FILE *clean_file = fopen(OutFile.c_str(), "w");
- fputs("-----BEGIN PGP SIGNED MESSAGE-----\n", clean_file);
- for (std::vector<std::string>::const_iterator h = ContentHeader.begin(); h != ContentHeader.end(); ++h)
- fprintf(clean_file, "%s\n", h->c_str());
- fputs("\n", clean_file);
-
- FILE *data_file = fdopen(ContentFile, "r");
- FILE *sig_file = fdopen(SignatureFile, "r");
- if (data_file == NULL || sig_file == NULL)
- return _error->Error("Couldn't open splitfiles to recombine them into %s", OutFile.c_str());
- char *buf = NULL;
- size_t buf_size = 0;
- while (getline(&buf, &buf_size, data_file) != -1)
- fputs(buf, clean_file);
- fclose(data_file);
- fputs("\n", clean_file);
- while (getline(&buf, &buf_size, sig_file) != -1)
- fputs(buf, clean_file);
- fclose(sig_file);
- fclose(clean_file);
- return true;
-}
- /*}}}*/