Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Classic ASP Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
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)
MHT / HTML Email
MIME
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

ASP Blowfish CBC Encryption Matching Published Test Vectors

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

ASP script demonstrating 128-bit Blowfish CBC (cipher-block-chaining) encryption.

<html>
<body>
<%
    ' ASP Blowfish CBC Encryption to match published test vector
    ' at http://www.schneier.com/code/vectors.txt
    ' Reproduced here:
    ' chaining mode test data
    ' key[16]   = 0123456789ABCDEFF0E1D2C3B4A59687
    ' IV [8] = FEDCBA9876543210
    ' data[29]  = "7654321 Now is the time for " (includes trailing '\0')
    ' vdata[29]  = 37363534333231204E6F77206973207468652074696D6520666F722000
    ' cipher[32]= 6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC
    
	set crypt = Server.CreateObject("Chilkat_9_5_0.Crypt2")
    crypt.UnlockComponent "anything for 30-day trial"
    
    ' Set the CryptAlgorithm to "blowfish2".  Chilkat's original implementation
    ' of Blowfish ("blowfish") did not include CBC and returned encrypted data
    ' 4321 byte-swapped.  For backward compatibility, an additional CryptAlgorithm
    ' keyword ("blowfish2") was added to indicate the new Blowfish implementation.
    crypt.CryptAlgorithm = "blowfish2"
    
    crypt.CipherMode = "cbc"
    crypt.KeyLength = 128
    
    ' Padding Schemes:
    ' 0 = (RFC2630) Each padding byte is the pad count (16 extra added if size is already a multiple of 16)
    ' 1 = Random bytes except the last is the pad count (16 extra added if size is already multiple of 16)
    ' 2 = Pad with random data. (If already a multiple of 16, no padding is added).
    ' 3 = Pad with NULLs. (If already a multiple of 16, no padding is added).
    ' 4 = Pad with SPACE chars(0x20). (If already a multiple of 16, no padding is added).
    
    ' To match the test vector output, we need to pad with NULL bytes.
    crypt.PaddingScheme = 3
    
    ' Set the IV property via an encoded string.
    crypt.SetEncodedIV "FEDCBA9876543210", "hex"
    
    ' Set the SecretKey property via an encoded string.
    crypt.SetEncodedKey "0123456789ABCDEFF0E1D2C3B4A59687", "hex"
    
    ' Get the unencrypted data.
    unencryptedData = crypt.Decode("37363534333231204E6F77206973207468652074696D6520666F722000", "hex")
    
    ' Now encrypted it using the settings required to match the Blowfish test vector results.
    crypt.EncodingMode = "hex"
    encryptedHexString = crypt.EncryptBytesENC(unencryptedData)
    
    ' Displays: 6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC
    Response.Write encryptedHexString

%>
</body>
</html>
 

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