Sample code for 30+ languages & platforms
Visual Basic 6.0

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim cert As New ChilkatCert

Dim strPem As String
strPem = "-----BEGIN CERTIFICATE----- ..."

success = cert.LoadPem(strPem)
If (success = 0) Then
    Debug.Print cert.LastErrorText
    Exit Sub
End If

Dim pubKey As New PublicKey
success = cert.GetPublicKey(pubKey)

' You can now use the public key object however it is needed,
' and access its various properties and methods..

Debug.Print pubKey.GetXml()