(Classic ASP) Get Certificate Public Key from PEM
Demonstrates how to load a PEM file containing a certificate and access the public key.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Cert")
set cert = Server.CreateObject("Chilkat.Cert")
success = cert.LoadFromFile("qa_data/pem/my_cert.pem")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
Response.End
End If
' pubkey is a Chilkat.PublicKey
Set pubkey = cert.ExportPublicKey()
If (cert.LastMethodSuccess <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
Response.End
End If
' Examine the public key as XML..
Response.Write "<pre>" & Server.HTMLEncode( pubkey.GetXml()) & "</pre>"
%>
</body>
</html>
|