PowerBuilder
PowerBuilder
Example: Crypt2.EncryptEncoded method
Demonstrates how to call the EncryptEncoded method.Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Crypt
string ls_Encrypted
string ls_Decrypted
loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
destroy loo_Crypt
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Crypt.CryptAlgorithm = "aes"
loo_Crypt.CipherMode = "cbc"
loo_Crypt.KeyLength = 128
loo_Crypt.SetEncodedKey("000102030405060708090A0B0C0D0E0F","hex")
loo_Crypt.SetEncodedIV("000102030405060708090A0B0C0D0E0F","hex")
// Encrypt the bytes 0x00, 0x01, 0x02, ... 0x0A
// and return the encrypted bytes using the lowercase hex encoding.
loo_Crypt.EncodingMode = "hex_lower"
ls_Encrypted = loo_Crypt.EncryptEncoded("000102030405060708090a")
Write-Debug ls_Encrypted
// Output:
// 9da2ae71a5378487114b430e5e230378
ls_Decrypted = loo_Crypt.DecryptEncoded(ls_Encrypted)
Write-Debug ls_Decrypted
// Output:
// 000102030405060708090a
destroy loo_Crypt