Compartir a través de


IPassportCrypt::Compress

IPassportCrypt::Compress

Given a BSTR string, compresses the string into a multi-byte representation of the same string.

Syntax

HRESULT Compress(
    BSTR bstrIn, 
    BSTR* pbstrOut
);

Parameters

  • bstrIn
    [in] A BSTR containing the data to be compressed.
  • *pbstrOut
    [out, retval] A pointer to the BSTR containing the compressed data.

Return values

Returns one of the following values:

S_OK Success.
E_OUTOFMEMORY Could not allocate memory for a copy string.
E_POINTER The bstrIn parameter was NULL or a NULL pointer. A zero length string does not produce this error.

Example

For an example of this method, see IPassportCrypt::Decrypt.

Remarks

Typically, this method is used in conjunction with Encrypt, Decrypt, and Decompress.

Compressing the strings saves bytes in the encrypted string due to the nature of the encryption algorithm. The strings sent in the kppvc query string parameter and used for Microsoft® Kids Passport account verification will already be compressed in this manner.

The Compress method is provided with the companion method Decompress. The Microsoft .NET Passport server-side usage of the Compress method only compresses regular ASCII characters. Compressing strings that are not entirely composed of regular ASCII and contain extended characters or Unicode is not supported by the Compress method and may not be properly decompressed.

See Also

IPassportCrypt Interface | IPassportCrypt::Decompress | IPassportCrypt::Encrypt