login about faq

Firstly let me thank you for the new Chilkat Delphi DLL. This resolves so many ActiveX problems and is greatly appreciated.

However I am having a problem with the CkCrypt2__inflateStringENC function, when inflating compressed text that should result in an empty string.

The wrapper function I am using is this...

function TChilkatDLL_SymmetricEncryption.uncompressText_wide(const aCompressedText: WideString; out aoutPlainText: WideString): Boolean;
var
  plainText_wide_ptr: PWideChar;
begin
  aoutPlainText := '';

  plainText_wide_ptr := CkCrypt2__inflateStringENC(fCryptObjectHandle, PWideChar(aCompressedText));

  if (plainText_wide_ptr = nil) then begin
    raise Exception.Create('InflateStringENC failed: ' + getLastErrorMessageFromDLL);
  end
  else begin
    aoutPlainText := plainText_wide_ptr;

    result := True;
  end;
end;

Note: I am using Delphi 2007, so I am explicitly using WideString types, rather than just String types as they would be in Delphi XE2.

The Charset is set to 'ANSI', the EncodingMode is set to 'base64', and the CompressionAlgorithm is set to 'bzip2'.

This function has been tested and exercised extensively, and seems to work completely reliably, except in one specific case - when the expected result is an empty string.

Here is the lastErrorText from the function call...

ChilkatLog:
  InflateStringENC:
    DllDate: Dec 13 2012
    UnlockPrefix: SENETCCrypt
    Username: NEVILLE-WIN7:Neville
    Architecture: Little Endian; 32-bit
    Language: C++ Builder XE2
    VerboseLogging: 0
  --InflateStringENC
--ChilkatLog

In this case, the aCompressedText is '4aeUswAAAAA=', and the result of the CkCrypt2__inflateStringENC function call is usually (but not always) pointing to garbage data. (Sometimes the result is an empty string, but this is not reliable.)

We have had to work around the problem like this...

function TChilkatDLL_SymmetricEncryption.uncompressText_wide(const aCompressedText: WideString; out aoutPlainText: WideString): Boolean;
var
  plainText_wide_ptr: PWideChar;
begin
  aoutPlainText := '';

  if (aCompressedText = '4aeUswAAAAA=') then begin
    aoutPlainText := '';

    result := True;
  end
  else begin
    plainText_wide_ptr := CkCrypt2__inflateStringENC(fCryptObjectHandle, PWideChar(aCompressedText));

    if (plainText_wide_ptr = nil) then begin
      raise Exception.Create('InflateStringENC failed: ' + getLastErrorMessageFromDLL);
    end
    else begin
      aoutPlainText := plainText_wide_ptr;

      result := True;
    end;
  end;    
end;

This work around has been reasonably well tested, and we have not yet seen it fail. But it is specific to our situation, and is not a full or general purpose solution to the problem.

All the diagnosis we have been able to perform has come to the conclusion that the problem is occurring in the DLL CkCrypt2__inflateStringENC function.

Could you please either verify our findings, or point out where we may have gone wrong.

asked Feb 03 '13 at 23:38

ncook's gravatar image

ncook
6112

Thanks, I'm looking at this problem..

(Feb 04 '13 at 11:31) chilkat ♦♦

link

answered Feb 05 '13 at 09:51

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Thanks for the fast response. This new version work perfectly.

(Feb 05 '13 at 17:57) ncook

I found and fixed the problem. I'll post a download to a new build as soon as possible.

link

answered Feb 04 '13 at 12:01

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×56
×32
×22
×3

Asked: Feb 03 '13 at 23:38

Seen: 1,826 times

Last updated: Feb 05 '13 at 17:57

powered by OSQA