The unified diff between revisions [2df88abf..] and [818e3621..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "annotate.cc"
# from [c9bd09ef8719f801368bf0a07a09ba98afe2f38f]
# to [873cb5eff33acad204f11e830e6f3450516f4a6d]
#
# patch "botan/es_dev.cpp"
# from [903d37082b372d65135f66cb43f5cfe84f5a930f]
# to [6ca08c9627c30792f3a9c40aea4e75ca4b483154]
#
# patch "cert.cc"
# from [57ab09dc720241f0c15214e40f3f0c9195f9b99f]
# to [d873a7b4eee986f2aa7f0e5f9b000d72ccf14fb9]
#
# patch "cert.hh"
# from [b6b577e3b55a38610801db071a7c766875b0422b]
# to [03b1552a547510f0c4f20292011a87143ee9366f]
#
# patch "cmd_diff_log.cc"
# from [37270d50cda4608c6c2aa624369aecbfd2552868]
# to [f7a6938e7fa401b5974613c38689579d88e27339]
#
# patch "cmd_list.cc"
# from [3924979965585fb4c0c07fc921586ea3a2f49a0b]
# to [5085055f50653ebc2fee62b2584923400dcaea4a]
#
# patch "cmd_merging.cc"
# from [8d21eaac383395a04ac97f4e96f110cd869ebe5c]
# to [77e6ad94c66cee990213f8ed8cbd8c8324acf2b4]
#
# patch "cmd_packet.cc"
# from [a0706ea1d4cbb5f9531ce639fd0c8003dde21100]
# to [40b0b42404f7107752378b5c4b90298c352c091b]
#
# patch "cmd_ws_commit.cc"
# from [fe340c4535fc8b1cd834b27b8aaf40326142b017]
# to [220b529dd498b0da93c07a61baffd19ff5ab7ed5]
#
# patch "commands.cc"
# from [16bc6ea6dbf37798359e4cf69e7db609667cf9de]
# to [f815513f8a69b69bcf44822070d793895cdf9888]
#
# patch "database.cc"
# from [26823fb71c06adf8194ed261513d7fe268d0c77d]
# to [b9bfc2cef4e1561d13cfbf9b2f3b39eb42478b68]
#
# patch "database.hh"
# from [504928c3ecaf2bec82d22528f2bf076597880780]
# to [cdb13d34c338f3d6fb2e48840fd9c3a5b698cbcb]
#
# patch "database_check.cc"
# from [a8c9b240d84d56a90d3f0aaefa87bec2361896f5]
# to [bdf59737a174db2419ffb1ea5b21c69651f4edc5]
#
# patch "key_store.cc"
# from [28bbde42d58ccae4c99c2b15f010c7aa62f5a646]
# to [6edfc02270b976b254b39cf2f0e5f9c514469c07]
#
# patch "key_store.hh"
# from [21f3cbad17bba63b0378d1f64c28d2c5cdf940b7]
# to [a2cba22c7534941db07838f8f7b9e3abede66cce]
#
# patch "keys.cc"
# from [42dc40c096fb9d4b48da5bce928a0e08c938d6ec]
# to [eed2855394e23d0bce4b7a0de434c9731236dd5b]
#
# patch "keys.hh"
# from [a40936fead588c4290487a6b00f64c7f5558f03a]
# to [a3b8a5108dc2d418f906403189a4b62a2299097b]
#
# patch "netcmd.cc"
# from [50e187a13cc5e04970639893759e1460640a3757]
# to [bde32fd29cb479216c638281cf494f72af458466]
#
# patch "netcmd.hh"
# from [15406c426ad26a06900fd8fd6b171e746b1ec1ee]
# to [902079e85a426929649f70aea179a7d706939711]
#
# patch "netsync.cc"
# from [301bbd59d2e2cfbfe788099d9e9540d734744b2b]
# to [7c85e5a05af09ec2f32e8cf441dd8c2549128dc6]
#
# patch "packet.cc"
# from [67cc79b25139bf6bb3c08d7e31b7fb27ae280748]
# to [e47a1ae23cd119b89b14915ce894bb05766fc78b]
#
# patch "packet.hh"
# from [d3119983e2dc5164a6dd1ca161382c211eab5db1]
# to [36079522273c7e5e6b04bc2bebfd22cc07b5bf4c]
#
# patch "project.cc"
# from [62d0f5f0b0e9d4f847bc2f066e58848d5382d6a5]
# to [9c881d67edc2e64055101bcf65a38ba01a590ebc]
#
# patch "revision.cc"
# from [c16d0160d89cb47ba5bec799ec588d52202fa3ed]
# to [f472f361a35ba50757e4f97a3492daf3e5665840]
#
# patch "schema_migration.cc"
# from [8eac2eece6572cf7e66eee9872afd712559614b4]
# to [f2d3da73d631a26623c371280391f81266f9863f]
#
# patch "tester.cc"
# from [f8a82bbf46eb65c1bb81606083157468f3f16316]
# to [6ea29d6556bc31a22a7cecbfd3ddfb13d10810fa]
#
# patch "tests/disallowing_persistence_of_passphrase/__driver__.lua"
# from [f958eef23ce1d9afe61383d47a3bca777e206a8a]
# to [dd1479635e0685e6e78a0e5fbbd9265494703342]
#
# patch "tests/imp_test_filesync_confdir/__driver__.lua"
# from [4962a95b8b12e9d65c4efc64781033fed9d088d7]
# to [a0c260d405c38adf1a0db939f8b3b0549e442528]
#
# patch "transforms.cc"
# from [97e062a540994d9920fa25be161efeb111d342ea]
# to [65d1b80ad0301fa708e2f074653954495e81e79f]
#
# patch "transforms.hh"
# from [79df8cc6117ecb60117ffa7dc22511dc45a84216]
# to [32eb9a8121107799ff7d323e8cd42a6b54528b49]
#
# patch "update.cc"
# from [e4e1f8d71ba2133af8d22537033ed7f1bb350cbd]
# to [04ca1a313bbd21e3fb4654074b36a791246052af]
#
# patch "vocab.cc"
# from [0432bfb26d599d7cc147975e6d5980afde08e5d2]
# to [bf076cdf0d7f4c1a09a37c722c3c5f1937307375]
#
# patch "win32/ssh_agent_platform.cc"
# from [2d9a982788530e4a7f10c3b29224f44458a4a54c]
# to [10a2ac556b690343bcda3eee48f7112bf3b6f799]
#
============================================================
--- annotate.cc c9bd09ef8719f801368bf0a07a09ba98afe2f38f
+++ annotate.cc 873cb5eff33acad204f11e830e6f3450516f4a6d
@@ -353,8 +353,7 @@ cert_string_value(vector< revision<cert>
{
if (i->inner().name == name)
{
- cert_value tv;
- decode_base64 (i->inner().value, tv);
+ cert_value tv(i->inner().value);
string::size_type f = 0;
string::size_type l = string::npos;
if (from_start)
============================================================
--- botan/es_dev.cpp 903d37082b372d65135f66cb43f5cfe84f5a930f
+++ botan/es_dev.cpp 6ca08c9627c30792f3a9c40aea4e75ca4b483154
@@ -8,7 +8,7 @@
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <unistd.h>
namespace Botan {
============================================================
--- cert.cc 57ab09dc720241f0c15214e40f3f0c9195f9b99f
+++ cert.cc d873a7b4eee986f2aa7f0e5f9b000d72ccf14fb9
@@ -114,7 +114,7 @@ erase_bogus_certs(database & db,
vector< manifest<cert> > tmp_certs;
// Sorry, this is a crazy data structure
- typedef tuple< manifest_id, cert_name, base64<cert_value> > trust_key;
+ typedef tuple< manifest_id, cert_name, cert_value > trust_key;
typedef map< trust_key,
pair< shared_ptr< set<rsa_keypair_id> >, it > > trust_map;
trust_map trust;
@@ -139,12 +139,10 @@ erase_bogus_certs(database & db,
for (trust_map::const_iterator i = trust.begin();
i != trust.end(); ++i)
{
- cert_value decoded_value;
- decode_base64(get<2>(i->first), decoded_value);
if (db.hook_get_manifest_cert_trust(*(i->second.first),
get<0>(i->first),
get<1>(i->first),
- decoded_value))
+ get<2>(i->first)))
{
if (global_sanity.debug_p())
{
@@ -177,8 +175,7 @@ erase_bogus_certs(database & db,
vector< revision<cert> > tmp_certs;
// sorry, this is a crazy data structure
- typedef tuple< revision_id,
- cert_name, base64<cert_value> > trust_key;
+ typedef tuple< revision_id, cert_name, cert_value > trust_key;
typedef map< trust_key,
pair< shared_ptr< set<rsa_keypair_id> >, it > > trust_map;
trust_map trust;
@@ -203,12 +200,10 @@ erase_bogus_certs(database & db,
for (trust_map::const_iterator i = trust.begin();
i != trust.end(); ++i)
{
- cert_value decoded_value;
- decode_base64(get<2>(i->first), decoded_value);
if (db.hook_get_revision_cert_trust(*(i->second.first),
get<0>(i->first),
get<1>(i->first),
- decoded_value))
+ get<2>(i->first)))
{
if (global_sanity.debug_p())
L(FL("trust function liked %d signers of %s cert on revision %s")
@@ -241,16 +236,16 @@ cert::cert(revision_id const & ident,
cert::cert(revision_id const & ident,
cert_name const & name,
- base64<cert_value> const & value,
+ cert_value const & value,
rsa_keypair_id const & key)
: ident(ident), name(name), value(value), key(key)
{}
cert::cert(revision_id const & ident,
cert_name const & name,
- base64<cert_value> const & value,
+ cert_value const & value,
rsa_keypair_id const & key,
- base64<rsa_sha1_signature> const & sig)
+ rsa_sha1_signature const & sig)
: ident(ident), name(name), value(value), key(key), sig(sig)
{}
@@ -297,14 +292,9 @@ read_cert(string const & in, cert & t)
extract_variable_length_string(in, sig, pos, "cert sig");
assert_end_of_buffer(in, pos, "cert");
- base64<cert_value> bval;
- base64<rsa_sha1_signature> bsig;
+ cert tmp(hid, cert_name(name), cert_value(val), rsa_keypair_id(key),
+ rsa_sha1_signature(sig));
- encode_base64(cert_value(val), bval);
- encode_base64(rsa_sha1_signature(sig), bsig);
-
- cert tmp(ident, cert_name(name), bval, rsa_keypair_id(key), bsig);
-
id check;
cert_hash_code(tmp, check);
if (!(check == hash))
@@ -323,47 +313,54 @@ write_cert(cert const & t, string & out)
{
string name, key;
id hash;
- rsa_sha1_signature sig_decoded;
- cert_value value_decoded;
cert_hash_code(t, hash);
- decode_base64(t.value, value_decoded);
- decode_base64(t.sig, sig_decoded);
out.append(hash());
out.append(t.ident.inner()());
insert_variable_length_string(t.name(), out);
- insert_variable_length_string(value_decoded(), out);
+ insert_variable_length_string(t.value(), out);
insert_variable_length_string(t.key(), out);
- insert_variable_length_string(sig_decoded(), out);
+ insert_variable_length_string(t.sig(), out);
}
void
-cert_signable_text(cert const & t,
- string & out)
+cert_signable_text(cert const & t, string & out)
{
- out = (FL("[%s@%s:%s]")
- % t.name
- % encode_hexenc(t.ident.inner()())
- % remove_ws(t.value())).str();
+ base64<cert_value> val_encoded(encode_base64(t.value));
+
+ out.clear();
+ out.reserve(4 + t.name().size() + t.ident().size()
+ + val_encoded().size());
+
+ out += '[';
+ out.append(t.name());
+ out += '@';
+ out.append(encode_hexenc(t.ident()()));
+ out += ':';
+ append_without_ws(out, val_encoded());
+ out += ']';
+
L(FL("cert: signable text %s") % out);
}
void
cert_hash_code(cert const & t, id & out)
{
+ base64<rsa_sha1_signature> sig_encoded(encode_base64(t.sig));
+ base64<cert_value> val_encoded(encode_base64(t.value));
string tmp;
- tmp.reserve(4+t.ident.inner()().size() + t.name().size() +
- t.value().size() + t.key().size() + t.sig().size());
+ tmp.reserve(4+t.ident().size() * 2 + t.name().size() + val_encoded().size() +
+ t.key().size() + sig_encoded().size());
tmp.append(encode_hexenc(t.ident.inner()()));
tmp += ':';
tmp.append(t.name());
tmp += ':';
- append_without_ws(tmp,t.value());
+ append_without_ws(tmp, val_encoded());
tmp += ':';
tmp.append(t.key());
tmp += ':';
- append_without_ws(tmp,t.sig());
+ append_without_ws(tmp, sig_encoded());
data tdat(tmp);
calculate_ident(tdat, out);
@@ -386,10 +383,7 @@ put_simple_revision_cert(database & db,
{
I(!keys.signing_key().empty());
- base64<cert_value> encoded_val;
- encode_base64(val, encoded_val);
- cert t(id, nm, encoded_val, keys.signing_key);
-
+ cert t(id.inner(), nm, val, keys.signing_key);
string signed_text;
cert_signable_text(t, signed_text);
load_key_pair(keys, t.key);
============================================================
--- cert.hh b6b577e3b55a38610801db071a7c766875b0422b
+++ cert.hh 03b1552a547510f0c4f20292011a87143ee9366f
@@ -37,18 +37,18 @@ struct cert
cert(revision_id const & ident,
cert_name const & name,
- base64<cert_value> const & value,
+ cert_value const & value,
rsa_keypair_id const & key);
cert(revision_id const & ident,
cert_name const & name,
- base64<cert_value> const & value,
+ cert_value const & value,
rsa_keypair_id const & key,
- base64<rsa_sha1_signature> const & sig);
+ rsa_sha1_signature const & sig);
revision_id ident;
cert_name name;
- base64<cert_value> value;
+ cert_value value;
rsa_keypair_id key;
- base64<rsa_sha1_signature> sig;
+ rsa_sha1_signature sig;
bool operator<(cert const & other) const;
bool operator==(cert const & other) const;
};
============================================================
--- cmd_diff_log.cc 37270d50cda4608c6c2aa624369aecbfd2552868
+++ cmd_diff_log.cc f7a6938e7fa401b5974613c38689579d88e27339
@@ -577,9 +577,6 @@ log_certs(project_t & project, ostream &
for (vector< revision<cert> >::const_iterator i = certs.begin();
i != certs.end(); ++i)
{
- cert_value tv;
- decode_base64(i->inner().value, tv);
-
if (first)
os << label;
else
@@ -587,7 +584,7 @@ log_certs(project_t & project, ostream &
if (multiline)
os << "\n\n";
- os << tv;
+ os << i->inner().value;
if (newline)
os << '\n';
============================================================
--- cmd_list.cc 3924979965585fb4c0c07fc921586ea3a2f49a0b
+++ cmd_list.cc 5085055f50653ebc2fee62b2584923400dcaea4a
@@ -109,8 +109,7 @@ CMD(certs, "certs", "", CMD_REF(list), "
for (size_t i = 0; i < certs.size(); ++i)
{
cert_status status = check_cert(db, idx(certs, i));
- cert_value tv;
- decode_base64(idx(certs, i).value, tv);
+ cert_value tv = idx(certs, i).value;
string washed;
if (guess_binary(tv()))
{
@@ -197,7 +196,7 @@ CMD(keys, "keys", "", CMD_REF(list), "[P
else if (db.database_specified())
{
// we've found a key that should have both a public and a private version
- base64<rsa_pub_key> pub_key;
+ rsa_pub_key pub_key;
keypair priv_key;
db.get_key(*i, pub_key);
keys.get_key_pair(*i, priv_key);
@@ -212,7 +211,7 @@ CMD(keys, "keys", "", CMD_REF(list), "[P
for (map<rsa_keypair_id, bool>::iterator i = pubkeys.begin();
i != pubkeys.end(); i++)
{
- base64<rsa_pub_key> pub_encoded;
+ rsa_pub_key pub_encoded;
id hash_code;
rsa_keypair_id keyid = i->first;
bool indb = i->second;
@@ -602,7 +601,7 @@ CMD_AUTOMATE(keys, "",
for (vector<rsa_keypair_id>::iterator i = dbkeys.begin();
i != dbkeys.end(); i++)
{
- base64<rsa_pub_key> pub_encoded;
+ rsa_pub_key pub_encoded;
id hash_code;
db.get_key(*i, pub_encoded);
key_hash_code(*i, pub_encoded, hash_code);
@@ -721,12 +720,10 @@ CMD_AUTOMATE(certs, N_("REV"),
{
basic_io::stanza st;
cert_status status = check_cert(db, idx(certs, i));
- cert_value tv;
+ cert_value tv = idx(certs, i).value;
cert_name name = idx(certs, i).name;
set<rsa_keypair_id> signers;
- decode_base64(idx(certs, i).value, tv);
-
rsa_keypair_id keyid = idx(certs, i).key;
signers.insert(keyid);
============================================================
--- cmd_merging.cc 8d21eaac383395a04ac97f4e96f110cd869ebe5c
+++ cmd_merging.cc 77e6ad94c66cee990213f8ed8cbd8c8324acf2b4
@@ -99,11 +99,7 @@ pick_branch_for_update(options & opts, d
set< branch_name > branches;
for (vector< revision<cert> >::const_iterator i = certs.begin();
i != certs.end(); i++)
- {
- cert_value b;
- decode_base64(i->inner().value, b);
- branches.insert(branch_name(b()));
- }
+ branches.insert(branch_name(i->inner().value()));
if (branches.find(opts.branchname) != branches.end())
{
============================================================
--- cmd_packet.cc a0706ea1d4cbb5f9531ce639fd0c8003dde21100
+++ cmd_packet.cc 40b0b42404f7107752378b5c4b90298c352c091b
@@ -35,7 +35,7 @@ CMD(pubkey, "pubkey", "", CMD_REF(packet
rsa_keypair_id ident(idx(args, 0)());
bool exists(false);
- base64< rsa_pub_key > key;
+ rsa_pub_key key;
if (db.database_specified() && db.public_key_exists(ident))
{
db.get_key(ident, key);
@@ -124,7 +124,7 @@ namespace
}
virtual void consume_public_key(rsa_keypair_id const & ident,
- base64< rsa_pub_key > const & k)
+ rsa_pub_key const & k)
{
transaction_guard guard(db);
db.put_key(ident, k);
@@ -138,9 +138,9 @@ namespace
}
virtual void consume_old_private_key(rsa_keypair_id const & ident,
- base64<old_arc4_rsa_priv_key> const & k)
+ old_arc4_rsa_priv_key const & k)
{
- base64<rsa_pub_key> dummy;
+ rsa_pub_key dummy;
keys.migrate_old_key_pair(ident, k, dummy);
}
};
============================================================
--- cmd_ws_commit.cc fe340c4535fc8b1cd834b27b8aaf40326142b017
+++ cmd_ws_commit.cc 220b529dd498b0da93c07a61baffd19ff5ab7ed5
@@ -1323,11 +1323,8 @@ CMD(commit, "commit", "ci", CMD_REF(work
project.get_revision_certs(restricted_rev_id, ctmp);
for (vector< revision<cert> >::const_iterator i = ctmp.begin();
i != ctmp.end(); ++i)
- {
- cert_value vtmp;
- decode_base64(i->inner().value, vtmp);
- certs.insert(make_pair(i->inner().name, vtmp));
- }
+ certs.insert(make_pair(i->inner().name, i->inner().value));
+
revision_data rdat;
db.get_revision(restricted_rev_id, rdat);
app.lua.hook_note_commit(restricted_rev_id, rdat, certs);
============================================================
--- commands.cc 16bc6ea6dbf37798359e4cf69e7db609667cf9de
+++ commands.cc f815513f8a69b69bcf44822070d793895cdf9888
@@ -873,19 +873,15 @@ describe_revision(project_t & project, r
for (vector< revision<cert> >::const_iterator i = tmp.begin();
i != tmp.end(); ++i)
{
- cert_value tv;
- decode_base64(i->inner().value, tv);
description += " ";
- description += tv();
+ description += i->inner().value();
}
project.get_revision_certs_by_name(id, date_name, tmp);
for (vector< revision<cert> >::const_iterator i = tmp.begin();
i != tmp.end(); ++i)
{
- cert_value tv;
- decode_base64(i->inner().value, tv);
description += " ";
- description += tv();
+ description += i->inner().value();
}
return description;
============================================================
--- database.cc 26823fb71c06adf8194ed261513d7fe268d0c77d
+++ database.cc b9bfc2cef4e1561d13cfbf9b2f3b39eb42478b68
@@ -377,12 +377,12 @@ private:
void get_certs(id const & ident,
cert_name const & name,
- base64<cert_value> const & val,
+ cert_value const & val,
vector<cert> & certs,
string const & table);
void get_certs(cert_name const & name,
- base64<cert_value> const & val,
+ cert_value const & val,
vector<cert> & certs,
string const & table);
@@ -2645,14 +2645,14 @@ database::get_pubkey(id const & hash,
void
database::get_pubkey(id const & hash,
rsa_keypair_id & id,
- base64<rsa_pub_key> & pub_encoded)
+ rsa_pub_key & pub)
{
results res;
imp->fetch(res, 2, one_row,
query("SELECT id, keydata FROM public_keys WHERE hash = ?")
% blob(hash()));
id = rsa_keypair_id(res[0][0]);
- encode_base64(rsa_pub_key(res[0][1]), pub_encoded);
+ pub = rsa_pub_key(res[0][1]);
}
void
@@ -2666,24 +2666,15 @@ database::get_key(rsa_keypair_id const &
pub = rsa_pub_key(res[0][0]);
}
-void
-database::get_key(rsa_keypair_id const & pub_id,
- base64<rsa_pub_key> & pub_encoded)
-{
- rsa_pub_key pub;
- get_key(pub_id, pub);
- encode_base64(pub, pub_encoded);
-}
-
bool
database::put_key(rsa_keypair_id const & pub_id,
- base64<rsa_pub_key> const & pub_encoded)
+ rsa_pub_key const & pub)
{
if (public_key_exists(pub_id))
{
- base64<rsa_pub_key> tmp;
+ rsa_pub_key tmp;
get_key(pub_id, tmp);
- if (!keys_match(pub_id, tmp, pub_id, pub_encoded))
+ if (!keys_match(pub_id, tmp, pub_id, pub))
W(F("key '%s' is not equal to key '%s' in database") % pub_id % pub_id);
L(FL("skipping existing public key %s") % pub_id);
return false;
@@ -2692,15 +2683,13 @@ database::put_key(rsa_keypair_id const &
L(FL("putting public key %s") % pub_id);
id thash;
- key_hash_code(pub_id, pub_encoded, thash);
+ key_hash_code(pub_id, pub, thash);
I(!public_key_exists(thash));
- rsa_pub_key pub_key;
- decode_base64(pub_encoded, pub_key);
imp->execute(query("INSERT INTO public_keys VALUES(?, ?, ?)")
% blob(thash())
% text(pub_id())
- % blob(pub_key()));
+ % blob(pub()));
return true;
}
@@ -2744,7 +2733,7 @@ database::check_signature(rsa_keypair_id
cert_status
database::check_signature(rsa_keypair_id const & id,
string const & alleged_text,
- base64<rsa_sha1_signature> const & signature)
+ rsa_sha1_signature const & signature)
{
shared_ptr<PK_Verifier> verifier;
@@ -2781,19 +2770,15 @@ database::check_signature(rsa_keypair_id
imp->verifiers.insert(make_pair(id, make_pair(verifier, pub_key)));
}
- // examine signature
- rsa_sha1_signature sig_decoded;
- decode_base64(signature, sig_decoded);
-
// check the text+sig against the key
- L(FL("checking %d-byte (%d decoded) signature") %
- signature().size() % sig_decoded().size());
+ L(FL("checking %d-byte signature") %
+ signature().size());
if (verifier->verify_message(
reinterpret_cast<Botan::byte const*>(alleged_text.data()),
alleged_text.size(),
- reinterpret_cast<Botan::byte const*>(sig_decoded().data()),
- sig_decoded().size()))
+ reinterpret_cast<Botan::byte const*>(signature().data()),
+ signature().size()))
return cert_ok;
else
return cert_bad;
@@ -2806,10 +2791,6 @@ database_impl::cert_exists(cert const &
string const & table)
{
results res;
- cert_value value;
- decode_base64(t.value, value);
- rsa_sha1_signature sig;
- decode_base64(t.sig, sig);
query q = query("SELECT id FROM " + table + " WHERE id = ? "
"AND name = ? "
"AND value = ? "
@@ -2817,9 +2798,9 @@ database_impl::cert_exists(cert const &
"AND signature = ?")
% blob(t.ident.inner()())
% text(t.name())
- % blob(value())
+ % blob(t.value())
% text(t.key())
- % blob(sig());
+ % blob(t.sig());
fetch(res, 1, any_rows, q);
@@ -2833,10 +2814,7 @@ database_impl::put_cert(cert const & t,
{
id thash;
cert_hash_code(t, thash);
- cert_value value;
- decode_base64(t.value, value);
rsa_sha1_signature sig;
- decode_base64(t.sig, sig);
string insert = "INSERT INTO " + table + " VALUES(?, ?, ?, ?, ?, ?)";
@@ -2844,9 +2822,9 @@ database_impl::put_cert(cert const & t,
% blob(thash())
% blob(t.ident.inner()())
% text(t.name())
- % blob(value())
+ % blob(t.value())
% text(t.key())
- % blob(sig()));
+ % blob(t.sig()));
}
void
@@ -2857,15 +2835,11 @@ database_impl::results_to_certs(results
for (size_t i = 0; i < res.size(); ++i)
{
cert t;
- base64<cert_value> value;
- encode_base64(cert_value(res[i][2]), value);
- base64<rsa_sha1_signature> sig;
- encode_base64(rsa_sha1_signature(res[i][4]), sig);
t = cert(revision_id(res[i][0]),
- cert_name(res[i][1]),
- value,
- rsa_keypair_id(res[i][3]),
- sig);
+ cert_name(res[i][1]),
+ cert_value(res[i][2]),
+ rsa_keypair_id(res[i][3]),
+ rsa_sha1_signature(res[i][4]));
certs.push_back(t);
}
}
@@ -2936,7 +2910,7 @@ database_impl::get_certs(cert_name const
void
database_impl::get_certs(cert_name const & name,
- base64<cert_value> const & val,
+ cert_value const & val,
vector<cert> & certs,
string const & table)
{
@@ -2944,11 +2918,9 @@ database_impl::get_certs(cert_name const
query q("SELECT id, name, value, keypair, signature FROM " + table +
" WHERE name = ? AND value = ?");
- cert_value binvalue;
- decode_base64(val, binvalue);
fetch(res, 5, any_rows,
q % text(name())
- % blob(binvalue()));
+ % blob(val()));
results_to_certs(res, certs);
}
@@ -2956,7 +2928,7 @@ database_impl::get_certs(id const & iden
void
database_impl::get_certs(id const & ident,
cert_name const & name,
- base64<cert_value> const & value,
+ cert_value const & value,
vector<cert> & certs,
string const & table)
{
@@ -2964,12 +2936,10 @@ database_impl::get_certs(id const & iden
query q("SELECT id, name, value, keypair, signature FROM " + table +
" WHERE id = ? AND name = ? AND value = ?");
- cert_value binvalue;
- decode_base64(value, binvalue);
fetch(res, 5, any_rows,
q % blob(ident())
% text(name())
- % blob(binvalue()));
+ % blob(value()));
results_to_certs(res, certs);
}
@@ -3063,7 +3033,7 @@ database::get_revision_certs(revision_id
outdated_indicator
database::get_revision_certs(revision_id const & id,
cert_name const & name,
- base64<cert_value> const & val,
+ cert_value const & val,
vector< revision<cert> > & ts)
{
vector<cert> certs;
@@ -3075,15 +3045,13 @@ database::get_revisions_with_cert(cert_n
outdated_indicator
database::get_revisions_with_cert(cert_name const & name,
- base64<cert_value> const & val,
+ cert_value const & val,
set<revision_id> & revisions)
{
revisions.clear();
results res;
query q("SELECT id FROM revision_certs WHERE name = ? AND value = ?");
- cert_value binvalue;
- decode_base64(val, binvalue);
- imp->fetch(res, one_col, any_rows, q % text(name()) % blob(binvalue()));
+ imp->fetch(res, one_col, any_rows, q % text(name()) % blob(val()));
for (results::const_iterator i = res.begin(); i != res.end(); ++i)
revisions.insert(revision_id((*i)[0]));
return imp->cert_stamper.get_indicator();
@@ -3091,7 +3059,7 @@ database::get_revision_certs(cert_name c
outdated_indicator
database::get_revision_certs(cert_name const & name,
- base64<cert_value> const & val,
+ cert_value const & val,
vector< revision<cert> > & ts)
{
vector<cert> certs;
============================================================
--- database.hh 504928c3ecaf2bec82d22528f2bf076597880780
+++ database.hh cdb13d34c338f3d6fb2e48840fd9c3a5b698cbcb
@@ -231,15 +231,11 @@ public:
void get_pubkey(id const & hash,
rsa_keypair_id & ident,
- base64<rsa_pub_key> & pub_encoded);
+ rsa_pub_key & pub);
void get_key(rsa_keypair_id const & ident, rsa_pub_key & pub);
- void get_key(rsa_keypair_id const & ident,
- base64<rsa_pub_key> & pub_encoded);
+ bool put_key(rsa_keypair_id const & ident, rsa_pub_key const & pub);
- bool put_key(rsa_keypair_id const & ident,
- base64<rsa_pub_key> const & pub_encoded);
-
void delete_public_key(rsa_keypair_id const & pub_id);
// Crypto operations
@@ -250,7 +246,7 @@ public:
cert_status check_signature(rsa_keypair_id const & id,
std::string const & alleged_text,
- base64<rsa_sha1_signature> const & signature);
+ rsa_sha1_signature const & signature);
//
// --== Certs ==--
@@ -278,18 +274,18 @@ public:
// Only used by get_branch_certs (project.cc)
outdated_indicator get_revision_certs(cert_name const & name,
- base64<cert_value> const & val,
+ cert_value const & val,
std::vector< revision<cert> > & certs);
// Only used by revision_is_in_branch (project.cc)
outdated_indicator get_revision_certs(revision_id const & ident,
cert_name const & name,
- base64<cert_value> const & value,
+ cert_value const & value,
std::vector< revision<cert> > & certs);
// Only used by get_branch_heads (project.cc)
outdated_indicator get_revisions_with_cert(cert_name const & name,
- base64<cert_value> const & value,
+ cert_value const & value,
std::set<revision_id> & revisions);
// Used through project.cc, and by
============================================================
--- database_check.cc a8c9b240d84d56a90d3f0aaefa87bec2361896f5
+++ database_check.cc bdf59737a174db2419ffb1ea5b21c69651f4edc5
@@ -59,7 +59,7 @@ struct checked_key {
bool found; // found public keypair id in db
size_t sigs; // number of signatures by this key
- base64<rsa_pub_key> pub_encoded;
+ rsa_pub_key pub;
checked_key(): found(false), sigs(0) {}
};
@@ -442,7 +442,7 @@ check_keys(database & db,
for (vector<rsa_keypair_id>::const_iterator i = pubkeys.begin();
i != pubkeys.end(); ++i)
{
- db.get_key(*i, checked_keys[*i].pub_encoded);
+ db.get_key(*i, checked_keys[*i].pub);
checked_keys[*i].found = true;
++ticks;
}
============================================================
--- key_store.cc 28bbde42d58ccae4c99c2b15f010c7aa62f5a646
+++ key_store.cc 6edfc02270b976b254b39cf2f0e5f9c514469c07
@@ -87,8 +87,8 @@ struct key_store_state
bool put_key_pair(rsa_keypair_id const & ident,
keypair const & kp);
void migrate_old_key_pair(rsa_keypair_id const & id,
- base64<old_arc4_rsa_priv_key> const & old_priv,
- base64<rsa_pub_key> const & pub);
+ old_arc4_rsa_priv_key const & old_priv,
+ rsa_pub_key const & pub);
};
namespace
@@ -114,7 +114,7 @@ namespace
virtual void consume_public_key(rsa_keypair_id const & ident,
- base64< rsa_pub_key > const & k)
+ rsa_pub_key const & k)
{E(false, F("Extraneous data in key store."));}
virtual void consume_key_pair(rsa_keypair_id const & ident,
@@ -130,11 +130,11 @@ namespace
// for backward compatibility
virtual void consume_old_private_key(rsa_keypair_id const & ident,
- base64<old_arc4_rsa_priv_key> const & k)
+ old_arc4_rsa_priv_key const & k)
{
W(F("converting old-format private key '%s'") % ident);
- base64<rsa_pub_key> dummy;
+ rsa_pub_key dummy;
kss.migrate_old_key_pair(ident, k, dummy);
L(FL("successfully read key pair '%s' from key store") % ident);
@@ -362,8 +362,6 @@ key_store_state::decrypt_private_key(rsa
key_store_state::decrypt_private_key(rsa_keypair_id const & id,
bool force_from_user)
{
- rsa_priv_key decoded_key;
-
// See if we have this key in the decrypted key cache.
map<rsa_keypair_id, shared_ptr<RSA_PrivateKey> >::const_iterator
cpk = privkey_cache.find(id);
@@ -374,14 +372,13 @@ key_store_state::decrypt_private_key(rsa
N(maybe_get_key_pair(id, kp),
F("no key pair '%s' found in key store '%s'") % id % key_dir);
- L(FL("base64-decoding %d-byte private key") % kp.priv().size());
- decode_base64(kp.priv, decoded_key);
+ L(FL("%d-byte private key") % kp.priv().size());
shared_ptr<PKCS8_PrivateKey> pkcs8_key;
try // with empty passphrase
{
Pipe p;
- p.process_msg(decoded_key());
+ p.process_msg(kp.priv());
pkcs8_key.reset(Botan::PKCS8::load_key(p, ""));
}
catch (Botan::Exception & e)
@@ -401,7 +398,7 @@ key_store_state::decrypt_private_key(rsa
try
{
Pipe p;
- p.process_msg(decoded_key());
+ p.process_msg(kp.priv());
pkcs8_key.reset(Botan::PKCS8::load_key(p, phrase()));
break;
}
@@ -470,6 +467,7 @@ key_store::create_key_pair(database & db
RSA_PrivateKey priv(constants::keylen);
// serialize and maybe encrypt the private key
+ keypair kp;
SecureVector<Botan::byte> pubkey, privkey;
Pipe p;
p.start_msg();
@@ -480,18 +478,15 @@ key_store::create_key_pair(database & db
Botan::RAW_BER);
else
Botan::PKCS8::encode(priv, p);
- rsa_priv_key raw_priv_key(p.read_all_as_string());
+ kp.priv = rsa_priv_key(p.read_all_as_string());
// serialize the public key
Pipe p2;
p2.start_msg();
Botan::X509::encode(priv, p2, Botan::RAW_BER);
- rsa_pub_key raw_pub_key(p2.read_all_as_string());
+ kp.pub = rsa_pub_key(p2.read_all_as_string());
// convert to storage format
- keypair kp;
- encode_base64(raw_priv_key, kp.priv);
- encode_base64(raw_pub_key, kp.pub);
L(FL("generated %d-byte public key\n"
"generated %d-byte (encrypted) private key\n")
% kp.pub().size()
@@ -529,9 +524,8 @@ key_store::change_key_passphrase(rsa_key
Botan::PKCS8::encrypt_key(*priv, p, new_phrase(),
"PBE-PKCS5v20(SHA-1,TripleDES/CBC)",
Botan::RAW_BER);
- rsa_priv_key decoded_key = rsa_priv_key(p.read_all_as_string());
+ kp.priv = rsa_priv_key(p.read_all_as_string());
- encode_base64(decoded_key, kp.priv);
delete_key(id);
put_key_pair(id, kp);
}
@@ -559,7 +553,7 @@ key_store::make_signature(database & db,
key_store::make_signature(database & db,
rsa_keypair_id const & id,
string const & tosign,
- base64<rsa_sha1_signature> & signature)
+ rsa_sha1_signature & signature)
{
keypair key;
get_key_pair(id, key);
@@ -581,11 +575,9 @@ key_store::make_signature(database & db,
{
if (agent.connected()) {
//grab the monotone public key as an RSA_PublicKey
- rsa_pub_key pub;
- decode_base64(key.pub, pub);
SecureVector<Botan::byte> pub_block;
- pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
- pub().size());
+ pub_block.set(reinterpret_cast<Botan::byte const *>(key.pub().data()),
+ key.pub().size());
L(FL("make_signature: building %d-byte pub key") % pub_block.size());
shared_ptr<X509_PublicKey> x509_key =
shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
@@ -662,7 +654,7 @@ key_store::make_signature(database & db,
}
L(FL("make_signature: produced %d-byte signature") % sig_string.size());
- encode_base64(rsa_sha1_signature(sig_string), signature);
+ signature = rsa_sha1_signature(sig_string);
cert_status s = db.check_signature(id, tosign, signature);
I(s != cert_unknown);
@@ -712,8 +704,8 @@ key_store_state::migrate_old_key_pair
void
key_store_state::migrate_old_key_pair
(rsa_keypair_id const & id,
- base64<old_arc4_rsa_priv_key> const & old_priv,
- base64<rsa_pub_key> const & pub)
+ old_arc4_rsa_priv_key const & old_priv,
+ rsa_pub_key const & pub)
{
keypair kp;
SecureVector<Botan::byte> arc4_key;
@@ -735,8 +727,7 @@ key_store_state::migrate_old_key_pair
arc4_key.set(reinterpret_cast<Botan::byte const *>(phrase().data()),
phrase().size());
- Pipe arc4_decryptor(new Botan::Base64_Decoder,
- get_cipher("ARC4", arc4_key, Botan::DECRYPTION));
+ Pipe arc4_decryptor(get_cipher("ARC4", arc4_key, Botan::DECRYPTION));
arc4_decryptor.process_msg(old_priv());
// This is necessary because PKCS8::load_key() cannot currently
@@ -772,8 +763,7 @@ key_store_state::migrate_old_key_pair
Botan::PKCS8::encrypt_key(*priv_key, p, phrase(),
"PBE-PKCS5v20(SHA-1,TripleDES/CBC)",
Botan::RAW_BER);
- rsa_priv_key raw_priv = rsa_priv_key(p.read_all_as_string());
- encode_base64(raw_priv, kp.priv);
+ kp.priv = rsa_priv_key(p.read_all_as_string());
// also the public key (which is derivable from the private key; asking
// Botan for the X.509 encoding of the private key implies that we want
@@ -781,8 +771,7 @@ key_store_state::migrate_old_key_pair
Pipe p2;
p2.start_msg();
Botan::X509::encode(*priv_key, p2, Botan::RAW_BER);
- rsa_pub_key raw_pub = rsa_pub_key(p2.read_all_as_string());
- encode_base64(raw_pub, kp.pub);
+ kp.pub = rsa_pub_key(p2.read_all_as_string());
// if the database had a public key entry for this key, make sure it
// matches what we derived from the private key entry, but don't abort the
@@ -796,8 +785,8 @@ key_store::migrate_old_key_pair
void
key_store::migrate_old_key_pair
(rsa_keypair_id const & id,
- base64<old_arc4_rsa_priv_key> const & old_priv,
- base64<rsa_pub_key> const & pub)
+ old_arc4_rsa_priv_key const & old_priv,
+ rsa_pub_key const & pub)
{
s->migrate_old_key_pair(id, old_priv, pub);
}
============================================================
--- key_store.hh 21f3cbad17bba63b0378d1f64c28d2c5cdf940b7
+++ key_store.hh a2cba22c7534941db07838f8f7b9e3abede66cce
@@ -12,12 +12,12 @@ struct keypair
struct keypair
{
- base64<rsa_pub_key> pub;
- base64<rsa_priv_key> priv;
+ rsa_pub_key pub;
+ rsa_priv_key priv;
keypair()
{}
- keypair(base64<rsa_pub_key> const & a,
- base64<rsa_priv_key> const & b)
+ keypair(rsa_pub_key const & a,
+ rsa_priv_key const & b)
: pub(a), priv(b)
{}
};
@@ -75,7 +75,7 @@ public:
void make_signature(database & db, rsa_keypair_id const & id,
std::string const & tosign,
- base64<rsa_sha1_signature> & signature);
+ rsa_sha1_signature & signature);
// Interoperation with ssh-agent
@@ -86,8 +86,8 @@ public:
// Migration from old databases
void migrate_old_key_pair(rsa_keypair_id const & id,
- base64<old_arc4_rsa_priv_key> const & old_priv,
- base64<rsa_pub_key> const & pub);
+ old_arc4_rsa_priv_key const & old_priv,
+ rsa_pub_key const & pub);
};
// Local Variables:
============================================================
--- keys.cc 42dc40c096fb9d4b48da5bce928a0e08c938d6ec
+++ keys.cc eed2855394e23d0bce4b7a0de434c9731236dd5b
@@ -152,7 +152,7 @@ get_user_key(options const & opts, lua_h
db.put_key(key, priv_key.pub);
else
{
- base64<rsa_pub_key> pub_key;
+ rsa_pub_key pub_key;
db.get_key(key, pub_key);
E(keys_match(key, pub_key, key, priv_key.pub),
F("The key '%s' stored in your database does\n"
@@ -176,19 +176,19 @@ key_hash_code(rsa_keypair_id const & ide
void
key_hash_code(rsa_keypair_id const & ident,
- base64<rsa_pub_key> const & pub,
+ rsa_pub_key const & pub,
id & out)
{
- data tdat(ident() + ":" + remove_ws(pub()));
+ data tdat(ident() + ":" + remove_ws(encode_base64(pub)()));
calculate_ident(tdat, out);
}
void
key_hash_code(rsa_keypair_id const & ident,
- base64< rsa_priv_key > const & priv,
+ rsa_priv_key const & priv,
id & out)
{
- data tdat(ident() + ":" + remove_ws(priv()));
+ data tdat(ident() + ":" + remove_ws(encode_base64(priv)()));
calculate_ident(tdat, out);
}
@@ -196,9 +196,9 @@ keys_match(rsa_keypair_id const & id1,
// (ie are the same key)
bool
keys_match(rsa_keypair_id const & id1,
- base64<rsa_pub_key> const & key1,
+ rsa_pub_key const & key1,
rsa_keypair_id const & id2,
- base64<rsa_pub_key> const & key2)
+ rsa_pub_key const & key2)
{
id hash1, hash2;
key_hash_code(id1, key1, hash1);
@@ -208,9 +208,9 @@ keys_match(rsa_keypair_id const & id1,
bool
keys_match(rsa_keypair_id const & id1,
- base64< rsa_priv_key > const & key1,
+ rsa_priv_key const & key1,
rsa_keypair_id const & id2,
- base64< rsa_priv_key > const & key2)
+ rsa_priv_key const & key2)
{
id hash1, hash2;
key_hash_code(id1, key1, hash1);
============================================================
--- keys.hh a40936fead588c4290487a6b00f64c7f5558f03a
+++ keys.hh a3b8a5108dc2d418f906403189a4b62a2299097b
@@ -47,17 +47,17 @@ void key_hash_code(rsa_keypair_id const
// netsync stuff
void key_hash_code(rsa_keypair_id const & ident,
- base64<rsa_pub_key> const & pub,
+ rsa_pub_key const & pub,
id & out);
void key_hash_code(rsa_keypair_id const & ident,
- base64< rsa_priv_key > const & priv,
+ rsa_priv_key const & priv,
id & out);
bool keys_match(rsa_keypair_id const & id1,
- base64<rsa_pub_key> const & key1,
+ rsa_pub_key const & key1,
rsa_keypair_id const & id2,
- base64<rsa_pub_key> const & key2);
+ rsa_pub_key const & key2);
// Local Variables:
// mode: C++
============================================================
--- netcmd.cc 50e187a13cc5e04970639893759e1460640a3757
+++ netcmd.cc bde32fd29cb479216c638281cf494f72af458466
@@ -306,7 +306,7 @@ netcmd::read_auth_cmd(protocol_role & ro
id & client,
id & nonce1,
rsa_oaep_sha_data & hmac_key_encrypted,
- string & signature) const
+ rsa_sha1_signature & signature) const
{
size_t pos = 0;
// syntax is: <role:1 byte> <include_pattern: vstr> <exclude_pattern: vstr>
@@ -335,8 +335,10 @@ netcmd::read_auth_cmd(protocol_role & ro
extract_variable_length_string(payload, hmac_key, pos,
"auth(hmac) netcmd, hmac_key_encrypted");
hmac_key_encrypted = rsa_oaep_sha_data(hmac_key);
- extract_variable_length_string(payload, signature, pos,
+ string sig_string;
+ extract_variable_length_string(payload, sig_string, pos,
"auth(hmac) netcmd, signature");
+ signature = rsa_sha1_signature(sig_string);
assert_end_of_buffer(payload, pos, "auth(hmac) netcmd payload");
}
@@ -347,7 +349,7 @@ netcmd::write_auth_cmd(protocol_role rol
id const & client,
id const & nonce1,
rsa_oaep_sha_data const & hmac_key_encrypted,
- string const & signature)
+ rsa_sha1_signature const & signature)
{
cmd_code = auth_cmd;
I(client().size() == constants::merkle_hash_length_in_bytes);
@@ -358,7 +360,7 @@ netcmd::write_auth_cmd(protocol_role rol
payload += client();
payload += nonce1();
insert_variable_length_string(hmac_key_encrypted(), payload);
- insert_variable_length_string(signature, payload);
+ insert_variable_length_string(signature(), payload);
}
void
@@ -698,7 +700,7 @@ UNIT_TEST(netcmd, functions)
// total cheat, since we don't actually verify that rsa_oaep_sha_data
// is sensible anywhere here...
rsa_oaep_sha_data out_key("nonce start my heart"), in_key;
- string out_signature(raw_sha1("burble") + raw_sha1("gorby")), in_signature;
+ rsa_sha1_signature out_signature(raw_sha1("burble") + raw_sha1("gorby")), in_signature;
globish out_include_pattern("radishes galore!"), in_include_pattern;
globish out_exclude_pattern("turnips galore!"), in_exclude_pattern;
============================================================
--- netcmd.hh 15406c426ad26a06900fd8fd6b171e746b1ec1ee
+++ netcmd.hh 902079e85a426929649f70aea179a7d706939711
@@ -139,14 +139,14 @@ public:
id & client,
id & nonce1,
rsa_oaep_sha_data & hmac_key_encrypted,
- std::string & signature) const;
+ rsa_sha1_signature & signature) const;
void write_auth_cmd(protocol_role role,
globish const & include_pattern,
globish const & exclude_pattern,
id const & client,
id const & nonce1,
rsa_oaep_sha_data const & hmac_key_encrypted,
- std::string const & signature);
+ rsa_sha1_signature const & signature);
void read_confirm_cmd() const;
void write_confirm_cmd();
============================================================
--- netsync.cc 301bbd59d2e2cfbfe788099d9e9540d734744b2b
+++ netsync.cc 7c85e5a05af09ec2f32e8cf441dd8c2549128dc6
@@ -286,25 +286,23 @@ read_pubkey(string const & in,
static void
read_pubkey(string const & in,
rsa_keypair_id & id,
- base64<rsa_pub_key> & pub)
+ rsa_pub_key & pub)
{
string tmp_id, tmp_key;
size_t pos = 0;
extract_variable_length_string(in, tmp_id, pos, "pubkey id");
extract_variable_length_string(in, tmp_key, pos, "pubkey value");
id = rsa_keypair_id(tmp_id);
- encode_base64(rsa_pub_key(tmp_key), pub);
+ pub = rsa_pub_key(tmp_key);
}
static void
write_pubkey(rsa_keypair_id const & id,
- base64<rsa_pub_key> const & pub,
+ rsa_pub_key const & pub,
string & out)
{
- rsa_pub_key pub_tmp;
- decode_base64(pub, pub_tmp);
insert_variable_length_string(id(), out);
- insert_variable_length_string(pub_tmp(), out);
+ insert_variable_length_string(pub(), out);
}
struct netsync_error
@@ -468,7 +466,7 @@ session:
void queue_error_cmd(string const & errmsg);
void queue_done_cmd(netcmd_item_type type, size_t n_items);
void queue_hello_cmd(rsa_keypair_id const & key_name,
- base64<rsa_pub_key> const & pub_encoded,
+ rsa_pub_key const & pub_encoded,
id const & nonce);
void queue_anonymous_cmd(protocol_role role,
globish const & include_pattern,
@@ -480,7 +478,7 @@ session:
id const & client,
id const & nonce1,
id const & nonce2,
- string const & signature);
+ rsa_sha1_signature const & signature);
void queue_confirm_cmd();
void queue_refine_cmd(refinement_type ty, merkle_node const & node);
void queue_data_cmd(netcmd_item_type type,
@@ -505,7 +503,7 @@ session:
globish const & their_exclude_pattern,
id const & client,
id const & nonce1,
- string const & signature);
+ rsa_sha1_signature const & signature);
bool process_refine_cmd(refinement_type ty, merkle_node const & node);
bool process_done_cmd(netcmd_item_type type, size_t n_items);
bool process_data_cmd(netcmd_item_type type,
@@ -647,11 +645,8 @@ session::~session()
set<pair<rsa_keypair_id, pair<cert_name, cert_value> > > certs;
for (vector<cert>::const_iterator j = ctmp.begin();
j != ctmp.end(); ++j)
- {
- cert_value vtmp;
- decode_base64(j->value, vtmp);
- certs.insert(make_pair(j->key, make_pair(j->name, vtmp)));
- }
+ certs.insert(make_pair(j->key, make_pair(j->name, j->value)));
+
revision_data rdat;
project.db.get_revision(*i, rdat);
lua.hook_note_netsync_revision_received(*i, rdat, certs,
@@ -661,12 +656,8 @@ session::~session()
//Certs (not attached to a new revision)
for (vector<cert>::iterator i = unattached_certs.begin();
i != unattached_certs.end(); ++i)
- {
- cert_value tmp;
- decode_base64(i->value, tmp);
- lua.hook_note_netsync_cert_received(revision_id(i->ident), i->key,
- i->name, tmp, session_id);
- }
+ lua.hook_note_netsync_cert_received(revision_id(i->ident), i->key,
+ i->name, i->value, session_id);
}
lua.hook_note_netsync_end(session_id, error_code,
bytes_in, bytes_out,
@@ -1133,13 +1124,13 @@ session::queue_hello_cmd(rsa_keypair_id
void
session::queue_hello_cmd(rsa_keypair_id const & key_name,
- base64<rsa_pub_key> const & pub_encoded,
+ rsa_pub_key const & pub,
id const & nonce)
{
- rsa_pub_key pub;
if (use_transport_auth)
- decode_base64(pub_encoded, pub);
- cmd.write_hello_cmd(key_name, pub, nonce);
+ cmd.write_hello_cmd(key_name, pub, nonce);
+ else
+ cmd.write_hello_cmd(key_name, rsa_pub_key(), nonce);
write_netcmd_and_try_flush(cmd);
}
@@ -1166,7 +1157,7 @@ session::queue_auth_cmd(protocol_role ro
id const & client,
id const & nonce1,
id const & nonce2,
- string const & signature)
+ rsa_sha1_signature const & signature)
{
netcmd cmd;
rsa_oaep_sha_data hmac_key_encrypted;
@@ -1300,13 +1291,10 @@ session::process_hello_cmd(rsa_keypair_i
I(this->remote_peer_key_hash().size() == 0);
I(this->saved_nonce().size() == 0);
- base64<rsa_pub_key> their_key_encoded;
-
if (use_transport_auth)
{
id their_key_hash;
- encode_base64(their_key, their_key_encoded);
- key_hash_code(their_keyname, their_key_encoded, their_key_hash);
+ key_hash_code(their_keyname, their_key, their_key_hash);
L(FL("server key has name %s, hash %s")
% their_keyname
% encode_hexenc(their_key_hash()));
@@ -1340,7 +1328,7 @@ session::process_hello_cmd(rsa_keypair_i
% encode_hexenc(their_key_hash()));
project.db.set_var(their_key_key, var_value(their_key_hash()));
}
- if (project.db.put_key(their_keyname, their_key_encoded))
+ if (project.db.put_key(their_keyname, their_key))
W(F("saving public key for %s to database") % their_keyname);
{
@@ -1380,20 +1368,18 @@ session::process_hello_cmd(rsa_keypair_i
// make a signature with it;
// this also ensures our public key is in the database
- base64<rsa_sha1_signature> sig;
- rsa_sha1_signature sig_raw;
+ rsa_sha1_signature sig;
keys.make_signature(project.db, signing_key, nonce(), sig);
- decode_base64(sig, sig_raw);
// get the hash identifier for our pubkey
- base64<rsa_pub_key> our_pub;
+ rsa_pub_key our_pub;
project.db.get_key(signing_key, our_pub);
id our_key_hash_raw;
key_hash_code(signing_key, our_pub, our_key_hash_raw);
// make a new nonce of our own and send off the 'auth'
queue_auth_cmd(this->role, our_include_pattern, our_exclude_pattern,
- our_key_hash_raw, nonce, mk_nonce(), sig_raw());
+ our_key_hash_raw, nonce, mk_nonce(), sig);
}
else
{
@@ -1520,7 +1506,7 @@ session::process_auth_cmd(protocol_role
globish const & their_exclude_pattern,
id const & client,
id const & nonce1,
- string const & signature)
+ rsa_sha1_signature const & signature)
{
I(this->remote_peer_key_hash().size() == 0);
I(this->saved_nonce().size() == constants::merkle_hash_length_in_bytes);
@@ -1551,7 +1537,7 @@ session::process_auth_cmd(protocol_role
// Get their public key.
rsa_keypair_id their_id;
- base64<rsa_pub_key> their_key;
+ rsa_pub_key their_key;
project.db.get_pubkey(client, their_id, their_key);
lua.hook_note_netsync_start(session_id, "server", their_role,
@@ -1643,9 +1629,7 @@ session::process_auth_cmd(protocol_role
this->remote_peer_key_hash = client;
// Check the signature.
- base64<rsa_sha1_signature> sig;
- encode_base64(rsa_sha1_signature(signature), sig);
- if (project.db.check_signature(their_id, nonce1(), sig) == cert_ok)
+ if (project.db.check_signature(their_id, nonce1(), signature) == cert_ok)
{
// Get our private key and sign back.
L(FL("client signature OK, accepting authentication"));
@@ -1871,10 +1855,10 @@ session::load_data(netcmd_item_type type
case key_item:
{
rsa_keypair_id keyid;
- base64<rsa_pub_key> pub_encoded;
- project.db.get_pubkey(item, keyid, pub_encoded);
+ rsa_pub_key pub;
+ project.db.get_pubkey(item, keyid, pub);
L(FL("public key '%s' is also called '%s'") % hitem % keyid);
- write_pubkey(keyid, pub_encoded, out);
+ write_pubkey(keyid, pub, out);
}
break;
@@ -1972,7 +1956,7 @@ session::process_data_cmd(netcmd_item_ty
case key_item:
{
rsa_keypair_id keyid;
- base64<rsa_pub_key> pub;
+ rsa_pub_key pub;
read_pubkey(dat, keyid, pub);
id tmp;
key_hash_code(keyid, pub, tmp);
@@ -2161,7 +2145,7 @@ session::dispatch_payload(netcmd const &
require(voice == server_voice, "auth netcmd received in server voice");
{
protocol_role role;
- string signature;
+ rsa_sha1_signature signature;
globish their_include_pattern, their_exclude_pattern;
id client, nonce1, nonce2;
rsa_oaep_sha_data hmac_key_encrypted;
@@ -3272,10 +3256,10 @@ session::rebuild_merkle_trees(set<branch
{
if (project.db.public_key_exists(*key))
{
- base64<rsa_pub_key> pub_encoded;
- project.db.get_key(*key, pub_encoded);
+ rsa_pub_key pub;
+ project.db.get_key(*key, pub);
id keyhash;
- key_hash_code(*key, pub_encoded, keyhash);
+ key_hash_code(*key, pub, keyhash);
// FIXME: conditional encode_hexenc
hexenc<id> hkeyhash(encode_hexenc(keyhash()));
L(FL("noting key '%s' = '%s' to send") % *key % hkeyhash);
============================================================
--- packet.cc 67cc79b25139bf6bb3c08d7e31b7fb27ae280748
+++ packet.cc e47a1ae23cd119b89b14915ce894bb05766fc78b
@@ -76,17 +76,17 @@ packet_writer::consume_revision_cert(rev
ost << "[rcert " << encode_hexenc(t.inner().ident.inner()()) << '\n'
<< " " << t.inner().name() << '\n'
<< " " << t.inner().key() << '\n'
- << " " << trim_ws(t.inner().value()) << "]\n"
- << trim_ws(t.inner().sig()) << '\n'
+ << " " << trim_ws(encode_base64(t.inner().value)()) << "]\n"
+ << trim_ws(encode_base64(t.inner().sig)()) << '\n'
<< "[end]\n";
}
void
packet_writer::consume_public_key(rsa_keypair_id const & ident,
- base64< rsa_pub_key > const & k)
+ rsa_pub_key const & k)
{
ost << "[pubkey " << ident() << "]\n"
- << trim_ws(k()) << '\n'
+ << trim_ws(encode_base64(k)()) << '\n'
<< "[end]\n";
}
@@ -95,16 +95,17 @@ packet_writer::consume_key_pair(rsa_keyp
keypair const & kp)
{
ost << "[keypair " << ident() << "]\n"
- << trim_ws(kp.pub()) <<"#\n" <<trim_ws(kp.priv()) << '\n'
+ << trim_ws(encode_base64(kp.pub)()) << "#\n"
+ << trim_ws(encode_base64(kp.priv)()) << '\n'
<< "[end]\n";
}
void
packet_writer::consume_old_private_key(rsa_keypair_id const & ident,
- base64<old_arc4_rsa_priv_key> const & k)
+ old_arc4_rsa_priv_key const & k)
{
ost << "[privkey " << ident() << "]\n"
- << trim_ws(k()) << '\n'
+ << trim_ws(encode_base64(k)()) << '\n'
<< "[end]\n";
}
@@ -215,12 +216,13 @@ namespace
revision_id hash(decode_hexenc(certid));
validate_base64(body);
+
// canonicalize the base64 encodings to permit searches
cert t = cert(hash,
cert_name(name),
- base64<cert_value>(canonical_base64(val)),
+ decode_base64_as<cert_value>(val),
rsa_keypair_id(keyid),
- base64<rsa_sha1_signature>(canonical_base64(body)));
+ decode_base64_as<rsa_sha1_signature>(body));
cons.consume_revision_cert(revision<cert>(t));
}
@@ -231,7 +233,7 @@ namespace
validate_base64(body);
cons.consume_public_key(rsa_keypair_id(args),
- base64<rsa_pub_key>(body));
+ decode_base64_as<rsa_pub_key>(body));
}
void keypair_packet(string const & args, string const & body) const
@@ -245,8 +247,8 @@ namespace
validate_base64(pub);
validate_base64(priv);
cons.consume_key_pair(rsa_keypair_id(args),
- keypair(base64<rsa_pub_key>(pub),
- base64<rsa_priv_key>(priv)));
+ keypair(decode_base64_as<rsa_pub_key>(pub),
+ decode_base64_as<rsa_priv_key>(priv)));
}
void privkey_packet(string const & args, string const & body) const
@@ -255,7 +257,7 @@ namespace
validate_key(args);
validate_base64(body);
cons.consume_old_private_key(rsa_keypair_id(args),
- base64<old_arc4_rsa_priv_key>(body));
+ decode_base64_as<old_arc4_rsa_priv_key>(body));
}
void operator()(string const & type,
@@ -500,10 +502,8 @@ UNIT_TEST(packet, roundabout)
pw.consume_revision_data(rid, rdat);
// a cert packet
- base64<cert_value> val;
- encode_base64(cert_value("peaches"), val);
- base64<rsa_sha1_signature> sig;
- encode_base64(rsa_sha1_signature("blah blah there is no way this is a valid signature"), sig);
+ cert_value val("peaches");
+ rsa_sha1_signature sig("blah blah there is no way this is a valid signature");
// cert now accepts revision_id exclusively, so we need to cast the
// file_id to create a cert to test the packet writer with.
@@ -513,16 +513,15 @@ UNIT_TEST(packet, roundabout)
keypair kp;
// a public key packet
- encode_base64(rsa_pub_key("this is not a real rsa key"), kp.pub);
+ kp.pub = rsa_pub_key("this is not a real rsa key");
pw.consume_public_key(rsa_keypair_id("test@lala.com"), kp.pub);
// a keypair packet
- encode_base64(rsa_priv_key("this is not a real rsa key either!"), kp.priv);
+ kp.priv = rsa_priv_key("this is not a real rsa key either!");
pw.consume_key_pair(rsa_keypair_id("test@lala.com"), kp);
// an old privkey packet
- base64<old_arc4_rsa_priv_key> oldpriv;
- encode_base64(old_arc4_rsa_priv_key("and neither is this!"), oldpriv);
+ old_arc4_rsa_priv_key oldpriv("and neither is this!");
pw.consume_old_private_key(rsa_keypair_id("test@lala.com"), oldpriv);
tmp = oss.str();
============================================================
--- packet.hh d3119983e2dc5164a6dd1ca161382c211eab5db1
+++ packet.hh 36079522273c7e5e6b04bc2bebfd22cc07b5bf4c
@@ -50,11 +50,11 @@ public:
virtual void consume_public_key(rsa_keypair_id const & ident,
- base64< rsa_pub_key > const & k) = 0;
+ rsa_pub_key const & k) = 0;
virtual void consume_key_pair(rsa_keypair_id const & ident,
keypair const & kp) = 0;
virtual void consume_old_private_key(rsa_keypair_id const & ident,
- base64< old_arc4_rsa_priv_key > const & k) = 0;
+ old_arc4_rsa_priv_key const & k) = 0;
};
// this writer writes packets into a stream
@@ -75,11 +75,11 @@ struct packet_writer : public packet_con
virtual void consume_revision_cert(revision<cert> const & t);
virtual void consume_public_key(rsa_keypair_id const & ident,
- base64< rsa_pub_key > const & k);
+ rsa_pub_key const & k);
virtual void consume_key_pair(rsa_keypair_id const & ident,
keypair const & kp);
virtual void consume_old_private_key(rsa_keypair_id const & ident,
- base64< old_arc4_rsa_priv_key > const & k);
+ old_arc4_rsa_priv_key const & k);
};
size_t read_packets(std::istream & in, packet_consumer & cons);
============================================================
--- project.cc 62d0f5f0b0e9d4f847bc2f066e58848d5382d6a5
+++ project.cc 9c881d67edc2e64055101bcf65a38ba01a590ebc
@@ -82,17 +82,17 @@ namespace
struct not_in_branch : public is_failure
{
database & db;
- base64<cert_value > const & branch_encoded;
+ branch_name const & branch;
not_in_branch(database & db,
- base64<cert_value> const & branch_encoded)
- : db(db), branch_encoded(branch_encoded)
+ branch_name const & branch)
+ : db(db), branch(branch)
{}
virtual bool operator()(revision_id const & rid)
{
vector< revision<cert> > certs;
db.get_revision_certs(rid,
cert_name(branch_cert_name),
- branch_encoded,
+ cert_value(branch()),
certs);
erase_bogus_certs(db, certs);
return certs.empty();
@@ -102,17 +102,17 @@ namespace
struct suspended_in_branch : public is_failure
{
database & db;
- base64<cert_value > const & branch_encoded;
+ branch_name const & branch;
suspended_in_branch(database & db,
- base64<cert_value> const & branch_encoded)
- : db(db), branch_encoded(branch_encoded)
+ branch_name const & branch)
+ : db(db), branch(branch)
{}
virtual bool operator()(revision_id const & rid)
{
vector< revision<cert> > certs;
db.get_revision_certs(rid,
cert_name(suspend_cert_name),
- branch_encoded,
+ cert_value(branch()),
certs);
erase_bogus_certs(db, certs);
return !certs.empty();
@@ -133,21 +133,18 @@ project_t::get_branch_heads(branch_name
if (branch.first.outdated())
{
L(FL("getting heads of branch %s") % name);
- base64<cert_value> branch_encoded;
- encode_base64(cert_value(name()), branch_encoded);
- outdated_indicator stamp;
branch.first = db.get_revisions_with_cert(cert_name(branch_cert_name),
- branch_encoded,
- branch.second);
+ cert_value(name()),
+ branch.second);
- not_in_branch p(db, branch_encoded);
+ not_in_branch p(db, name);
erase_ancestors_and_failures(db, branch.second, p,
inverse_graph_cache_ptr);
if (!ignore_suspend_certs)
{
- suspended_in_branch s(db, branch_encoded);
+ suspended_in_branch s(db, name);
std::set<revision_id>::iterator it = branch.second.begin();
while (it != branch.second.end())
if (s(*it))
@@ -166,11 +163,8 @@ project_t::revision_is_in_branch(revisio
project_t::revision_is_in_branch(revision_id const & id,
branch_name const & branch)
{
- base64<cert_value> branch_encoded;
- encode_base64(cert_value(branch()), branch_encoded);
-
vector<revision<cert> > certs;
- db.get_revision_certs(id, branch_cert_name, branch_encoded, certs);
+ db.get_revision_certs(id, branch_cert_name, cert_value(branch()), certs);
int num = certs.size();
@@ -197,11 +191,8 @@ project_t::revision_is_suspended_in_bran
project_t::revision_is_suspended_in_branch(revision_id const & id,
branch_name const & branch)
{
- base64<cert_value> branch_encoded;
- encode_base64(cert_value(branch()), branch_encoded);
-
vector<revision<cert> > certs;
- db.get_revision_certs(id, suspend_cert_name, branch_encoded, certs);
+ db.get_revision_certs(id, suspend_cert_name, cert_value(branch()), certs);
int num = certs.size();
@@ -258,11 +249,8 @@ project_t::get_revision_branches(revisio
branches.clear();
for (std::vector<revision<cert> >::const_iterator i = certs.begin();
i != certs.end(); ++i)
- {
- cert_value b;
- decode_base64(i->inner().value, b);
- branches.insert(branch_name(b()));
- }
+ branches.insert(branch_name(i->inner().value()));
+
return i;
}
@@ -270,10 +258,7 @@ project_t::get_branch_certs(branch_name
project_t::get_branch_certs(branch_name const & branch,
std::vector<revision<cert> > & certs)
{
- base64<cert_value> branch_encoded;
- encode_base64(cert_value(branch()), branch_encoded);
-
- return db.get_revision_certs(branch_cert_name, branch_encoded, certs);
+ return db.get_revision_certs(branch_cert_name, cert_value(branch()), certs);
}
tag_t::tag_t(revision_id const & ident,
@@ -309,11 +294,9 @@ project_t::get_tags(set<tag_t> & tags)
tags.clear();
for (std::vector<revision<cert> >::const_iterator i = certs.begin();
i != certs.end(); ++i)
- {
- cert_value value;
- decode_base64(i->inner().value, value);
- tags.insert(tag_t(revision_id(i->inner().ident), utf8(value()), i->inner().key));
- }
+ tags.insert(tag_t(revision_id(i->inner().ident),
+ utf8(i->inner().value()), i->inner().key));
+
return i;
}
============================================================
--- revision.cc c16d0160d89cb47ba5bec799ec588d52202fa3ed
+++ revision.cc f472f361a35ba50757e4f97a3492daf3e5665840
@@ -1086,11 +1086,9 @@ anc_graph::add_node_for_old_manifest(man
i != mcerts.end(); ++i)
{
L(FL("loaded '%s' manifest cert for node %s") % i->inner().name % node);
- cert_value tv;
- decode_base64(i->inner().value, tv);
++n_certs_in;
- certs.insert(make_pair(node,
- make_pair(i->inner().name, tv)));
+ certs.insert(make_pair(node, make_pair(i->inner().name,
+ i->inner().value)));
}
}
else
@@ -1128,14 +1126,12 @@ u64 anc_graph::add_node_for_oldstyle_rev
i != rcerts.end(); ++i)
{
L(FL("loaded '%s' revision cert for node %s") % i->inner().name % node);
- cert_value tv;
- decode_base64(i->inner().value, tv);
++n_certs_in;
- certs.insert(make_pair(node,
- make_pair(i->inner().name, tv)));
+ certs.insert(make_pair(node, make_pair(i->inner().name,
+ i->inner().value)));
if (i->inner().name == branch_cert_name)
- branches.insert(tv());
+ branches.insert(i->inner().value());
}
}
else
@@ -1717,11 +1713,9 @@ build_changesets_from_manifest_ancestry(
for (vector< manifest<cert> >::const_iterator i = tmp.begin();
i != tmp.end(); ++i)
{
- cert_value tv;
- decode_base64(i->inner().value, tv);
manifest_id child, parent;
child = manifest_id(i->inner().ident.inner());
- parent = manifest_id(tv());
+ parent = manifest_id(i->inner().value());
u64 parent_node = graph.add_node_for_old_manifest(parent);
u64 child_node = graph.add_node_for_old_manifest(child);
============================================================
--- schema_migration.cc 8eac2eece6572cf7e66eee9872afd712559614b4
+++ schema_migration.cc f2d3da73d631a26623c371280391f81266f9863f
@@ -285,20 +285,20 @@ sqlite3_unbase64_fn(sqlite3_context *f,
sqlite3_result_error(f, "need exactly 1 arg to unbase64()", -1);
return;
}
- data decoded;
+ string decoded;
// This operation may throw informative_failure. We must intercept that
// and turn it into a call to sqlite3_result_error, or rollback will fail.
try
{
- decode_base64(base64<data>(string(sqlite3_value_cstr(args[0]))), decoded);
+ decoded = decode_base64_as<string>(sqlite3_value_cstr(args[0]));
}
catch (informative_failure & e)
{
sqlite3_result_error(f, e.what(), -1);
return;
}
- sqlite3_result_blob(f, decoded().c_str(), decoded().size(), SQLITE_TRANSIENT);
+ sqlite3_result_blob(f, decoded.c_str(), decoded.size(), SQLITE_TRANSIENT);
}
static void
@@ -527,7 +527,9 @@ migrate_to_external_privkeys(sqlite3 * d
P(F("moving key '%s' from database to %s")
% ident % keys.get_key_dir());
- keys.migrate_old_key_pair(ident, old_priv, pub);
+ keys.migrate_old_key_pair(ident,
+ decode_base64(old_priv),
+ decode_base64(pub));
}
}
============================================================
--- tester.cc f8a82bbf46eb65c1bb81606083157468f3f16316
+++ tester.cc 6ea29d6556bc31a22a7cecbfd3ddfb13d10810fa
@@ -11,6 +11,11 @@
#include <botan/pipe.h>
#include <cstring>
+#ifdef WIN32
+#define WIN32_LEAN_AND_MEAN // no gui definitions
+#include <windows.h>
+#endif
+
using std::string;
using std::map;
using std::vector;
============================================================
--- tests/disallowing_persistence_of_passphrase/__driver__.lua f958eef23ce1d9afe61383d47a3bca777e206a8a
+++ tests/disallowing_persistence_of_passphrase/__driver__.lua dd1479635e0685e6e78a0e5fbbd9265494703342
@@ -2,18 +2,16 @@ save_env()
mtn_setup()
save_env()
-unset_env("SSH_AUTH_SOCK")
-
check(get("persist.lua"))
addfile("input.txt", "version 0 of the file")
writefile("input.txt", "version 1 of the file")
-check(mtn("--branch=testbranch", "--rcfile=persist.lua",
+check(mtn("--ssh-sign=no", "--branch=testbranch", "--rcfile=persist.lua",
"commit", "--message=blah-blah"),
1, false, false, "tester@test.net\n")
-check(mtn("--branch=testbranch", "--rcfile=persist.lua",
+check(mtn("--ssh-sign=no", "--branch=testbranch", "--rcfile=persist.lua",
"commit", "--message=blah-blah"),
0, false, false, string.rep("tester@test.net\n", 4))
@@ -23,4 +21,3 @@ check(qgrep("changelog", "stdout"))
check(qgrep("date", "stdout"))
check(qgrep("changelog", "stdout"))
-restore_env()
============================================================
--- tests/imp_test_filesync_confdir/__driver__.lua 4962a95b8b12e9d65c4efc64781033fed9d088d7
+++ tests/imp_test_filesync_confdir/__driver__.lua a0c260d405c38adf1a0db939f8b3b0549e442528
@@ -18,8 +18,12 @@ n = 0
check(mtn("sync", "file:test2.db", "testbranch"), 0, true, false)
n = 0
+
+
+testroot_unix = string.gsub(test.root, '\\', '/')
+
for line in io.lines("checkfile") do
- check(line == test.root)
+ check(line == testroot_unix)
n = n + 1
end
check(n == 2)
============================================================
--- transforms.cc 97e062a540994d9920fa25be161efeb111d342ea
+++ transforms.cc 65d1b80ad0301fa708e2f074653954495e81e79f
@@ -223,23 +223,6 @@ calculate_ident(revision_data const & da
ident = revision_id(tmp);
}
-string
-canonical_base64(string const & s)
-{
- try
- {
- Botan::Pipe pipe(new Botan::Base64_Decoder(),
- new Botan::Base64_Encoder());
- pipe.process_msg(s);
- return pipe.read_all_as_string();
- }
- catch (Botan::Exception & e)
- {
- error_in_transform(e);
- }
-}
-
-
#ifdef BUILD_UNIT_TESTS
#include "unit_tests.hh"
#include <stdlib.h>
@@ -250,8 +233,8 @@ UNIT_TEST(transform, enc)
gzip<data> gzd1, gzd2;
base64< gzip<data> > bgzd;
encode_gzip(d1, gzd1);
- encode_base64(gzd1, bgzd);
- decode_base64(bgzd, gzd2);
+ bgzd = encode_base64(gzd1);
+ gzd2 = decode_base64(bgzd);
UNIT_TEST_CHECK(gzd2 == gzd1);
decode_gzip(gzd2, d2);
UNIT_TEST_CHECK(d2 == d1);
============================================================
--- transforms.hh 79df8cc6117ecb60117ffa7dc22511dc45a84216
+++ transforms.hh 32eb9a8121107799ff7d323e8cd42a6b54528b49
@@ -47,13 +47,18 @@ template <typename T>
// base64 encoding
template <typename T>
-void encode_base64(T const & in, base64<T> & out)
-{ out = base64<T>(T(xform<Botan::Base64_Encoder>(in()))); }
+base64<T> encode_base64(T const & in)
+{ return base64<T>(T(xform<Botan::Base64_Encoder>(in()))); }
template <typename T>
-void decode_base64(base64<T> const & in, T & out)
-{ out = T(xform<Botan::Base64_Decoder>(in())); }
+T decode_base64(base64<T> const & in)
+{ return T(xform<Botan::Base64_Decoder>(in())); }
+template <typename T>
+T decode_base64_as(std::string const & in)
+{
+ return T(xform<Botan::Base64_Decoder>(in));
+}
// hex encoding
template <typename T>
@@ -109,10 +114,6 @@ void calculate_ident(revision_data const
void calculate_ident(revision_data const & dat,
revision_id & ident);
-// canonicalize base64 encoding
-std::string canonical_base64(std::string const & s);
-
-
// Local Variables:
// mode: C++
// fill-column: 76
============================================================
--- update.cc e4e1f8d71ba2133af8d22537033ed7f1bb350cbd
+++ update.cc 04ca1a313bbd21e3fb4654074b36a791246052af
@@ -63,8 +63,7 @@ get_test_results_for_revision(project_t
for (vector< revision<cert> >::const_iterator i = certs.begin();
i != certs.end(); ++i)
{
- cert_value cv;
- decode_base64(i->inner().value, cv);
+ cert_value cv = i->inner().value;
try
{
bool test_ok = lexical_cast<bool>(cv());
============================================================
--- vocab.cc 0432bfb26d599d7cc147975e6d5980afde08e5d2
+++ vocab.cc bf076cdf0d7f4c1a09a37c722c3c5f1937307375
@@ -210,7 +210,7 @@ template
template
-void dump<rsa_pub_key>(base64<rsa_pub_key> const&, string &);
+void dump(rsa_pub_key const&, string &);
template
void dump(roster_data const & d, string &);
============================================================
--- win32/ssh_agent_platform.cc 2d9a982788530e4a7f10c3b29224f44458a4a54c
+++ win32/ssh_agent_platform.cc 10a2ac556b690343bcda3eee48f7112bf3b6f799
@@ -18,7 +18,6 @@ using std::string;
#define AGENT_COPYDATA_ID 0x804e50ba /* random goop */
#define AGENT_MAX_MSGLEN 8192
-void
ssh_agent_platform::ssh_agent_platform()
: hwnd(NULL), filemap(NULL), filemap_view(NULL), read_len(0)
{