(Using Delphi Rio)
I was provided a certificate in pfx format, which I converted it to pem with:
openssl pkcs12 -in certfile.pfx -out certfile.pem
I dropped a TScFileStorage on a form, set the Path, and double clicked to get to editor.
In "Certificates" I created a new "cert1" entry, and did an "Import Key From" certfile.pem.
I then Exported public key to certfile.pub.
I went to Keys tab and did an Import From certfile.pub to "key1".
I dropped a TScHttpWebRequest on the form, and set:
- SSLOptions.Storage to ScFileStorage1,
- SSLOptions.ClientCertificateName to key1.key
- RequestURI to https://some_long_domain:443/some_resource
- Method to rmPOST
- ReadWriteTimeout to 100
- ContentType to application/xml
Based on a few postings here, I tried:
Code: Select all
procedure TfrmTestQA.btn1Click(Sender: TObject); var Response: TScHttpWebResponse; ResponseStr: string; buf: TBytes; s856xml: string; begin s856xml :=Get856Info(se1.AsInteger); // returns xml packet buf := TEncoding.UTF8.GetBytes(s856xml); ScHttpWebRequest1.ContentLength := Length(buf); ScHttpWebRequest1.WriteBuffer(buf); Response:=ScHttpWebRequest1.GetResponse; ResponseStr:=Response.ReadAsString; end;
With version 9.1 I'm getting "The CRL is not valid".
I'm not sure that the steps I've taken to populate the FileStorage are correct, and I'm ever more clueless on how to apply the cert/key data to the ScHttpWebRequest.
Can I please get clarification?