Redirect to https server in php - php

I am trying to redirect to a server that does Client authentication and establishes an https connection in php. I am using the following command:
header('Location:https://example.com');
But I cannot figure out how to send the client certificate in this redirect. without sending the certificate I cannot connect with the server. How can I attach the client certificate in the redirect?

But I cannot figure out how to send the client certificate in this redirect.
You do not. Certificate are send by httpd much earlier (this phase of the protocol is called "handshake") than client and server start talking about dealing with your scripts (see: How HTTPS actually works). You must set up correctly your httpd, install certificate and private key and perhaps certificate authority of certificate issuer (or your own CA if you are playing with self signed certs). There're lot of posts on the net about doing that, so google.

Related

LDAP configuration with PHP + IIS

I am working on some 3rd party integration project.
Created RootCA and SubCA from their official documentation website and after importing in windows server, we created key using openssl and got signed certificate from 3rd party integration Support team
We have configured in ldp.exe client and it got connected and fetched the dataset.
Now we are implementing in PHP code level.
We have:
IIS server 10
PHP 7.2
PHP Code is working in IIS
Added ldap.conf file created c:/openldap/sysconf/ldap.conf
TLS_REQCERT allow
#TLS_CACERT c:\openldap\sysconf\RootCaSha1.der
TLS_CACERT c:\openldap\sysconf\SubCaSha1.der
#TLS_CACERTDIR c:\openldap\sysconf
We have tried various paths and noted all evidence via wireshark tool
It says TLSv1.2 Alert (Level: Fatal, Description: Handshake Failure) so it means some certificate in ldap.conf are not as per requirement.
Looking forward to help in this regard so we can get connect.
Thanks in advance
As far as I know, the TLS handshake failure error commonly occurred when the server’s certificate is configured improperly. this should be configured on the IIS server-side. Please check the below items.
The account running the website is supposed to own the right of accessing the private key of the certificate. Firstly import the certificate to the Local machine Certification Store, under the property page of the certificate, grant the account access to the private key of the certificate.
Subsequently, we specify the certificate in the IIS site binding module.
Besides, Please note that the communication between the client-side and the server-side is established based on the fact that the client trusts the server certificate. this means that when we visit the website, the browser address bar has the sign of security lock. In this way, the public key of the certificate can be exchanged. The specific operation is to add the server root certificate to the Trusted Root Certificate Authority certification store of the client-side.

Force user to install SSL certificate using php

Using this page: Wamp2 and "The ordinal 942 could not be located in the dynamic link library LIBEAY.dll"
I was able to setup SSL on my wamp. It works nice, especially after I provide the server certificate (server.crt) to an user. If not, they will have an "certificate not trusted" error. It is possible to reject those who are not using SSL certificate?
Thank you!
If the client displays a "server certificate is not trusted" message, that's because the server certificate you have installed is not signed by any authority the client knows about. Likely you're using a self-signed certificate. When you add this certificate to the trusted certificate store on your client, the client now trusts this certificate and does not display the warning anymore. It's not that "the client uses a certificate", it's that the client doesn't complain about the server's certificate.
You have no influence over this process at all. The server offers its certificate, and the client trusts it or doesn't. The server doesn't know this. If the client continues its conversation with the server, that pretty much implies that it trusts the offered certificate. Whether that is because the user approved it manually or because the client trusts the certificate otherwise, the server doesn't know.
There's also the concept of client certificates, in which a client identifies itself to the server using a certificate. This is badly supported in todays client software though and probably not what you're looking for.

PHPStorm 7 REST Client allow self signed certificates

I'm using PHPStorm 7 to create a RESTful API. I wanted to use the built in REST Client but need to be able to tell it to allow untrusted SSL Certificates. I am using a self signed certificate on my test server.
At the moment when I send my request I get this response.
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
Is there an option I can change to ignore this?
I would recommend creating your own Certificate Authority (CA) and generate certificates for your server(s) signed by it.
You then have to add the CA public certificate to your local machine (probably into the Java store, and into Internet Explorer settings (if you're using Windows that is)).
Creating Your Own SSL Certificate Authority (and Dumping Self Signed Certs)
Custom SSL Certificate Authority?

Need SSL Cert for connecting to secure web service

I'm new to using SSL Certs and am having trouble getting help from the Service Provider I'm connecting to. I'm using PHP on the backend to handle the connection.
The setup is as follows:
User enters details into form, ajax sends the details back to Our server
Our server then connects using curl to 3rd party service sending away data in XML format
The 3rd party server replies with the data
Our server responds to the browser
Now the problem I'm having is figuring out who has to do the SSL cert, they are saying that I need to buy and install an SSL cert to connect to their server but I thought that it was the server receiving the connection that needs to handle SSL? If I brought an SSL cert wouldn't that only allow me to setup a secure connection between our server and the client's browser?
Please help before I lose my mind!
Thanks
Mark
You need to secure the Ajax connection between the browser and your server with a SSL connection if you are transferring sensitive data.
Edit: Sorry, I only answered your second question. The SSL certificate is configured by the entity whose server is being secured, so no you would not purchase a certificate to secure the call to THEIR server (Steps 2 & 3). But your Ajax call is totally on your end between your client's browser and your server, so you'd need one for Steps 1 & 4.

Testing if a client certificat is installed in the client browser

I was wondering if any of you know if it is possible in javascript or php to test if a client has a specific client certificate installed in the browser.
The thing is that we have a server certificate installed but to be recognized by the clients, they need 2 client certificates that make them recognize the authority of the issuer of our server certificate. We would like to test the browser for these 2 certificates, if there are not there, we want to propose the client to download them before to enter in https mode...
Anybody can help? Please detail your answer if you know one.
You can do it client side by using javascript to request a known file from a secured (https) source. if the request fails then it means the client refused to accept your certificate (or another network error) at this point you could popup a message to ask the user to install the root certificate with a link to the root certificate.
This must be done from a non secure page. otherwise the user may refuse your certificate and never load the page to start with and therefore your javascript never runs
It can't be done in PHP because php (which is server side) cannot determine whether the client browser has a particular root ca installed
I however would not do this. get a proper certificate instead.
You appear to have insufficient understanding of how SSL works in general. I suggest spending some time understanding how SSL works and how certificates are used.
DC
to learn about sending and receiving http responses with javascript read this page..
http://www.w3schools.com/XML/xml_http.asp
It can be used to send and receive any text data, not just xml. It is real easy to implement but you must be aware of browser version issues.
DC
what about a warning message that will be hidden by a javascript which will be loaded from your https site.
in the warning message you can link the windows update site or wherever the updated root certifcates can be downloaded to their browser.
PHP is a server side language. If you really want to test this then you need to do it with JavaScript and then send back an AJAX request to PHP.
But I think there is another solution to your problem. Normally when a CA change their name etc. they have usually new "Intermediate Certificates" you can use. (If you have an apache httpd server then you can search for "ca bundle" on their website as well.) With this bundle you can send the new CA certificate along with your certificate.
Forcing your users to download and install a homegrown CA certificate is ugly and hateful. Instead, show them the love and pay the $30 US to get an SSL certificate signed by a reputable, already trusted, CA.

Categories