Framework EDI Reference. Methods and Properties
ediSecurities. ImportExchangeKeyPair

Imports a file containing the Public/Private key pair into a Cryptographic Service Provider (CSP) key container.

Syntax

<lretval> = object. ImportExchangeKeyPair(<sImportFileName>, <sPassword>, <sNewContainerName>, [<sServiceProvider>], [< lProviderType>])

Parameters

Returns

Returns 1 if the task was successful. Otherwise it returns 0.

Remarks

A new key container specified by sNewContainerName is created before the keys are imported to the new key container. If the key fails to import to the new key container, the new key container will not be deleted. It is left up to the user to delete the key container. The keys imported must belong to the same service provider that exported the keys.

Example:

Dim oEdiDoc As Fredi.ediDocument
Dim oSecurities As Fredi.ediSecurities
Dim sImportFileName As String
Dim sPassword As String
Dim sKeyContainerName As String
Dim sProviderName As String

sImportFileName = App.Path & "\KeyExchangePair.bin"
sPassword = "Quick brown fox"
sKeyContainerName = "FREDITEST_RECIPIENT2"
sProviderName = "Microsoft Base Cryptographic Provider v1.0"

Set oEdiDoc = New Fredi.ediDocument
Set oSecurities = oEdiDoc.GetSecurities

oSecurities.ImportExchangeKeyPair sImportFileName, sPassword, sKeyContainerName, sProviderName