Carrie Harvard
Carrie Harvard

Reputation: 33

aws version 4 signature in C

I am trying to use SQS on aws (on a linux box) using generic C. Not using any sdk (not that there is one for C). I can not find an example I can relate to. Sorry, I don't relate to these newfangled languages. I am proficient in Cobol, fortran, pascal and C. Not python, c++, c# or java. There are "steps" on amazon site, but honestly they expect proficiency on aws and an object oriented language. I just want to create my own https get command for accessing SQS/SNS, can anyone provide a 'C' snipet that creates a complete url with the version 4 signature? Or point me in the correct direction?

Upvotes: 2

Views: 1509

Answers (2)

Matthias Gatto
Matthias Gatto

Reputation: 221

You can use libcurl for the call:

Use CURLOPT_AWS_SIGV4 argument for the signature https://curl.se/libcurl/c/CURLOPT_AWS_SIGV4.html

You can take a look at CURLOPT_WRITEFUNCTION if you want to store the result into a variable: https://curl.se/libcurl/c/CURLOPT_WRITEFUNCTION.html

And for debugging purpose CURLOPT_VERBOSE can be useful too: https://curl.se/libcurl/c/CURLOPT_VERBOSE.html

Note that you need a version of libcurl superior to 7.75.

Upvotes: 1

viraptor
viraptor

Reputation: 34175

Have a look at https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html

If you're proficient with any programming language, you should be able to understand all of that code. It's just string operations and some hashing for which you'll have to use another library. There's also lots of comments to help you with the details.

Upvotes: 2

Related Questions