comparison keyimport.c @ 793:70625eed40c9 ecc

A bit of work on ecdsa for host/auth keys
author Matt Johnston <matt@ucc.asn.au>
date Sun, 14 Apr 2013 00:50:03 +0800
parents 9dbc0c443497
children 71e7d31f7671
comparison
equal deleted inserted replaced
768:6e6ce39da2fc 793:70625eed40c9
347 347
348 /* ---------------------------------------------------------------------- 348 /* ----------------------------------------------------------------------
349 * Code to read and write OpenSSH private keys. 349 * Code to read and write OpenSSH private keys.
350 */ 350 */
351 351
352 enum { OSSH_DSA, OSSH_RSA }; 352 enum { OSSH_DSA, OSSH_RSA, OSSH_EC };
353 struct openssh_key { 353 struct openssh_key {
354 int type; 354 int type;
355 int encrypted; 355 int encrypted;
356 char iv[32]; 356 char iv[32];
357 unsigned char *keyblob; 357 unsigned char *keyblob;
390 } 390 }
391 if (!strcmp(buffer, "-----BEGIN RSA PRIVATE KEY-----\n")) 391 if (!strcmp(buffer, "-----BEGIN RSA PRIVATE KEY-----\n"))
392 ret->type = OSSH_RSA; 392 ret->type = OSSH_RSA;
393 else if (!strcmp(buffer, "-----BEGIN DSA PRIVATE KEY-----\n")) 393 else if (!strcmp(buffer, "-----BEGIN DSA PRIVATE KEY-----\n"))
394 ret->type = OSSH_DSA; 394 ret->type = OSSH_DSA;
395 else if (!strcmp(buffer, "-----BEGIN EC PRIVATE KEY-----\n"))
396 ret->type = OSSH_EC;
395 else { 397 else {
396 errmsg = "Unrecognised key type"; 398 errmsg = "Unrecognised key type";
397 goto error; 399 goto error;
398 } 400 }
399 401