Decrypt aes-encrypted text file to be read in via Excel VBA

KillPhil84

New Member
Joined
Mar 25, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

I've got a text-file with aes-encrypted content generated by a software in use at my place. It contains a database name, an username and the corresponding password. In the software, the user can enter these parameters, establish a connection to the database (Oracle DB) and perform different queries, have a look at statictics etc. I'd like to create diagrams for the aforementioned statictical values via Excel and therefore, I have to use the contents of the encrypted text-file for the connection to the database which then should allow me to get the relevant data into power query. I know the key and initialization vector (got both of them in form of an array) to decrypt the file (which is - as I understand it - all I need to decrypt the file's content)

I've already found some bits and pieces of code or functions written in different programming languages, but I can't make this work in Excel VBA. Does this work in Excel VBA in general? Do you have any advice for me where to (re-)start? My research and effort were rather fruitless so far... :-(
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Well AES encryption in VBA is certainly possible - here is one implementation that has worked for me in the past.

If that doesn't work, in terms of researching different modes/implementations of AES encryption, I would recommend focusing on VB6 (not to be confused with VB.NET). VBA and VB6 are essentially the same language (though the application object models start to result in differences), so if you can find in that language (and assuming that you're using 32bit Office) it should pretty much work without needing to adjust the code too much. A good resource is the VB6 Codebank in VBForums - here is another implementation (in VB6).

That said, I wonder about the key and initialization vector being provided in the form of an array... I'm not sure that the implementations I've seen would accept an array to decrypt a file...
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top