Framework EDI Reference. Methods and Properties
ediSecurities. ImportExtendedCertificate

Imports an extended certificate to the certificate store.  An extended certificate contains extended properties specific only to Windows Operating System.

Syntax:

Set <oCertificate> = object. ImportExtendedCertificate(<sCertificateFile>, [<sServiceProvider>], [<lProviderType>])

Parameters:

Returns

Returns an object of type FREDI.ediSecurityCertificate if imported successfully; otherwise NULL or an empty object is returned.

Remarks

Currently the X.509 certificate can only be imported in the following format:

The default certificate store is specified by the properties DefaultCertSystemStoreName and DefaultCertSystemStoreLocation.

The sServiceProvider and lProviderType specify the CSP whose security services will be used.  If sServiceProvider and/or lProviderType are not specified, the default CSP database is used, which is specified by DefaultProviderName andServiceProviderType.

Example:

Dim oEdiDoc As Fredi.ediDocument
Dim oSecurities As Fredi.ediSecurities

' Create instance of Framework EDI.
Set oEdiDoc = New Fredi.ediDocument

' Get securities object.
Set oSecurities = oEdiDoc.GetSecurities

' Set the default certificate store
oSecurities.DefaultCertSystemStoreName = "My" ' Case sensitive

' Set the default certificate store location
oSecurities.DefaultCertSystemStoreLocation = "CurrentUser"

' Test certificate created successfully.
' Import test certificate to default certificate store.

Dim oCertificate As Fredi.ediSecurityCertificate

Set oCertificate = oSecurities.ImportExtendedCertificate(App.Path & "\MyExportedTestCert.cer")
If Not oCertificate Is Nothing Then
MsgBox "Successfully imported test certificate 'Edidev Test Certificate'."

Else
MsgBox "Failed to import extended certificate"

End If

Sample

M_ImportExtendedCertificate.zip