static int do_convert(int intype, const char* infile, int outtype, const char* outfile) { sign_key * key = NULL; const char * keytype = NULL; int ret = 1; key = import_read(infile, NULL, intype); if (!key) { fprintf(stderr, "Error reading key from '%s'\n", infile); goto out; } keytype = signkey_name_from_type(key->type, NULL); fprintf(stderr, "Key is a %s key\n", keytype); if (import_write(outfile, key, NULL, outtype) != 1) { fprintf(stderr, "Error writing key to '%s'\n", outfile); } else { fprintf(stderr, "Wrote key to '%s'\n", outfile); ret = 0; } out: if (key) { sign_key_free(key); } return ret; }
static int do_convert(int intype, const char* infile, int outtype, const char* outfile) { sign_key * key = NULL; char * keytype = NULL; int ret = 1; key = import_read(infile, NULL, intype); if (!key) { fprintf(stderr, "Error reading key from '%s'\n", infile); goto out; } #ifdef DROPBEAR_RSA if (key->rsakey != NULL) { keytype = "RSA"; } #endif #ifdef DROPBEAR_DSS if (key->dsskey != NULL) { keytype = "DSS"; } #endif fprintf(stderr, "Key is a %s key\n", keytype); if (import_write(outfile, key, NULL, outtype) != 1) { fprintf(stderr, "Error writing key to '%s'\n", outfile); } else { fprintf(stderr, "Wrote key to '%s'\n", outfile); ret = 0; } out: if (key) { sign_key_free(key); } return ret; }