[Developers] Patch so SSHKeyChain will load V1 keys

Steve Hill sshkeychain at cheesy.sackheads.org
Thu Mar 1 20:11:59 CET 2007


I originally sent this just to bart, but didn't hear anything back.  
Re-posting here, in case anyone else finds it useful.

Steve

Begin forwarded message:

> From: Steve Hill <cheesy at sackheads.org>
> Date: February 15, 2007 12:14:00 PM EST
> To: bart at sshkeychain.org
> Subject: SSHKeyChain head won't load V1 keys
>
> Hey,
>
> On my Tiger MBP, SSHKeyChain won't load a V1 ssh key; It says it's  
> not a valid private key. It's because the private key file doesn't  
> contain valid UTF-8 data. The following trivial patch solves the  
> problem:
>
> --- trunk/Libs/SSHKey.m (revision 95)
> +++ trunk/Libs/SSHKey.m (working copy)
> @@ -14,7 +14,7 @@
> {
>         /* Read the file and determine what type we're working  
> with. */
>         NSFileHandle *handle = [NSFileHandle  
> fileHandleForReadingAtPath:thePath];
> -       NSArray *lines = [[[[NSString alloc] initWithData:[handle  
> availableData] encoding:NSUTF8StringEncoding] autorelease]  
> componentsSeparatedByString:@"\n"];
> +       NSArray *lines = [[[[NSString alloc] initWithData:[handle  
> availableData] encoding:NSASCIIStringEncoding] autorelease]  
> componentsSeparatedByString:@"\n"];
>         if ([[lines objectAtIndex:0] isEqualToString:@"SSH PRIVATE  
> KEY FILE FORMAT 1.1"])
>                 return SSH_KEYTYPE_RSA1;
>
> Thanks,
> Steve


More information about the developers mailing list