• Yes, requires OpenSSL
  • No, only Blocking mode
  • Yes, Requires Win8.+

WebSocket SSL Certificate Info

When a connection is secure, sometimes it's interesting to get certificate info to show user company name for example. To do this, just use OnSSLGetHandler, where you can access to some SSL properties and handle OnVeryPeerEvent, where there is a parameter called Certificate, where you can get certificate info.


procedure OnSSLGetHandler(Sender: TObject; aType:
    TwsSSLHandler; var aSSLHandler: TIdSSLIOHandlerSocketBase);
  aSSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  TIdSSLIOHandlerSocketOpenSSL(aSSLHandler).SSLOptions.VerifyMode := [sslvrfPeer];
  TIdSSLIOHandlerSocketOpenSSL(aSSLHandler).SSLOptions.Method := sslvTLSv1;
  TIdSSLIOHandlerSocketOpenSSL(aSSLHandler).SSLOptions.Mode := sslmClient;

  TIdSSLIOHandlerSocketOpenSSL(aSSLHandler).OnVerifyPeer := OnVerifyPeerEvent;

function OnVerifyPeerEvent(Certificate: TIdX509; AOk: Boolean;
    ADepth: Integer): boolean;
  Result := True;

// ... read certificate properties
//  Certificate