EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Unable to save private key

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#29031
Posted: 03/30/2014 05:48:43
by nikolay malkin (Basic support level)
Joined: 03/30/2014
Posts: 1

Hi guys, i got a question about SaveKeyToFile method.

I want to save certificate and private key that server had sent to me;

So when validating method is fire there is no any errors and exceptions.

But i got only Certificate saved, the private key file is always empty.

Please help me to solve this problem, i need both Cert and Key.

Code

procedure TfrmMain.Button1Click(Sender: TObject);
var
  http:TIdHTTP;
  SSLHandler:TElClientIndySSLIOHandlerSocket;
begin

http:=TIdHTTP.Create(nil);
SSLHandler:=TElClientIndySSLIOHandlerSocket.Create(nil);
//SSLHandler.Versions:=[sbSSL2,sbSSL3,sbTLS1,sbTLS11];
SSLHandler.OnCertificateValidate:=SSLHandlerCertificateValidate;
http.IOHandler:=SSLHandler;
http.Get('https://github.com');

end;


procedure TfrmMain.SSLHandlerCertificateValidate(
  Sender: TObject; Certificate: TElX509Certificate; var Validate: Boolean);

begin

Certificate.SaveToFile('c:\Users\Malkin\Desktop\cert.pem','000777',cfPEM); // this one is ok

Certificate.SaveKeyToFile('c:\Users\Malkin\Desktop\cert.key','000777',kffPEM);// this one is empty

  Validate := true;

end;


By the way
Code

if Certificate.PrivateKeyExists then ShowMessage('1') else ShowMessage('0');


Is always return 0;

Any ideas ?
#29036
Posted: 03/30/2014 14:13:55
by Ken Ivanov (EldoS Corp.)

Hello Nikolay,

The private key in this scheme is stored on the server and is never sent to the clients. Only the public key is sent.

On a side note, if you have a license, please assign the license ticket to your Helpdesk account so that we could identify you as a customer.

Reply

Statistics

Topic viewed 495 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!