IMSCSAuthManager2::GenerateEncryptionKey Method [C++]

Use this method to generate an encryption key for encrypting/decrypting cookie and query string data used for tickets.

Definition

[C++]

HRESULT IMSCSAuthManager::GenerateEncryptionKey(BSTR*pbstrRet);

[Visual Basic]

Function GenerateEncryptionKey() As String

Parameters

  • pbstrRet[C++]
    [out, retval] A pointer to a BSTR used to return a copy of the encryption key.

[Visual Basic] None.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] If this method completes successfully, it returns a String that contains the encryption key.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM error that this method can return.

Constant Value Description
E_UPM_AUTHMANAGER_GENERATE_ENCRYPTIONKEY_FAILED [C++] 0xC1004C26

[Visual Basic] &HC1004C26

An error occurred while generating the encryption key using CryptoAPI, the Windows API that supports encryption features.

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

[C++]

The pbstrRet parameter contains valid data only if the method completes successfully.

This method is one of the few AuthManager methods used in C++ applications.

This method is used by Commerce Server setup and Commerce Server Site Packager components during installation, and can be used to change the encryption key at a later time.

The encryption key is stored as part of the site configuration resource properties in the Administrative database.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

' oAuthManager is a Commerce AuthManager object

sEncryptionKey = oAuthManager.GenerateEncryptionKey()

See Also

[C++]AuthManager Object

[Visual Basic]AuthManager Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.