Hi, I just upgraded cryptlib from v3.4.2 to v3.4.3.1 and found some issues using it with Synapse (r207 just updated from svn):

* Fails to compile: CRYPT_CERTINFO_FINGERPRINT does not exists anymore. Replaced it with CRYPT_CERTINFO_FINGERPRINT_SHA1. Seems to work, is it sound?:

function TSSLCryptLib.GetPeerFingerprint: string;
var
  cert: CRYPT_CERTIFICATE;
begin
  Result := '';
  if FcryptSession = CRYPT_SESSION(CRYPT_SESSION_NONE) then
    Exit;
  cryptGetAttribute(FCryptSession, CRYPT_SESSINFO_RESPONSE, cert);
  Result := GetString(cert, CRYPT_CERTINFO_FINGERPRINT_SHA1);
  cryptDestroyCert(cert);
end;

* TTCPBlockSocket.RecvPacket got very slooooow. Is solved it setting momentarily the read timeout to zero before the call to CryptPopData, so it does only retrieve already received data. Again: is this a sound approach?:

function TSSLCryptLib.PopAll: string;
const
  BufferMaxSize = 32768;
var
  Outbuffer: string;
  WriteLen, T: integer;
begin
  Result := '';
  repeat
    setlength(outbuffer, BufferMaxSize);
    Writelen := 0;
if not SSLCheck(cryptGetAttribute(FCryptSession, CRYPT_OPTION_NET_READTIMEOUT, T)) then
      Break;
    try
if not SSLCheck(cryptSetAttribute(FCryptSession, CRYPT_OPTION_NET_READTIMEOUT, 0)) then
        Break;
SSLCheck(CryptPopData(FCryptSession, @OutBuffer[1], BufferMaxSize, Writelen));
      if FLastError <> 0 then
        Break;
    finally
// Can't break out of a finally, but CRYPT_OPTION_NET_READTIMEOUT never fails... if not SSLCheck(cryptSetAttribute(FCryptSession, CRYPT_OPTION_NET_READTIMEOUT, T)) then
        ; //Break;
    end;
    if WriteLen > 0 then
    begin
      setlength(outbuffer, WriteLen);
      Result := Result + outbuffer;
    end;
  until WriteLen = 0;
end;

Best regards,
Mario


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to