You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Golang Nuts
Is there a simple/standard way to serialize/deserialize these keys, or do you have to roll your own?
There is the encoding/pem package, but it wants a byte slice, so even then I'd have to do some shenanigans to turn any one of those keys into a byte slice. Then of course you need to go the other way. In the case of ecdsa, you really just have the 3 big.Int values, since the curve you just grab from the package. In dsa, you have 5 big.Int values in total, and with rsa, 3 big.Int values and the Primes slice.
Am I just missing something? `ssh-keygen -t dsa` gives me a nice looking output in my ~/.ssh folder, which seems like it should be my target, but it's just base64 encoded "stuff" and I don't know what that stuff is supposed to be.
- Daniel
Daniel Huckstep
unread,
Aug 11, 2012, 8:29:10 PM8/11/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Oh look there's a DSA manpage... From here I can see asn1/pem will get me dealing with DSA keys.
- Daniel
Jonathan Pittman
unread,
Aug 11, 2012, 8:52:24 PM8/11/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Daniel Huckstep, golan...@googlegroups.com
You can also take a look at the files in go.crypto/ssh.
The basic of it is that you need to decode the base64 encoded form into a []byte using something like base64.StdEncoding.Decode or base64.StdEncoding.DecodeString. Then the resulting bytes are more easily picked apart into their respective pieces of the key. The encoding/pem package parses the header and footer and does the base64 encode/decode (for private keys) for you in the respective functions. So, that is definitely a good starting point.