CryptoSys PKI Toolkit Manual

Example: Pfx.MakeFile  Pfx.Options  Pfx.SignatureIsValid  Wipe.String 

[VB6 equivalent: PFX_MakeFile]

Dim strOutputFile As String
Dim strCertFile As String
Dim strKeyFile As String
Dim sbPassword As StringBuilder
Dim nRet As Integer
Dim isOK As Boolean

strOutputFile = "Bob1.pfx"
strCertFile = "BobRSASignByCarl.cer"
strKeyFile = "BobPrivRSAEncrypt.epk"
sbPassword = New StringBuilder("password")

' Given Bob's certificate and encrypted private key file (with password "password"),
' create a PKCS-12 (pfx/p12) file.
nRet = Pfx.MakeFile(strOutputFile, strCertFile, strKeyFile, sbPassword.ToString(), "Bob's ID", Pfx.Options.Default)
Console.WriteLine("Pfx.MakeFile returns " & nRet)

' Now verify that the signature is OK
isOK = Pfx.SignatureIsValid(strOutputFile, sbPassword.ToString())
Console.WriteLine("Pfx.SignatureIsValid returns " & isOK)

' Clean up
Call Wipe.String(sbPassword)

See Also:
Pfx.MakeFile Method (String, String, String, String, String, Pfx.Options)

[Contents] [Index]

[HOME]   [NEXT: Example: Pfx.MakeFile ...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.