How can I use IPWorks with a self-signed SSL certificate?

628 Views Asked by At

I am trying to find a way to use /n Software's IPWorks server/client components with a self-signed SSL certificate.

I am trying this on the client side:

cl.SSLCertStoreType := cstPFXFile;
cl.SSLCertStore := 'cert.pfx';
cl.SSLCertStorePassword := 'password';
cl.Connect('localhost',5050);

And this on the server side:

server.SSLCertStoreType :=  cstPFXFile;
server.SSLCertStore := 'cert.pfx';
server.SSLCertStorePassword := 'password';
server.LocalPort:= 5050;
server.SSLEnabled:=true;
server.Listening := true;

The PFX file is valid, but the app gives an error that it's not a valid certificate.

Does somebody have a working example ?

1

There are 1 best solutions below

0
On

As per this document on IPWorks site, the self-signed certificate can be generated using CertMgr class provided by same IPWorks library.

https://www.nsoftware.com/kb/xml/11080101.rst

To generate a certificate, simply call the CreateCertificate method of the CertMgr component included in IPWorks SSL. This method takes a subject and a serial number as arguments:

CertMgr1.CreateCertificate "CN=My Cert Subject", 0000001

Certmgr certMgr1 = new Certmgr();
certMgr1.RuntimeLicense = ""; //Assign your license, otherwise you'll get exception
certMgr1.CreateCertificate("CN=My Cert Subject", 000001);
//Use certMgr1.Cert property to use generated Self-signed certificate