summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2003-02-10 18:35:39 +0100
committerNiels Möller <nisse@lysator.liu.se>2003-02-10 18:35:39 +0100
commit9724eaee82efba8b40b96ac963f460da10304626 (patch)
tree2d8e78e2513254f7d77f872fa6085c9972dee23f
parent2039f20afdd24a72e8b2b58e66196150855a8b4b (diff)
downloadnettle-9724eaee82efba8b40b96ac963f460da10304626.tar.gz
* rsa2sexp.c (rsa_keypair_to_sexp): New argument ALGORITHM_NAME.
* rsa2sexp.c (rsa_keypair_to_sexp): Use literals with sexp_format. Rev: src/nettle/rsa.h:1.21 Rev: src/nettle/rsa2sexp.c:1.6
-rw-r--r--rsa.h1
-rw-r--r--rsa2sexp.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/rsa.h b/rsa.h
index 14a4c44b..dd500557 100644
--- a/rsa.h
+++ b/rsa.h
@@ -235,6 +235,7 @@ struct nettle_buffer;
/* Generates a public-key expression if PRIV is NULL .*/
int
rsa_keypair_to_sexp(struct nettle_buffer *buffer,
+ const char *algorithm_name, /* NULL means "rsa" */
const struct rsa_public_key *pub,
const struct rsa_private_key *priv);
diff --git a/rsa2sexp.c b/rsa2sexp.c
index 8957570d..75f5645c 100644
--- a/rsa2sexp.c
+++ b/rsa2sexp.c
@@ -34,19 +34,23 @@
int
rsa_keypair_to_sexp(struct nettle_buffer *buffer,
+ const char *algorithm_name,
const struct rsa_public_key *pub,
const struct rsa_private_key *priv)
{
+ if (!algorithm_name)
+ algorithm_name = "rsa";
+
if (priv)
return sexp_format(buffer,
"(private-key(%0s(n%b)(e%b)"
"(d%b)(p%b)(q%b)(a%b)(b%b)(c%b)))",
- "rsa", pub->n, pub->e,
+ algorithm_name, pub->n, pub->e,
priv->d, priv->p, priv->q,
priv->a, priv->b, priv->c);
else
return sexp_format(buffer, "(public-key(%0s(n%b)(e%b)))",
- "rsa", pub->n, pub->e);
+ algorithm_name, pub->n, pub->e);
}
#endif /* WITH_PUBLIC_KEY */