Thread: ssl sockets

  1. #1
    Registered User
    Join Date
    Apr 2003

    ssl sockets

    I have written a server and client using the openSSL api
    for security. And my problem comes when i want to verify the certificate
    at the client side.

          berr_exit("Certificate doesn't verify");
    This function verifies the the certificate, and the function returns
    with the error message showed.

    But I don't know why the certificate does'nt verify.

    On the server I use the certificate & private key that i created with
    the openssl command tool.

    the code for using the certifcate is:

    // set the locale certificate from cerfile
    if (SSL_CTX_use_certificate_file(ctx, certfile, SSL_FILETYPE_PEM) <= 0)
         fprintf(stderr, "error cert\n");
    // set the private key from keyfile
    if (SSL_CTX_use_PrivateKey_file(ctx, keyfile, SSL_FILETYPE_PEM) <= 0)
          fprintf(stderr, "error key\n");
    // verify private key
    if (!SSL_CTX_check_private_key(ctx))
        fprintf(stderr, "Private key does not math the public certificate\n");
    the certificate was created like this

    // private key
    openssl genrsa -des3 -out server.key 1024

    // csr
    openssl req -new -days 365 -key server.key -out server.csr

    // CA
    openssl genrsa -des3 -out ca.key 1024
    openssl req -new -x509 -days 365 -key ca.key -out ca.crt

    ./sign server.csr


    i dont know where the error can be.

    anyone have any ideas?
    Last edited by champ; 04-04-2003 at 06:36 AM.

  2. #2
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    try the server side, make sure they both have the same formats. see if you can isolate the exact area of the code it is on. Look for examples on the web similar to your code
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best way to poll sockets?
    By 39ster in forum Networking/Device Communication
    Replies: 3
    Last Post: 07-22-2008, 01:43 PM
  2. rewrite function for ssl compatibility
    By keeper in forum C++ Programming
    Replies: 1
    Last Post: 06-02-2006, 12:31 PM
  3. multiple UDP sockets with select()
    By nkhambal in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-17-2006, 07:36 PM
  4. SSL and 503 FTP Error :: Socket
    By kuphryn in forum Networking/Device Communication
    Replies: 2
    Last Post: 03-18-2005, 04:15 PM
  5. Starting window sockets
    By _Cl0wn_ in forum Windows Programming
    Replies: 2
    Last Post: 01-20-2003, 11:49 AM