TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SOLVED: How to decrypt AES 128 in Swift?

Forums > Swift

Hi,

I need to collect and load some data to a website from a Linux server and then retrieve it in an iOS Swift app.

To comply with the owner's requirements, all data must be AES 128 encrypted before being uploaded.

I have the encryption and upload working correctly and I can decrypt the data using a Java program.

However, I am going round in circles trying to put together the decrypt in Swift!

I can retrieve and display plaintext data from the website so I'm comfortable with getting the file into my app.

After that - I'm stuck!

My requirement is to decrypt the ciphertext and return it as a String.

Can anyone either offer a small sample or point me towards anything which might help me to crack this problem?

Thanks in advance for any assistance ...

   

developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/using_keys_for_encryption/

   

Thanks for the link Bob - I read through it but it looked more appropriate for developing an end-to-end Swift solution.

I eventually spent an hour with chatGPT and managed to put together something which works.

Still more to do to apply the final polish but the AES part is now functional.

   

Hacking with Swift is sponsored by Blaze.

SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!

Reserve your spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.