Hello, 
> Hello Everybody!
>  
> I got my server and client running. I want to do some testing and need
> some information about the ssl handshake... whitch mechanism is used
> and if diffie-hellman is used what size of the primary secret is used?
>  
> I was able to get information about the cipher with
> SSL_get_cipher_version() and SSL_get_cipher_name() for a established
> connection but I couldn't figure out to get the information about the
> handshake.
Peer RSA/DSA parameters used in handshake may be printed
for example with code:

EVP_PKEY *pkey;
X509 *cert;

cert = SSL_get_peer_certificate(ssl);

if ((cert != NULL) && ((pkey = X509_get_pubkey(cert)) != NULL)) {
   if (pkey->type == EVP_PKEY_RSA && pkey->pkey.rsa != NULL 
   && pkey->pkey.rsa->n != NULL) {
      printf("RSA-%d\n", BN_num_bits(pkey->pkey.rsa->n));
   }
   if (pkey->type == EVP_PKEY_DSA && pkey->pkey.dsa != NULL
   && pkey->pkey.dsa->p != NULL) {
      printf("DSA-%d\n", BN_num_bits(pkey->pkey.dsa->p));
   }
}

if (cert != NULL) {
   X509_free(cert);
}

Best regards,
-- 
Marek Marcola <[EMAIL PROTECTED]>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to