aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-07 03:11:42 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-07 03:11:42 +0000
commitce3162d03510c9e87c508d4b854757bb501f8461 (patch)
treea404418b94b5b4a6a97d5be9f9e4fc5d8dce39d3 /src/or/dirserv.c
parent2bba65148bd8b427bf3bb5753c371da8395552fc (diff)
downloadtor-ce3162d03510c9e87c508d4b854757bb501f8461.tar
tor-ce3162d03510c9e87c508d4b854757bb501f8461.tar.gz
Make base-64-encoded DER work, including workaround for ugly openssl misfeature that makes base64 decoding fail when you strip out the newlines.
svn:r2423
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 0ff8959ec..a9e37c707 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -557,7 +557,7 @@ dirserv_dump_directory_to_string(char *s, unsigned int maxlen,
char signature[128];
char published[33];
time_t published_on;
- int i, identity_pkeylen;
+ int i;
eos = s+maxlen;
if (!descriptor_list)
@@ -565,14 +565,15 @@ dirserv_dump_directory_to_string(char *s, unsigned int maxlen,
if (list_running_servers(&cp))
return -1;
-#if 0
- /* PEM-encode the identity key key */
- if(crypto_pk_write_public_key_to_string(private_key,
- &identity_pkey,&identity_pkeylen)<0) {
+
+ /* ASN.1-encode the public key. This is a temporary measure; once
+ * everyone is running 0.0.9pre3 or later, we can shift to using a
+ * PEM-encoded key instead.
+ */
+ if(crypto_pk_DER64_encode_public_key(private_key, &identity_pkey)<0) {
log_fn(LOG_WARN,"write identity_pkey to string failed!");
return -1;
}
-#endif
dirserv_remove_old_servers(ROUTER_MAX_AGE);
published_on = time(NULL);
format_iso_time(published, published_on);
@@ -580,8 +581,9 @@ dirserv_dump_directory_to_string(char *s, unsigned int maxlen,
"signed-directory\n"
"published %s\n"
"recommended-software %s\n"
- "running-routers %s\n\n",
- published, options.RecommendedVersions, cp);
+ "running-routers %s\n"
+ "opt dir-signing-key %s\n\n",
+ published, options.RecommendedVersions, cp, identity_pkey);
tor_free(cp);
tor_free(identity_pkey);