Sample code for 30+ languages & platforms
VB.NET

ZATCA Load Certificate and Private Key from PEM Files

See more ZATCA Examples

Demonstrates how to load a certificate and private key from a pair of PEM files.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

' The LoadFromFile method will automatically detect the file format..
Dim cert As New Chilkat.Cert
success = cert.LoadFromFile("qa_data/zatca/cert.pem")
If (success <> True) Then
    Debug.WriteLine(cert.LastErrorText)
    Exit Sub
End If


Debug.WriteLine(cert.SubjectCN)

' Load the private key.
Dim privKey As New Chilkat.PrivateKey
success = privKey.LoadPemFile("qa_data/zatca/ec-secp256k1-priv-key.pem")
If (success <> True) Then
    Debug.WriteLine(privKey.LastErrorText)
    Exit Sub
End If


Debug.WriteLine("Key Type: " & privKey.KeyType)

' Associate the private key with the certificate.
success = cert.SetPrivateKey(privKey)
If (success <> True) Then
    Debug.WriteLine(cert.LastErrorText)
    Exit Sub
End If


Debug.WriteLine("Success.")