| (Classic ASP) Duplicate openssl pkey -in private.pem -pubout -out pubkey.pemHow to output the public part of a private key:
Demonstrates how to duplicate this OpenSSL command:
 
openssl pkey -in private.pem -pubout -out pubkey.pem
 Note: This example requires Chilkat v11.0.0 or greater. 
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set pkey = Server.CreateObject("Chilkat.PrivateKey")
' Load the private key from an PEM file:
success = pkey.LoadPemFile("private.pem")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( pkey.LastErrorText) & "</pre>"
    Response.End
End If
set pubKey = Server.CreateObject("Chilkat.PublicKey")
success = pkey.ToPublicKey(pubKey)
success = pubKey.SavePemFile(0,"pubKey.pem")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( pubKey.LastErrorText) & "</pre>"
    Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Success.") & "</pre>"
%>
</body>
</html>
 |