# # # patch "automate.cc" # from [4a5ef4b00f72c0c766b65bcf4d26fce3c662cbfc] # to [3f693194a9de3cb8e5214dd13608103597a7f737] # # patch "cmd_list.cc" # from [d46fdf13b05ef2fdb009aed2adafea6436112c7a] # to [9bd690b389ab8f218146de800075c97bdce7333f] # # patch "key_store.cc" # from [6b8e00545cb55deaf6a247b1fccd7ca92bf0dfdf] # to [459dd9ae128419afaaa65dd6bb7d3d725a32f207] # # patch "key_store.hh" # from [cd49166162ff03e5c0bd7539e4fad65c6260ae7f] # to [1f5935e3c1fc3dc4063729c43be2c256c00857f0] # # patch "keys.cc" # from [aeb9579d74ab428a62537612e878d2edcbd2345c] # to [95fc131d10d44a59802efd24ade47d2320530036] # # patch "keys.hh" # from [16ad63cbcd8fa67104f45e3765f587aed9a7f1f4] # to [6cc9c7d9f206f27bfcef3269694585f0eda7eaa1] # # patch "monotone.texi" # from [29cc74363f35be2aa225f3dcaad24972fb2198f1] # to [e3ee512383c619b773f1c7d24acd74ce6b6ad7b1] # ============================================================ --- automate.cc 4a5ef4b00f72c0c766b65bcf4d26fce3c662cbfc +++ automate.cc 3f693194a9de3cb8e5214dd13608103597a7f737 @@ -1753,8 +1753,7 @@ namespace symbol const value("value"); symbol const trust("trust"); - symbol const public_hash("public_hash"); - symbol const private_hash("private_hash"); + symbol const hash("hash"); symbol const public_location("public_location"); symbol const private_location("private_location"); @@ -1768,14 +1767,14 @@ namespace // 1: the key ID // 2: the key passphrase // Added in: 3.1 +// Changed in: FIXME // Purpose: Generates a key with the given ID and passphrase // // Output format: a basic_io stanza for the new key, as for ls keys // // Sample output: // name "address@hidden" -// public_hash [475055ec71ad48f5dfaf875b0fea597b5cbbee64] -// private_hash [7f76dae3f91bb48f80f1871856d9d519770b7f8a] +// hash [475055ec71ad48f5dfaf875b0fea597b5cbbee64] // public_location "database" "keystore" // private_location "keystore" // @@ -1797,8 +1796,8 @@ CMD_AUTOMATE(genkey, N_("KEYID PASSPHRAS utf8 passphrase = idx(args, 1); - id pubhash, privhash; - keys.create_key_pair(db, ident, &passphrase, &pubhash, &privhash); + id hash; + keys.create_key_pair(db, ident, &passphrase, &hash); basic_io::printer prt; basic_io::stanza stz; @@ -1809,8 +1808,7 @@ CMD_AUTOMATE(genkey, N_("KEYID PASSPHRAS privlocs.push_back("keystore"); stz.push_str_pair(syms::name, ident()); - stz.push_binary_pair(syms::public_hash, pubhash); - stz.push_binary_pair(syms::private_hash, privhash); + stz.push_binary_pair(syms::hash, hash); stz.push_str_multi(syms::public_location, publocs); stz.push_str_multi(syms::private_location, privlocs); prt.print_stanza(stz); ============================================================ --- cmd_list.cc d46fdf13b05ef2fdb009aed2adafea6436112c7a +++ cmd_list.cc 9bd690b389ab8f218146de800075c97bdce7333f @@ -343,7 +343,7 @@ CMD(keys, "keys", "", CMD_REF(list), "[P keypair kp; id hash_code; keys.get_key_pair(*i, kp); - key_hash_code(*i, kp.priv, hash_code); + key_hash_code(*i, kp.pub, hash_code); cout << hash_code << ' ' << *i << '\n'; } cout << '\n'; @@ -636,8 +636,7 @@ namespace symbol const value("value"); symbol const trust("trust"); - symbol const public_hash("public_hash"); - symbol const private_hash("private_hash"); + symbol const hash("hash"); symbol const public_location("public_location"); symbol const private_location("private_location"); } @@ -691,8 +690,8 @@ CMD_AUTOMATE(keys, "", vector dbkeys; vector kskeys; - // public_hash, private_hash, public_location, private_location - map, vector > > items; if (db.database_specified()) @@ -708,7 +707,7 @@ CMD_AUTOMATE(keys, "", db.get_key(*i, pub_encoded); key_hash_code(*i, pub_encoded, hash_code); items[(*i)()].get<0>() = hash_code; - items[(*i)()].get<2>().push_back("database"); + items[(*i)()].get<1>().push_back("database"); } for (vector::iterator i = kskeys.begin(); @@ -718,26 +717,22 @@ CMD_AUTOMATE(keys, "", id privhash, pubhash; keys.get_key_pair(*i, kp); key_hash_code(*i, kp.pub, pubhash); - key_hash_code(*i, kp.priv, privhash); items[(*i)()].get<0>() = pubhash; - items[(*i)()].get<1>() = privhash; + items[(*i)()].get<1>().push_back("keystore"); items[(*i)()].get<2>().push_back("keystore"); - items[(*i)()].get<3>().push_back("keystore"); } basic_io::printer prt; - for (map, vector > >::iterator i = items.begin(); i != items.end(); ++i) { basic_io::stanza stz; stz.push_str_pair(syms::name, i->first); - stz.push_binary_pair(syms::public_hash, i->second.get<0>()); - if (!i->second.get<1>()().empty()) - stz.push_binary_pair(syms::private_hash, i->second.get<1>()); - stz.push_str_multi(syms::public_location, i->second.get<2>()); - if (!i->second.get<3>().empty()) - stz.push_str_multi(syms::private_location, i->second.get<3>()); + stz.push_binary_pair(syms::hash, i->second.get<0>()); + stz.push_str_multi(syms::public_location, i->second.get<1>()); + if (!i->second.get<2>().empty()) + stz.push_str_multi(syms::private_location, i->second.get<2>()); prt.print_stanza(stz); } output.write(prt.buf.data(), prt.buf.size()); ============================================================ --- key_store.cc 6b8e00545cb55deaf6a247b1fccd7ca92bf0dfdf +++ key_store.cc 459dd9ae128419afaaa65dd6bb7d3d725a32f207 @@ -552,8 +552,7 @@ key_store::create_key_pair(database & db key_store::create_key_pair(database & db, rsa_keypair_id const & ident, utf8 const * maybe_passphrase, - id * maybe_pubhash, - id * maybe_privhash) + id * maybe_hash) { conditional_transaction_guard guard(db); @@ -624,10 +623,8 @@ key_store::create_key_pair(database & db guard.commit(); } - if (maybe_pubhash) - key_hash_code(ident, kp.pub, *maybe_pubhash); - if (maybe_privhash) - key_hash_code(ident, kp.priv, *maybe_privhash); + if (maybe_hash) + key_hash_code(ident, kp.pub, *maybe_hash); } void ============================================================ --- key_store.hh cd49166162ff03e5c0bd7539e4fad65c6260ae7f +++ key_store.hh 1f5935e3c1fc3dc4063729c43be2c256c00857f0 @@ -85,8 +85,7 @@ public: void create_key_pair(database & db, rsa_keypair_id const & ident, utf8 const * maybe_passphrase = NULL, - id * maybe_pubhash = NULL, - id * maybe_privhash = NULL); + id * maybe_hash = NULL); void change_key_passphrase(rsa_keypair_id const & id); ============================================================ --- keys.cc aeb9579d74ab428a62537612e878d2edcbd2345c +++ keys.cc 95fc131d10d44a59802efd24ade47d2320530036 @@ -126,16 +126,6 @@ key_hash_code(rsa_keypair_id const & ide calculate_ident(tdat, out); } -void -key_hash_code(rsa_keypair_id const & ident, - rsa_priv_key const & priv, - id & out) -{ - data tdat(ident() + ":" + remove_ws(encode_base64(priv)()), - origin::internal); - calculate_ident(tdat, out); -} - // helper to compare if two keys have the same hash // (ie are the same key) bool @@ -150,18 +140,6 @@ keys_match(rsa_keypair_id const & id1, return hash1 == hash2; } -bool -keys_match(rsa_keypair_id const & id1, - rsa_priv_key const & key1, - rsa_keypair_id const & id2, - rsa_priv_key const & key2) -{ - id hash1, hash2; - key_hash_code(id1, key1, hash1); - key_hash_code(id2, key2, hash2); - return hash1 == hash2; -} - // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- keys.hh 16ad63cbcd8fa67104f45e3765f587aed9a7f1f4 +++ keys.hh 6cc9c7d9f206f27bfcef3269694585f0eda7eaa1 @@ -44,10 +44,6 @@ void key_hash_code(rsa_keypair_id const rsa_pub_key const & pub, id & out); -void key_hash_code(rsa_keypair_id const & ident, - rsa_priv_key const & priv, - id & out); - bool keys_match(rsa_keypair_id const & id1, rsa_pub_key const & key1, rsa_keypair_id const & id2, ============================================================ --- monotone.texi 29cc74363f35be2aa225f3dcaad24972fb2198f1 +++ monotone.texi e3ee512383c619b773f1c7d24acd74ce6b6ad7b1 @@ -7682,10 +7682,16 @@ @section Automation @var{name} is the name to associate with the new key, and @var{passphrase} is the passphrase that will be used to encrypt the private half. address@hidden Added in: address@hidden Changes: address@hidden address@hidden +FIXME -- The separate hashes for the private half of a key really didn't +make much sense; have one @code{hash [...]} line instead of separate address@hidden [...]} and @code{private_hash [...]} lines. address@hidden +3.1 -- initial address@hidden itemize -3.1 - @item Purpose: Generate a key with the given name and passphrase. @@ -7694,8 +7700,7 @@ @section Automation @verbatim name "address@hidden" - public_hash [475055ec71ad48f5dfaf875b0fea597b5cbbee64] - private_hash [7f76dae3f91bb48f80f1871856d9d519770b7f8a] + hash [475055ec71ad48f5dfaf875b0fea597b5cbbee64] public_location "database" "keystore" private_location "keystore" @@ -8445,10 +8450,18 @@ @section Automation None. address@hidden Added in: address@hidden Changes: -1.1 address@hidden address@hidden +FIXME -- The separate hashes for the private half of a key really didn't +make much sense; have one @code{hash [...]} line instead of separate address@hidden [...]} and @code{private_hash [...]} lines. address@hidden +1.1 -- initial address@hidden itemize + @item Purpose: Print all keys in basic_io format. @@ -8457,18 +8470,16 @@ @section Automation @verbatim name "address@hidden" - public_hash [475055ec71ad48f5dfaf875b0fea597b5cbbee64] - private_hash [7f76dae3f91bb48f80f1871856d9d519770b7f8a] + hash [475055ec71ad48f5dfaf875b0fea597b5cbbee64] public_location "database" "keystore" private_location "keystore" name "address@hidden" - public_hash [3ac4afcd86af28413b0a23b7d22b9401e15027fc] + hash [3ac4afcd86af28413b0a23b7d22b9401e15027fc] public_location "database" name "address@hidden" - public_hash [115fdc73d87a5e9901d018462b21a1f53eca33a1] - private_hash [b520d2cfe7d30e4ea1725fc4f34646fc5469b13d] + hash [115fdc73d87a5e9901d018462b21a1f53eca33a1] public_location "keystore" private_location "keystore"