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

Function gpg_nth_column

gpg.cpp:45–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 return gpgbin;
44}
45static std::string gpg_nth_column (const std::string& line, unsigned int col)
46{
47 std::string::size_type pos = 0;
48
49 for (unsigned int i = 0; i < col; ++i) {
50 pos = line.find_first_of(':', pos);
51 if (pos == std::string::npos) {
52 throw Gpg_error("Malformed output from gpg");
53 }
54 pos = pos + 1;
55 }
56
57 const std::string::size_type end_pos = line.find_first_of(':', pos);
58
59 return end_pos != std::string::npos ?
60 line.substr(pos, end_pos - pos) :
61 line.substr(pos);
62}
63
64// given a key fingerprint, return the key's UID (e.g. "John Smith <jsmith@example.com>")
65std::string gpg_get_uid (const std::string& fingerprint)

Callers 3

gpg_get_uidFunction · 0.85
gpg_lookup_keyFunction · 0.85
gpg_list_secret_keysFunction · 0.85

Calls 1

Gpg_errorClass · 0.85

Tested by

no test coverage detected