[Cryptography Team] Reading ssh pub/private keys

Robert Withers reefedjib at yahoo.com
Thu Mar 29 13:33:11 UTC 2007


Bert, there are indeed Base64 encoded.  For starters, you can try:

	(DSAPrivateKeyFileReader fromFile: privateKeyFileName) asPrivateKey

I am not sure about the publicKey, but you could try the same reader  
code.  Internally, it strips off the PEM markings (-----BEGIN  
DSA...and so on), the does a Base64 decode and leaves you with  
bytes.  The #asPrivateKey will take those bytes and do an ASN.1  
decode on them.  My point is that the PublicKey may also be ASN.1  
encoded, so you may find some traction here.

Let me know how it goes.

Are you implementing SSH?!

cheers,
Robert

On Mar 29, 2007, at 6:23 AM, Bert Freudenberg wrote:

> Hi folks,
>
> I have an ssh-format keypair and would like to extract the  
> (p,q,g,x) and (p,q,g,y) DSA tuples from that. The private key looks  
> like this:
>
> -----BEGIN DSA PRIVATE KEY-----
> MIIBuwIB..............XCIa3cIp
> -----END DSA PRIVATE KEY-----
>
> and the public key:
>
> ssh-dss AAAAB3NzaC1k.........nNEnWCasjXraVA==
>
> So this looks like Base64-encoded numbers, but how are they  
> encoded? The only reference I found was this:
>
> http://www.openssh.com/txt/draft-ietf-secsh-publickeyfile-02.txt
>
> But it does not detail how the "binary blob" translates to DSA tuples.
>
> - Bert -
>
>
> _______________________________________________
> Cryptography mailing list
> Cryptography at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/ 
> cryptography



More information about the Cryptography mailing list