*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.96 2002/03/21 21:54:34 rees Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.98 2002/03/27 22:21:45 markus Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
{
Key *k;
int blen;
+ u_int len;
char line[1024], *p;
u_char blob[8096];
char encoded[8096];
*p = '\0';
strlcat(encoded, line, sizeof(encoded));
}
+ len = strlen(encoded);
+ if (((len % 4) == 3) &&
+ (encoded[len-1] == '=') &&
+ (encoded[len-2] == '=') &&
+ (encoded[len-3] == '='))
+ encoded[len-3] = '\0';
blen = uudecode(encoded, blob, sizeof(blob));
if (blen < 0) {
fprintf(stderr, "uudecode failed.\n");
static void
do_download(struct passwd *pw, const char *sc_reader_id)
{
- Key *pub = NULL;
+ Key **keys = NULL;
+ int i;
- pub = sc_get_key(sc_reader_id, NULL);
- if (pub == NULL)
+ keys = sc_get_keys(sc_reader_id, NULL);
+ if (keys == NULL)
fatal("cannot read public key from smartcard");
- key_write(pub, stdout);
- key_free(pub);
- fprintf(stdout, "\n");
+ for (i = 0; keys[i]; i++) {
+ key_write(keys[i], stdout);
+ key_free(keys[i]);
+ fprintf(stdout, "\n");
+ }
+ xfree(keys);
exit(0);
}
#endif /* SMARTCARD */