Mercurial > dropbear
comparison dropbearconvert.c @ 836:d7d9f1612d51 ecc
writing out openssh ecc keys works
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 20 Oct 2013 21:06:18 +0800 |
parents | 71e7d31f7671 |
children | 220f55d540ae |
comparison
equal
deleted
inserted
replaced
807:75509065db53 | 836:d7d9f1612d51 |
---|---|
26 #include "includes.h" | 26 #include "includes.h" |
27 #include "signkey.h" | 27 #include "signkey.h" |
28 #include "buffer.h" | 28 #include "buffer.h" |
29 #include "dbutil.h" | 29 #include "dbutil.h" |
30 #include "keyimport.h" | 30 #include "keyimport.h" |
31 #include "crypto_desc.h" | |
32 #include "random.h" | |
31 | 33 |
32 | 34 |
33 static int do_convert(int intype, const char* infile, int outtype, | 35 static int do_convert(int intype, const char* infile, int outtype, |
34 const char* outfile); | 36 const char* outfile); |
35 | 37 |
112 | 114 |
113 static int do_convert(int intype, const char* infile, int outtype, | 115 static int do_convert(int intype, const char* infile, int outtype, |
114 const char* outfile) { | 116 const char* outfile) { |
115 | 117 |
116 sign_key * key = NULL; | 118 sign_key * key = NULL; |
117 char * keytype = NULL; | 119 const char * keytype = NULL; |
118 int ret = 1; | 120 int ret = 1; |
119 | 121 |
120 key = import_read(infile, NULL, intype); | 122 key = import_read(infile, NULL, intype); |
121 if (!key) { | 123 if (!key) { |
122 fprintf(stderr, "Error reading key from '%s'\n", | 124 fprintf(stderr, "Error reading key from '%s'\n", |
123 infile); | 125 infile); |
124 goto out; | 126 goto out; |
125 } | 127 } |
126 | 128 |
127 #ifdef DROPBEAR_RSA | 129 keytype = signkey_name_from_type(key->type, NULL); |
128 if (key->rsakey != NULL) { | |
129 keytype = "RSA"; | |
130 } | |
131 #endif | |
132 #ifdef DROPBEAR_DSS | |
133 if (key->dsskey != NULL) { | |
134 keytype = "DSS"; | |
135 } | |
136 #endif | |
137 | 130 |
138 fprintf(stderr, "Key is a %s key\n", keytype); | 131 fprintf(stderr, "Key is a %s key\n", keytype); |
139 | 132 |
140 if (import_write(outfile, key, NULL, outtype) != 1) { | 133 if (import_write(outfile, key, NULL, outtype) != 1) { |
141 fprintf(stderr, "Error writing key to '%s'\n", outfile); | 134 fprintf(stderr, "Error writing key to '%s'\n", outfile); |