CryptoSys PKI Pro 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.p8e"
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

[Contents] [Index]

[PREV: Example: Pem.FileToBinFile ...]   [Contents]   [Index]   
   [NEXT: Example: Pfx.MakeFile ...]

Copyright © 2004-23 D.I. Management Services Pty Ltd. All rights reserved. Generated 2023-09-18T10:02:53Z.