| 676 | } |
| 677 | |
| 678 | static 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 | |
| 705 | static int parse_plumbing_options (const char** key_name, const char** key_file, int argc, const char** argv) |
| 706 | { |
no test coverage detected