我正在编写一个程序,使用libCurl和OpenSSL将文件上传到C中的Amazon S3。要向亚马逊发送请求,我必须签署 - 使用HMAC-SHA1 here amazon doc来解释它。请帮助,可以用openSSL完成,如果你知道如何建议?或者我需要使用其他一些库?
答案 0 :(得分:0)
本文档的这一部分准确说明了为每种请求类型编码的内容(包括上传文件),以及几个适用于测试请求/散列的示例: http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationExamples
答案 1 :(得分:0)
如果是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;