views:

103

answers:

2

Hello, guys,

I have to write these codes in c. I have already generate the certificate of one terminate t1: t1.pem, which is generated by openssl. The communication between the terminates t1 and t2 has been established via socket in c.

Now I want to send this certificate to another terminate t2.and I want t2 to receive the certificate, verify it and answer with an acceptance to t1. When t1 get this acceptance, it will the rest of stuffs..

But I don't know how to do these things.

For example, I transmit t1.pem as a string? But in t2 side, how can I do to verify? I know there are functions in openssl to do so, but I'm not so clear about it. At last, normally, the acceptance should be like how?

@[email protected] lot of questions here.. sorry...if someone could give me some guide.. Thanks a lot in advance!

A: 

If you are trying to establish communication using openssl have a look at this OpenSSL tutorial.

stefanB
A: 

here's some starting notes for you ...

server
{
    SSL_CTX_new()
    SSL_CTX_* set_cipher_list,set_mode,set_options
    SSL_CTX_* set_default_passwd_cb,use_certificate_file,use_PrivateKey_file etc

    SSL_new()
    SSL_set_fd(,socket)    
    SSL_set_accept_state()

    SSL_read()/SSL_write()

    SSL_shutdown()        
    SSL_free()

    SSL_CTX_free()
}

client
{
    SSL_CTX_new()
    SSL_CTX_* set_cipher_list,set_mode,options
    SSL_CTX_* load_verify_locations,set_verify etc

    SSL_new()
    SSL_set_fd(,socket)
    SSL_set_connect_state()

    SSL_read()/SSL_write()

    SSL_shutdown()
    SSL_free()

    SSL_CTX_free()
}
steelbytes