Recent

Author Topic: Indy e https certificate  (Read 620 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 1751
Indy e https certificate
« on: November 06, 2018, 03:20:17 pm »
Hi guys, I'm trying to create an https server with indy and lazarus and I've found some code for testing. But I clash with the first obstacle, I never created a self-signed https certificate. If you look at the piece of code below you will see that there are 3 files to go to the indy component. How can I generate them with openssl?
Thank you
Code: Pascal  [Select]
  1.   rootdir:='cert' + System.DirectorySeparator ;
  2.   ServerSSLIOHandler:=TIdServerIOHandlerSSLOpenSSL.Create(nil);
  3.   ServerSSLIOhandler.SSLOptions.RootCertFile:=rootdir+'ca.cert.pem';
  4.   ServerSSLIOhandler.SSLOptions.CertFile:=rootdir+'localhost.cert.pem';
  5.   ServerSSLIOhandler.SSLOptions.KeyFile:=rootdir+'localhost.key.pem';
  6.   ServerSSLIOhandler.SSLOptions.Method:=sslvSSLv23;
  7.   ServerSSLIOhandler.SSLOptions.Mode:=sslmServer;
  8.   ServerSSLIOhandler.OnGetPassword:=NIL;
  9.   ServerSSLIOhandler.OnVerifyPeer:=OnVerifyPeer;    
  10.  
Ubuntu and Mac
Lazarus: 1.8.0
FPC: 3.0.4

CCRDude

  • Sr. Member
  • ****
  • Posts: 431
Re: Indy e https certificate
« Reply #1 on: November 06, 2018, 03:29:12 pm »
There are many tutorials out there, e.g.:

https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309
https://kb.op5.com/pages/viewpage.action?pageId=19073746

Since you want to specify the CA (Certification Authority, for RootCertFile), make sure you look for a tutorial that includes the CA part, like those above.

xinyiman

  • Hero Member
  • *****
  • Posts: 1751
Re: Indy e https certificate
« Reply #2 on: November 06, 2018, 04:38:10 pm »
Thank you very much!
Ubuntu and Mac
Lazarus: 1.8.0
FPC: 3.0.4