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

Function decrypt_repo_keys

commands.cpp:651–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649}
650
651static bool decrypt_repo_keys (std::vector<Key_file>& key_files, uint32_t key_version, const std::vector<std::string>& secret_keys, const std::string& keys_path)
652{
653 bool successful = false;
654 std::vector<std::string> dirents;
655
656 if (access(keys_path.c_str(), F_OK) == 0) {
657 dirents = get_directory_contents(keys_path.c_str());
658 }
659
660 for (std::vector<std::string>::const_iterator dirent(dirents.begin()); dirent != dirents.end(); ++dirent) {
661 const char* key_name = 0;
662 if (*dirent != "default") {
663 if (!validate_key_name(dirent->c_str())) {
664 continue;
665 }
666 key_name = dirent->c_str();
667 }
668
669 Key_file key_file;
670 if (decrypt_repo_key(key_file, key_name, key_version, secret_keys, keys_path)) {
671 key_files.push_back(key_file);
672 successful = true;
673 }
674 }
675 return successful;
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{

Callers 1

unlockFunction · 0.85

Calls 3

validate_key_nameFunction · 0.85
decrypt_repo_keyFunction · 0.85
get_directory_contentsFunction · 0.70

Tested by

no test coverage detected