MCPcopy Create free account
hub / github.com/AGWA/git-crypt / gpg_encrypt_to_file

Function gpg_encrypt_to_file

gpg.cpp:157–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void gpg_encrypt_to_file (const std::string& filename, const std::string& recipient_fingerprint, bool key_is_trusted, const char* p, size_t len)
158{
159 // gpg --batch -o FILENAME -r RECIPIENT -e
160 std::vector<std::string> command;
161 command.push_back(gpg_get_executable());
162 command.push_back("--batch");
163 if (key_is_trusted) {
164 command.push_back("--trust-model");
165 command.push_back("always");
166 }
167 command.push_back("-o");
168 command.push_back(filename);
169 command.push_back("-r");
170 command.push_back("0x" + recipient_fingerprint);
171 command.push_back("-e");
172 if (!successful_exit(exec_command_with_input(command, p, len))) {
173 throw Gpg_error("Failed to encrypt");
174 }
175}
176
177void gpg_decrypt_from_file (const std::string& filename, std::ostream& output)
178{

Callers 1

encrypt_repo_keyFunction · 0.85

Calls 4

gpg_get_executableFunction · 0.85
successful_exitFunction · 0.85
exec_command_with_inputFunction · 0.85
Gpg_errorClass · 0.85

Tested by

no test coverage detected