(Classic ASP) RSA Import Private Key
Shows how to select/import a private key for RSA signing or decryption.
<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.PrivateKey")
set privKey = Server.CreateObject("Chilkat.PrivateKey")
password = "secret"
' In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success = privKey.LoadAnyFormatFile("rsaKeys/myTestRsaPrivate.pem",password)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( privKey.LastErrorText) & "</pre>"
Response.End
End If
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Rsa")
set rsa = Server.CreateObject("Chilkat.Rsa")
' Tell the RSA object to use the private key (i.e. import the private key)
success = rsa.ImportPrivateKeyObj(privKey)
%>
</body>
</html>
|