OpenSSL and [commercial] SSH
I'm doing something with a lot of machines that requires each to have a public/private key pair. Now, it makes sense just to reuse the existing DSA key pairs that our (commercial, and this isn't something I can change, if it matters) SSH setup uses. They're of the form:---- BEGIN SSH2 PUBLIC KEY ----
(more nonsensical but printable lines)
---- END SSH2 PUBLIC KEY ----
Internally, OpenSSL's libcrypto uses a DSA structure with several BIGNUM members corresponding to various numerical features of the key. This would be fine (well, more ok) if the keys were stored as a sequence of numbers (which I realize they are on some systems), but this isn't the case here.
Now, I could
run ssh-keygen -i on the file, read in the values, assign them to the BIGINT members, and create the DSA structure manually... but there has to be an easier way than that, especially because I'm doing this in relatively low level C (to avoid unnecessary library dependencies). OpenSSL's libcrypto functions are often very poorly documented, and I haven't gotten any good results with the manual openssl command to point me in the right direction.
So... does anybody have any experience with this? Or at least any pointers in the right direction? Looking through dsa.h hasn't yielded any inspiration as of yet.Update:
it has been brought to my attention that the text is uuencoded. However, what to do with the uudecoded data still eludes me. The DSA structures themselves contain pointers, so simply reading it into a buffer and typecasting it doesn't seem like it would work.