diff options
author | Niels Möller <nisse@lysator.liu.se> | 2003-02-10 18:35:39 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2003-02-10 18:35:39 +0100 |
commit | 9724eaee82efba8b40b96ac963f460da10304626 (patch) | |
tree | 2d8e78e2513254f7d77f872fa6085c9972dee23f | |
parent | 2039f20afdd24a72e8b2b58e66196150855a8b4b (diff) | |
download | nettle-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.h | 1 | ||||
-rw-r--r-- | rsa2sexp.c | 8 |
2 files changed, 7 insertions, 2 deletions
@@ -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); @@ -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 */ |