Sample code for 30+ languages & platforms
Classic ASP

Use Base64 RSA Key to Encrypt

See more RSA Examples

Loads a Base64 RSA key and uses it to encrypt a string, returning the result in base64.

Chilkat Classic ASP Downloads

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

' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

set pubkey = Server.CreateObject("Chilkat.PublicKey")

success = pubkey.LoadBase64("MIICdgIBADA ... A9PXLk+j5A==")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( pubkey.LastErrorText) & "</pre>"
    Response.End
End If

set rsa = Server.CreateObject("Chilkat.Rsa")

success = rsa.UsePublicKey(pubkey)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( rsa.LastErrorText) & "</pre>"
    Response.End
End If

rsa.EncodingMode = "base64"

encryptedStr = rsa.EncryptStringENC("12345678",0)

Response.Write "<pre>" & Server.HTMLEncode( encryptedStr) & "</pre>"

%>
</body>
</html>