Sample code for 30+ languages & platforms
Visual Basic 6.0 Requires Chilkat v11.0.0+

Get Public Key from Certificate PEM

See more Certificates Examples

Loads a certificate from a PEM file and gets the cert's public key.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim cert As New ChilkatCert

success = cert.LoadFromFile("qa_data/certs/someCert.pem")
If (success = 0) Then
    Debug.Print cert.LastErrorText
    Exit Sub
End If

'  Get the certificate's public key:
Dim pubkey As New PublicKey
success = cert.GetPublicKey(pubkey)

Debug.Print pubkey.GetPem(0)

'  OK.. we have the public key which can be used in other Chilkat classes/methods...