Re: schannel DecryptMessage giving extra junk chars?

From: John Banes (jabanes_at_comcast.remove.net)
Date: 09/26/05

  • Next message: lelteto: "Re: WriteProcessMemory and ReadProcessMemory"
    Date: Mon, 26 Sep 2005 13:48:55 -0700
    
    

    As I recall, the byte count returned in the extra buffer indicates how many
    bytes in the input buffer were not processed by the DecryptMessage function.
    Before calling DecryptMessage again, you'll need to adjust the input buffer
    pointer such that it points at the unprocessed data. It's a little unclear
    from your message, but I suspect that you're not doing this. See the
    "webclient" sample in the Windows SDK for information on how to correctly
    handle this case.

    If you were to supply a hex dump of the input buffer, the output data
    buffer, and the extra buffer then we might be able to make a more accurate
    diagnosis. :-)

    "Steve" <Steve@discussions.microsoft.com> wrote in message
    news:23C2B51B-F293-4283-AB48-98EA529B7419@microsoft.com...
    > Hi,
    >
    > I am using schannel dll on XP with IE 6 SP2.
    > I seem to have it working well except I get some extra junk characters
    > received in the XML data stream.
    >
    > Before the junk chars appear I have 261 bytes in SECBUFFER_EXTRA. So I
    > loop and do a
    > scRet = DecryptMessage(&m_hContext,&Message,0,NULL);
    > on this data that returns a result of scRet == 0 so its OK.
    > I then have 6 junk bytes in SECBUFFER_DATA which are hex "65 36 65 64
    > 0d 0a" and I have 234 bytes in SECBUFFER_EXTRA. The rest of the data
    > including the 234 bytes in SECBUFFER_EXTRA is good.
    >
    > Is there any method I can use to test on SECBUFFER_DATA and find out
    > that the 6 bytes unencrypted are invalid?
    >
    > Are there any header sizes in _SecPkgContext_StreamSizes etc I can play
    > with?
    >
    > My client is connecting to
    > Server: Apache/1.3.29 Ben-SSL/1.52 (Debian GNU/Linux) mod_perl/1.29.
    >
    > I believe the server is OK as I can get good data using a .Net
    > HttpWebRequest class.
    >
    > Any suggestions why schannel is giving me junk characters or how to
    > test data integrity using schannel?
    >
    > Regards
    >
    > --
    > Steve


  • Next message: lelteto: "Re: WriteProcessMemory and ReadProcessMemory"