Framework EDI Reference. Methods and Properties
ediSecurities. CreateKeyContainer

Creates a new Cryptographic Service Provider (CSP) Key Container and generates the public/private key pair.

Syntax:

<lRetVal> = Object.CreateKeyContainer(<sKeyContainerName>, [<sServiceProvider>], [<lProviderType>])

Parameters:

Returns:

Returns 1 if the operation is successful; otherwise the operation returns zero.

Remarks:

When a new key container is added, the public/private key pairs for both the Key Exchange and the Signature keys are created.

The sServiceProvider and lProviderType specify the CSP where the key container will be created.  If sServiceProvider and/or lProviderType are not specified, the default CSP database is used, which is specified by DefaultProviderName andServiceProviderType.  The type of database, whether machine key set or user key set, is specified using ediDocument.Option by the constant OptDocument_MachineKeySet

Example:

Set oSecurities = oEdiDoc.GetSecurities

' Creates a new key container for hypothetical trading partner.
oSecurities.DeleteKeyContainer sKeyContainerName
oSecurities.CreateKeyContainer sKeyContainerName

'Export private and public key container to a file
oSecurities.ExportExchangeKeyPair sExportFileName, sPassword, sKeyContainerName, sProviderName

Sample

M_CreateKeyContainer.zip