if (x509 != NULL) EVP_PKEY_copy_parameters(X509_get_pubkey(x509), SSL_get_privatekey(ssl));
if (x509 != NULL) { EVP_PKEY *pktmp; pktmp = X509_get_pubkey(x509); EVP_PKEY_copy_parameters(pktmp, SSL_get_privatekey(ssl)); EVP_PKEY_free(pktmp); }
int set_cert_stuff(ctx, cert_file, key_file)SSL_CTX *ctx;char *cert_file;char *key_file;	{	if (cert_file != NULL)		{		/*		SSL *ssl;		X509 *x509;		*/		if (SSL_CTX_use_certificate_file(ctx,cert_file,			SSL_FILETYPE_PEM) <= 0)			{			BIO_printf(bio_err,"unable to get certificate from '%s'\n",cert_file);			ERR_print_errors(bio_err);			return(0);			}		if (key_file == NULL) key_file=cert_file;		if (SSL_CTX_use_PrivateKey_file(ctx,key_file,			SSL_FILETYPE_PEM) <= 0)			{			BIO_printf(bio_err,"unable to get private key from '%s'\n",key_file);			ERR_print_errors(bio_err);			return(0);			}		/*		In theory this is no longer needed 		ssl=SSL_new(ctx);		x509=SSL_get_certificate(ssl);		if (x509 != NULL)			EVP_PKEY_copy_parameters(X509_get_pubkey(x509),				SSL_get_privatekey(ssl));		SSL_free(ssl);		*/		/* If we are using DSA, we can copy the parameters from		 * the private key */						/* Now we know that a key and cert have been set against		 * the SSL context */		if (!SSL_CTX_check_private_key(ctx))			{			BIO_printf(bio_err,"Private key does not match the certificate public key\n");			return(0);			}		}	return(1);	}