开发者

HMAC-SHA1 with OpenSSL/Request to Amazon S3 signature

I am writing a program to upload file to Amazon S3 in C with libCurl and OpenSSL. To send a request to amazon I have to sign it - with HMAC-SHA1 here amazon doc that explain it. Help, please, can it be done with openSSL, and if U know 开发者_高级运维advise how? Or I need to use some other libs?


This section of the documentation explains exactly what to encode for each request type (including uploading a file), with several examples that are good for testing your requests/hashing: http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationExamples


If it's iOS..

AmazonAuthUtils.h

/**
 * Compute a keyed hash of some data with a specified key and algorithm.
 * @param data  The data to sign
 * @param key   The key to sign the data with
 * @param algorithm Which HMAC algortithm to use. Currently support <code>kCCHmacAlgSHA1</code> and <code>kCCHmacAlgSHA256</code>.
 * @return Base64 encoded string that is the signature of the data with the specified key.
 */
+(NSString *)HMACSign:(NSData *)data withKey:(NSString *)key usingAlgorithm:(CCHmacAlgorithm)algorithm;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜