Loading keys in SSH2

Richard judicator3 at gmail.com
Tue Mar 29 15:12:17 EST 2005


Hello,

I am going through the source of openssh-3.9p1 and I have a quick
question on how the sshd
daemon loads the host keys. In the default configuration of SSH2
protocol, the private DSA hostkey is found in the file
'ssh_host_dsa_key' and the public DSA hostkey counterpart in
'ssh_host_dsa_key.pub'. Likewise, the private and public RSA hostkeys
are found in 'ssh_host_rsa_key' and 'ssh_host_rsa_key.pub'
respectively.

Now I am tracing through the sshd.c file and I am interested about how
the SSH2 protocol loads the host keys. Below I drew a rough call graph
as [fileName]functionName

[sshd.c]main() 
        |
       \/
[authfile.c]key_load_private()
        |
       \/
[authfile.c]key_load_private_pem()
        |
       \/
[in openssl library]PEM_read_PrivateKey()

I am a bit confused about the call to the function PEM_read_PrivateKey()
Below is the call to PEM_read_PrivateKey() on line 463 of authfile.c
=========================================================
pk = PEM_read_PrivateKey(fp, NULL, NULL, (char *)passphrase);
=========================================================

Does the function PEM_read_PrivateKey() returns something that
contains data about BOTH the public and private parts of the
assymetric DSA or RSA key ?

Thanks
Richard




More information about the openssh-unix-dev mailing list