Answer the question
In order to leave comments, you need to log in
How to sign an SSL request with a certificate from a remote resource?
Hello everyone
Task:
You need to make a request for a third-party resource. Upon request, you sign your request with a special pem certificate (it contains ssl and private key).
If I upload the certificate to my server and make a request like this, then everything goes fine. httpClient (this is Guzzle)
$response = $this->httpClient->send($request,
[
'cert' => '/var/www/api/container/src/cert.pem'
]
);
$response = $this->httpClient->send($request,
[
'cert' => file_get_contents('https://certs/cert.pem',)
]
);
Answer the question
In order to leave comments, you need to log in
There is a suspicion that the cert parameter/argument that you specify should take the path to the certificate, and you are passing it the contents of the certificate, and not the path. There are several solutions here:
1. Find an HTTP client (or a parameter on the current client) that allows you to specify the contents of the certificate
2. Download the certificate to the server, specify the path to it and delete the certificate after the request is completed (if necessary)
3 In the same
way , you can save it to the database, get it from there and save it temporarily with each request )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question