CryptoSys API examples VB6 to VB.NET

AES128_FileHex

Encrypts or decrypts a file using a specified mode.

VB6/VBA

Debug.Print "Testing AES128_FileHex ..."
Dim nRet As Long
nRet = AES128_FileHex("bigfile.cbc", "bigfile.dat", _
    "fedcba9876543210fedcba9876543210", _
    ENCRYPT, "CBC", "0123456789abcdef0123456789abcdef")
If nRet <> 0 Then
    Debug.Print "AES128_FileHex failed: " & apiErrorLookup(nRet)
Else
    Debug.Print "AES128_FileHex encrypted file OK"
End If

Output

Testing AES128_FileHex ...
AES128_FileHex encrypted file OK

VB.NET

Console.WriteLine("Testing AES128_FileHex ...")
Dim nRet As Integer
nRet = Aes128.FileEncrypt("bigfile.cbc", "bigfile.dat", _
    "fedcba9876543210fedcba9876543210", _
    Mode.CBC, "0123456789abcdef0123456789abcdef")
If nRet <> 0 Then
    Console.WriteLine("AES128_FileHex failed: " & General.ErrorLookup(nRet))
Else
    Console.WriteLine("AES128_FileHex encrypted file OK")
End If

[Contents]

[HOME]   [NEXT: AES128_Hex...]

Copyright © 2009-20 D.I. Management Services Pty Ltd. All rights reserved.