Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide my AWS S3 access key and secret in C++?

Tags:

c++

amazon-s3

I'm using AWS S3 in my C++ app to upload and download files. I've included the access key and secret in my code but I'm worried someone could read them from the binary. Is there any standard technique for obfuscating them?

Update: I'm not running this app on a PC, it's actually on an embedded device so I'm not worried about users reading the key and secret from a file or RAM (accessing the device is a lot harder). What I'm worried about is someone binwalking our update file and pulling the key and secret from the binary.

like image 528
parsley72 Avatar asked Nov 08 '22 23:11

parsley72


1 Answers

Storing a secret in computer is not an easy task. One thing you could do is encrypt the key using a password and store the encrypted data in a file. Then when user enters a password you can decrypt the encrypted data using the password and retrieve the key - which you can use.

But this approach will not work for scenarios where the software needs to run without user intervention.

like image 146
Giorgi Moniava Avatar answered Nov 14 '22 22:11

Giorgi Moniava