Classic ASP
Classic ASP
ZATCA Load Certificate and Private Key from PEM Files
See more ZATCA Examples
Demonstrates how to load a certificate and private key from a pair of PEM files.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' The LoadFromFile method will automatically detect the file format..
set cert = Server.CreateObject("Chilkat.Cert")
success = cert.LoadFromFile("qa_data/zatca/cert.pem")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( cert.SubjectCN) & "</pre>"
' Load the private key.
set privKey = Server.CreateObject("Chilkat.PrivateKey")
success = privKey.LoadPemFile("qa_data/zatca/ec-secp256k1-priv-key.pem")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( privKey.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Key Type: " & privKey.KeyType) & "</pre>"
' Associate the private key with the certificate.
success = cert.SetPrivateKey(privKey)
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Success.") & "</pre>"
%>
</body>
</html>