|
|
|
|
|
DecryptStandard (Example)
Encryption/Decryption example. bufEncryptionKey is Buffer // with cryptAES128, the key is on 128 bits // - Either we take the hash on 128 bits of any 'standard' key // (to be done for the encryption and for the decryption) bufEncryptionKey = HashString(HA_MD5_128, "encryption key") // - Or we give a key with exactly the proper size 128 bits that is 16 bytes // bufEncryptionKey="encryptkey128bits" // For the encryption, a code example can be: // bufNotEncrypted is Buffer = "secret data" // bufEncryptedData = EncryptStandard(bufNotEncrypted, bufEnryptionKey, ... // cryptAES128, cryptCBC, cryptPaddingPKCS) // Decryption WHEN EXCEPTION IN bufResult is Buffer = DecryptStandard(bufEncryptedData, bufEncryptionKey, ... cryptAES128, cryptCBC, cryptPaddingPKCS) DO // The decryption failed because the values are not correct: // incorrect key size, insufficient message size for the initial vector... ErrorThrow(1, ExceptionInfo()) END IF ErrorOccurred THEN // Decryption problem Error("The decryption failed ", ErrorInfo()) ELSE // Decryption OK, bufResult contains the decrypted buffer Info("Decrypted data: ", bufResult) END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|