Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Classic ASP Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
FileAccess
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(Classic ASP) RSA Encrypt RSA/ECB/OAEPWithSHA1AndMGF1Padding

Demonstrates how to RSA encrypt using RSA/ECB/OAEPWithSHA1AndMGF1Padding. Also demonstrates RSA/ECB/OAEPWithSHA-256AndMGF1Padding. Both of these terms are from Java's JCE. Note: In this context, "ECB" doesn't actually mean anything. It's a symmetric cipher mode that doesn't apply (or make sense) in this context.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set rsa = Server.CreateObject("Chilkat_9_5_0.Rsa")

success = rsa.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "RSA component unlock failed") & "</pre>"
    Response.End
End If

'  First load a public key object with a public key.
'  In this case, we'll load it from a file.
set pubkey = Server.CreateObject("Chilkat_9_5_0.PublicKey")
success = pubkey.LoadFromFile("qa_data/pem/rsa_public.pem")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( pubkey.LastErrorText) & "</pre>"
    Response.End
End If

'  RSA encryption is limited to small amounts of data. The limit
'  is typically a few hundred bytes and is based on the key size and
'  padding (OAEP vs. PKCS1_5).  RSA encryption is typically used for
'  encrypting hashes or symmetric (bulk encryption algorithm) secret keys.
plainText = "Time is an illusion. Lunchtime doubly so."

'  Import the public key to be used for encrypting.
success = rsa.ImportPublicKeyObj(pubkey)

'  To get OAEP padding, set the OaepPadding property:
rsa.OaepPadding = 1

'  To use SHA1 or SHA-256, set the OaepHash property
rsa.OaepHash = "sha256"
'  for SHA1 --
rsa.OaepHash = "sha1"

'  Indicate we'll want hex output
rsa.EncodingMode = "hex"

'  Encrypt..
usePrivateKey = 0
encryptedStr = rsa.EncryptStringENC(plainText,usePrivateKey)
Response.Write "<pre>" & Server.HTMLEncode( encryptedStr) & "</pre>"

%>
</body>
</html>

 

© 2000-2016 Chilkat Software, Inc. All Rights Reserved.