CryptoSys PKI examples VB6 to VB.NET

PFX_MakeFile[2]

Creates a simple PFX (PKCS-12) file from X.509 certificate and (optional) encrypted private key file.

VB6/VBA

Debug.Print "Testing PFX_MakeFile ..."
Dim strOutputFile As String
Dim strCertFile As String
Dim strKeyFile As String
Dim nRet As Long

strOutputFile = "CarlNoKey.p12"
strCertFile = "CarlRSASelf.cer"

' Given Carl's certificate only,
' create a PKCS-12 (pfx/p12) file with no private key.
nRet = PFX_MakeFile(strOutputFile, strCertFile, "", "", "Carl's ID", PKI_PFX_NO_PRIVKEY)
Debug.Print "PFX_MakeFile returns " & nRet

Output

Testing PFX_MakeFile ...
PFX_MakeFile returns 0

VB.NET

Console.WriteLine("Testing PFX_MakeFile ...")
Dim strOutputFile As String
Dim strCertFile As String
Dim nRet As Integer

strOutputFile = "CarlNoKey.p12"
strCertFile = "CarlRSASelf.cer"

' Given Carl's certificate only,
' create a PKCS-12 (pfx/p12) file with no private key.
nRet = Pfx.MakeFile(strOutputFile, strCertFile, "", "", "Carl's ID", True)
Console.WriteLine("PFX_MakeFile returns " & nRet)

[Contents]

[HOME]   [NEXT: PKI_CompileTime...]

Copyright © 2010-20 D.I. Management Services Pty Ltd. All rights reserved.