Sample code for 30+ languages & platforms
B4X 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 B4X Downloads

B4X
Dim success As Boolean = False

Dim cert As ChilkatCert
cert.Initialize("cert")

success = cert.LoadFromFile("qa_data/certs/someCert.pem")
If success = False Then
    Log(cert.LastErrorText)
    Return
End If


'  Get the certificate's public key:
Dim pubkey As ChilkatPublicKey
pubkey.Initialize
cert.GetPublicKey(pubkey)

Log(pubkey.GetPem(False))

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