IPassportCrypt::Encrypt
IPassportCrypt::Encrypt
Encrypts data using the same participant key that is used to exchange Microsoft .NET Passport information sent to the .NET Passport network.
Syntax
HRESULT Encrypt( BSTR rawData, BSTR* pEncrypted );
Parameters
- rawData
[in] A BSTR containing the data to be encrypted.
- pEncrypted
[out, retval] A pointer to the BSTR containing the encrypted data.
Return values
Returns one of the following values:
S_OK Success. E_FAIL Failure. The amount of data to be encrypted was greater than 2045 bytes; the key version was expired, invalid, or not present; or the Passport Manager object was not correctly configured. E_INVALIDARG The rawData 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
After the Encrypt method is executed, the Decrypt method must be performed to make the data readable. Encrypt will fail if attempting to encrypt a null or more than 2045 bytes of information. Larger blobs of data must be broken up and encrypted separately. The Encrypt and Decrypt methods are used to help maintain the data's security.
Typically, this method is used in conjunction with the Decrypt, Compress, and Decompress methods.
See Also
IPassportCrypt Interface | IPassportCrypt::Compress | IPassportCrypt::Decompress