我正在编写一个程序,使用 libCurl 和 OpenSSL 将文件上传到 C 中的 Amazon S3。要向亚马逊发送请求,我必须对其进行签名 -此处使用 HMAC-SHA1 亚马逊文档来解释它。请帮忙,可以用openSSL完成吗,如果你知道怎么做?或者我需要使用其他一些库?
问问题
1697 次
2 回答
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;
于 2013-08-23T22:25:01.250 回答
0
文档的这一部分准确解释了每种请求类型(包括上传文件)的编码内容,并提供了几个有助于测试您的请求/散列的示例:http: //docs.aws.amazon.com/AmazonS3/latest/ dev/RESTAuthentication.html#RESTAuthenticationExamples
于 2013-07-24T13:45:31.437 回答