Skip Menu |

This queue is for tickets about the Crypt-DSA CPAN distribution.

Report information
The Basics
Id: 54485
Status: new
Priority: 0/
Queue: Crypt-DSA

People
Owner: Nobody in particular
Requestors: fbicknel [...] nc.rr.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.16
Fixed in: (no value)



Subject: ::SSH2 can't read ssh-keygen private key
I'm new to Crypt::DSA::Key::SSH2, so I may be off base. My ssh-keygen creates a key that looks like: Show quoted text
-----BEGIN DSA PRIVATE KEY----- <the key> -----END DSA PRIVATE KEY----- But the deserialize method of ::SSH2 says: 19: chomp($param{Content}); 20: my($head, $object, $content, $tail) = $param{Content} =~ 21 m:(---- BEGIN ([^\n\-]+) ----)\n(.+)(---- END .*? ----)$:s; Clearly that space before BEGIN and END cause problems. Would it be more general to change this re to something like: m:(----*?\s*BEGIN ([^\n\-]+)\s*----*)\n(.+?)(-+\s*END.*?----)$:s As a test, I tried this. The first was real data (my key removed), the second was, well, you'll see. But I tried to make the second so it looked like what the original re was supposed to match. DB<78> x $param{Content} 0 '-----BEGIN DSA PRIVATE KEY----- key goes here -----END DSA PRIVATE KEY-----' DB<79> x $foo 0 '---- BEGIN FOO PRIVATE KEY ---- foo here more foo here ---- END FOO PRIVATE KEY ----' DB<80> x ($head, $object, $content, $tail) = $param{Content} =~m:(----*?\s*BEGIN ([^\n\-]+)\s*----*)\n(.+?)(-+\s*END.*?----)$:s 0 '-----BEGIN DSA PRIVATE KEY-----' 1 'DSA PRIVATE KEY' 2 'key goes here ' 3 '-----END DSA PRIVATE KEY-----' DB<81> x ($head, $object, $content, $tail) = $foo =~m:(----*?\s*BEGIN ([^\n\-]+)\s*----*)\n(.+?)(-+\s*END.*?----)$:s 0 '---- BEGIN FOO PRIVATE KEY ----' 1 'FOO PRIVATE KEY ' 2 'foo here more foo here ' 3 '---- END FOO PRIVATE KEY ----' DB<82>
From: fbicknel [...] nc.rr.com
Hm. I might be misusing the module. Seems when you get to the next step, it does the decode_base64 on the key, then looks for a magic number. The one I get is 813826491, the one it wants is 1064303083. Something else is wrong - probably with the space between the keyboard and chair? :)