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

Function encrypt_repo_key

commands.cpp:678–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678static void encrypt_repo_key (const char* key_name, const Key_file::Entry& key, const std::vector<std::pair<std::string, bool> >& collab_keys, const std::string& keys_path, std::vector<std::string>* new_files)
679{
680 std::string key_file_data;
681 {
682 Key_file this_version_key_file;
683 this_version_key_file.set_key_name(key_name);
684 this_version_key_file.add(key);
685 key_file_data = this_version_key_file.store_to_string();
686 }
687
688 for (std::vector<std::pair<std::string, bool> >::const_iterator collab(collab_keys.begin()); collab != collab_keys.end(); ++collab) {
689 const std::string& fingerprint(collab->first);
690 const bool key_is_trusted(collab->second);
691 std::ostringstream path_builder;
692 path_builder << keys_path << '/' << (key_name ? key_name : "default") << '/' << key.version << '/' << fingerprint << ".gpg";
693 std::string path(path_builder.str());
694
695 if (access(path.c_str(), F_OK) == 0) {
696 continue;
697 }
698
699 mkdir_parent(path);
700 gpg_encrypt_to_file(path, fingerprint, key_is_trusted, key_file_data.data(), key_file_data.size());
701 new_files->push_back(path);
702 }
703}
704
705static int parse_plumbing_options (const char** key_name, const char** key_file, int argc, const char** argv)
706{

Callers 1

add_gpg_userFunction · 0.85

Calls 5

gpg_encrypt_to_fileFunction · 0.85
set_key_nameMethod · 0.80
store_to_stringMethod · 0.80
mkdir_parentFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected