version 1.49, 2002/09/09 14:54:14 |
version 1.49.2.2, 2003/09/16 21:20:26 |
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "key.h" |
#include "key.h" |
#include "rsa.h" |
#include "rsa.h" |
#include "ssh-dss.h" |
|
#include "ssh-rsa.h" |
|
#include "uuencode.h" |
#include "uuencode.h" |
#include "buffer.h" |
#include "buffer.h" |
#include "bufaux.h" |
#include "bufaux.h" |
|
|
return 0; |
return 0; |
} |
} |
|
|
static u_char * |
u_char* |
key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length) |
key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length) |
{ |
{ |
const EVP_MD *md = NULL; |
const EVP_MD *md = NULL; |
|
|
for (i = 0; i < dgst_raw_len; i++) { |
for (i = 0; i < dgst_raw_len; i++) { |
char hex[4]; |
char hex[4]; |
snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]); |
snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]); |
strlcat(retval, hex, dgst_raw_len * 3); |
strlcat(retval, hex, dgst_raw_len * 3 + 1); |
} |
} |
|
|
|
/* Remove the trailing ':' character */ |
retval[(dgst_raw_len * 3) - 1] = '\0'; |
retval[(dgst_raw_len * 3) - 1] = '\0'; |
return retval; |
return retval; |
} |
} |
|
|
case KEY_DSA: |
case KEY_DSA: |
space = strchr(cp, ' '); |
space = strchr(cp, ' '); |
if (space == NULL) { |
if (space == NULL) { |
debug3("key_read: no space"); |
debug3("key_read: missing whitespace"); |
return -1; |
return -1; |
} |
} |
*space = '\0'; |
*space = '\0'; |
type = key_type_from_name(cp); |
type = key_type_from_name(cp); |
*space = ' '; |
*space = ' '; |
if (type == KEY_UNSPEC) { |
if (type == KEY_UNSPEC) { |
debug3("key_read: no key found"); |
debug3("key_read: missing keytype"); |
return -1; |
return -1; |
} |
} |
cp = space+1; |
cp = space+1; |
|
|
xfree(blob); |
xfree(blob); |
return -1; |
return -1; |
} |
} |
k = key_from_blob(blob, n); |
k = key_from_blob(blob, (u_int)n); |
xfree(blob); |
xfree(blob); |
if (k == NULL) { |
if (k == NULL) { |
error("key_read: key_from_blob %s failed", cp); |
error("key_read: key_from_blob %s failed", cp); |
|
|
} |
} |
|
|
Key * |
Key * |
key_from_blob(u_char *blob, int blen) |
key_from_blob(u_char *blob, u_int blen) |
{ |
{ |
Buffer b; |
Buffer b; |
char *ktype; |
char *ktype; |