diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2012-02-29 11:21:27 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2012-02-29 11:21:27 +0000 |
commit | 3c69f1638452be94c3fa12f17c8a45f14f177d75 (patch) | |
tree | da4142a9652b0ad86f9c1734362b074bf0c51e7a /usr.bin/ssh | |
parent | 10e465cb1ade4861144231b3d3f71bf5001f80ea (diff) |
allow conversion of RSA1 keys to public PEM and PKCS8; "nice" markus@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index ad0c4afc8d4..e6cdeba7f94 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keygen.c,v 1.212 2011/10/16 15:02:41 jmc Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.213 2012/02/29 11:21:26 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -258,6 +258,10 @@ do_convert_to_ssh2(struct passwd *pw, Key *k) u_char *blob; char comment[61]; + if (k->type == KEY_RSA1) { + fprintf(stderr, "version 1 keys are not supported\n"); + exit(1); + } if (key_to_blob(k, &blob, &len) <= 0) { fprintf(stderr, "key_to_blob failed\n"); exit(1); @@ -281,6 +285,7 @@ static void do_convert_to_pkcs8(Key *k) { switch (key_type_plain(k->type)) { + case KEY_RSA1: case KEY_RSA: if (!PEM_write_RSA_PUBKEY(stdout, k->rsa)) fatal("PEM_write_RSA_PUBKEY failed"); @@ -303,6 +308,7 @@ static void do_convert_to_pem(Key *k) { switch (key_type_plain(k->type)) { + case KEY_RSA1: case KEY_RSA: if (!PEM_write_RSAPublicKey(stdout, k->rsa)) fatal("PEM_write_RSAPublicKey failed"); @@ -336,10 +342,6 @@ do_convert_to(struct passwd *pw) exit(1); } } - if (k->type == KEY_RSA1) { - fprintf(stderr, "version 1 keys are not supported\n"); - exit(1); - } switch (convert_format) { case FMT_RFC4716: |