Sample code for 30+ languages & platforms
B4X Requires Chilkat v11.0.0+

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

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

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

success = cert.LoadPem(strPem)
If success = False Then
    Log(cert.LastErrorText)
    Return
End If


Dim pubKey As ChilkatPublicKey
pubKey.Initialize
cert.GetPublicKey(pubKey)

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

Log(pubKey.GetXml)