aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-04-10 21:23:00 +0000
committerNick Mathewson <nickm@torproject.org>2006-04-10 21:23:00 +0000
commit1fbc74661f6b47d452e58eac22c3e55f90d692c2 (patch)
treec8ea4526dc7cd2d30a2dabde459f63222c2b40da /src/common
parent37c77c71f798cdbd2b7b06e178772640a4516747 (diff)
downloadtor-1fbc74661f6b47d452e58eac22c3e55f90d692c2.tar
tor-1fbc74661f6b47d452e58eac22c3e55f90d692c2.tar.gz
Remove DER64 functions in trunk: they will never be used again unless the directory authorities switch back to 0.0.9tooearly.
svn:r6376
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c64
-rw-r--r--src/common/crypto.h2
2 files changed, 0 insertions, 66 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 4cdc81464..5460c6d4d 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -574,70 +574,6 @@ crypto_pk_write_private_key_to_filename(crypto_pk_env_t *env,
return r;
}
-/** Allocate a new string in *<b>out</b>, containing the public portion of the
- * RSA key in <b>env</b>, encoded first with DER, then in base-64. Return the
- * length of the encoded representation on success, and -1 on failure.
- *
- * <i>This function is for temporary use only. We need a simple
- * one-line representation for keys to work around a bug in parsing
- * directories containing "opt keyword\n-----BEGIN OBJECT----" entries
- * in versions of Tor up to 0.0.9pre2.</i>
- */
-int
-crypto_pk_DER64_encode_public_key(crypto_pk_env_t *env, char **out)
-{
- int len;
- char buf[PK_BYTES*2]; /* Too long, but hey, stacks are big. */
- tor_assert(env);
- tor_assert(out);
- len = crypto_pk_asn1_encode(env, buf, sizeof(buf));
- if (len < 0) {
- return -1;
- }
- *out = tor_malloc(len * 2); /* too long, but safe. */
- if (base64_encode(*out, len*2, buf, len) < 0) {
- log_warn(LD_CRYPTO, "Error base64-encoding DER-encoded key");
- tor_free(*out);
- return -1;
- }
- /* Remove spaces */
- tor_strstrip(*out, " \r\n\t");
- return strlen(*out);
-}
-
-/** Decode a base-64 encoded DER representation of an RSA key from <b>in</b>,
- * and store the result in <b>env</b>. Return 0 on success, -1 on failure.
- *
- * <i>This function is for temporary use only. We need a simple
- * one-line representation for keys to work around a bug in parsing
- * directories containing "opt keyword\n-----BEGIN OBJECT----" entries
- * in versions of Tor up to 0.0.9pre2.</i>
- */
-crypto_pk_env_t *
-crypto_pk_DER64_decode_public_key(const char *in)
-{
- char partitioned[PK_BYTES*2 + 16];
- char buf[PK_BYTES*2];
- int len;
- tor_assert(in);
- len = strlen(in);
-
- if (strlen(in) > PK_BYTES*2) {
- return NULL;
- }
- /* base64_decode doesn't work unless we insert linebreaks every 64
- * characters. how dumb. */
- if (tor_strpartition(partitioned, sizeof(partitioned), in, "\n", 64,
- ALWAYS_TERMINATE))
- return NULL;
- len = base64_decode(buf, sizeof(buf), partitioned, strlen(partitioned));
- if (len<0) {
- log_warn(LD_CRYPTO,"Error base-64 decoding key");
- return NULL;
- }
- return crypto_pk_asn1_decode(buf, len);
-}
-
/** Return true iff <b>env</b> has a valid key.
*/
int
diff --git a/src/common/crypto.h b/src/common/crypto.h
index df112a1d8..050849cfe 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -79,8 +79,6 @@ int crypto_pk_read_public_key_from_string(crypto_pk_env_t *env,
const char *src, size_t len);
int crypto_pk_write_private_key_to_filename(crypto_pk_env_t *env,
const char *fname);
-int crypto_pk_DER64_encode_public_key(crypto_pk_env_t *env, char **dest);
-crypto_pk_env_t *crypto_pk_DER64_decode_public_key(const char *in);
int crypto_pk_check_key(crypto_pk_env_t *env);
int crypto_pk_cmp_keys(crypto_pk_env_t *a, crypto_pk_env_t *b);