Commit 07b19fdf authored by Niels Möller's avatar Niels Möller
Browse files

* src/spki_commands.c (parse_private_key): Generate keypairs with

algorithms ATOM_SSH_RSA, ATOM_SPKI_SIGN_RSA and ATOM_SPKI_SIGN_DSS.

Rev: src/spki_commands.c:1.17
parent 38f96179
...@@ -187,6 +187,8 @@ parse_private_key(struct alist *algorithms, ...@@ -187,6 +187,8 @@ parse_private_key(struct alist *algorithms,
struct sexp *expr = SEXP_GET(i); struct sexp *expr = SEXP_GET(i);
int algorithm_name; int algorithm_name;
struct signer *s; struct signer *s;
struct verifier *v;
struct lsh_string *spki_public;
if (!expr) if (!expr)
{ {
...@@ -204,22 +206,43 @@ parse_private_key(struct alist *algorithms, ...@@ -204,22 +206,43 @@ parse_private_key(struct alist *algorithms,
} }
v = SIGNER_GET_VERIFIER(s);
spki_public = sexp_format(spki_make_public_key(SIGNER_GET_VERIFIER(s)),
SEXP_CANONICAL, 0);
/* Test key here? */ /* Test key here? */
switch (algorithm_name) switch (algorithm_name)
{ {
case ATOM_DSA: case ATOM_DSA:
COMMAND_RETURN(c, make_keypair(ATOM_SSH_DSS, COMMAND_RETURN(c, make_keypair(ATOM_SSH_DSS,
PUBLIC_KEY(SIGNER_GET_VERIFIER(s)), PUBLIC_KEY(v),
s));
COMMAND_RETURN(c, make_keypair(ATOM_SPKI_SIGN_DSS,
spki_public, s));
break;
case ATOM_RSA_PKCS1_SHA1:
COMMAND_RETURN(c, make_keypair(ATOM_SSH_RSA,
PUBLIC_KEY(v),
s)); s));
/* Fall through */ /* Fall through */
case ATOM_RSA_PKCS1_MD5:
COMMAND_RETURN(c, make_keypair(ATOM_SPKI_SIGN_RSA,
spki_public, s));
break;
default: default:
abort();
#if 0
/* Get a corresponding public key. */ /* Get a corresponding public key. */
COMMAND_RETURN(c, make_keypair COMMAND_RETURN(c, make_keypair
(ATOM_SPKI, (ATOM_SPKI,
sexp_format(spki_make_public_key(SIGNER_GET_VERIFIER(s)), sexp_format(spki_make_public_key(SIGNER_GET_VERIFIER(s)),
SEXP_CANONICAL, 0), SEXP_CANONICAL, 0),
s)); s));
#endif
break; break;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment