Sample code for 30+ languages & platforms
Classic ASP

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 Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set cert = Server.CreateObject("Chilkat.Cert")

success = cert.LoadFromFile("qa_data/certs/someCert.pem")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
    Response.End
End If

' Get the certificate's public key:
set pubkey = Server.CreateObject("Chilkat.PublicKey")
success = cert.GetPublicKey(pubkey)

Response.Write "<pre>" & Server.HTMLEncode( pubkey.GetPem(0)) & "</pre>"

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

%>
</body>
</html>