Share via


PassportIdentity.Compress

PassportIdentity.Compress

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

Syntax

public static string Compress(string strData)

Parameters

  • strData
    The data to be compressed.

Return values

The compressed data.

Example

For an example of this method, see PassportIdentity.Decrypt.

Remarks

Compress is usually called before calling Encrypt because a string that is encrypted in double-byte representation will save space on the query string or in storage.

This method is intended primarily for use with low ASCII strings, such as are produced by the Microsoft® .NET Passport encryption algorithm. Compressing the strings in this way 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 .NET Passport server-side use of the Compress method compresses regular ASCII characters only. Compressing strings that are not entirely composed of regular ASCII and contain extended characters or Unicode is not supported by the Compress method; such strings may not be correctly decompressed.

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

See Also

Passport PassportIdentity Object | PassportIdentity.Decompress | PassportIdentity.Encrypt | PassportIdentity.Decrypt