B4X Requires Chilkat v11.8.0+
B4X
Example: Crypt2.AddPemSource method
Demonstrates how to call the AddPemSource method.Chilkat B4X Downloads
Dim success As Boolean = False
Dim crypt As ChilkatCrypt2
crypt.Initialize("crypt")
success = False
' Do public-key decryption (RSA)
crypt.CryptAlgorithm = "pki"
' ...
' ...
' ...
' Load a PEM file that has a certificate and its private key. The 2nd argument of LoadPemFile
' is the password of the private key. (Pass an empty string if the private key is not encrypted.)
Dim pemPath As String = "c:/my_pem_files/a.pem"
Dim pemPassword As String = "secret1"
Dim pem As ChilkatPem
pem.Initialize
success = pem.LoadPemFile(pemPath, pemPassword)
If success = False Then
Log(pem.LastErrorText)
Return
End If
success = crypt.AddPemSource(pem)
If success = False Then
Log(crypt.LastErrorText)
Return
End If
' Add as many PEM sources as desired...
' Each call to AddPemSource adds more certificates to the ones already added.
pemPath = "c:/my_pem_files/b.pem"
pemPassword = "secret2"
Dim pem2 As ChilkatPem
pem2.Initialize
success = pem2.LoadPemFile(pemPath, pemPassword)
If success = False Then
Log(pem2.LastErrorText)
Return
End If
success = crypt.AddPemSource(pem2)
If success = False Then
Log(crypt.LastErrorText)
Return
End If
' ...
' ...