iOS 中的亚马逊产品广告 API 签名 [英] Amazon Product Advertising API Signature in iOS

查看:27
本文介绍了iOS 中的亚马逊产品广告 API 签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 iOS 应用程序中访问亚马逊的产品广告 API.创建签名似乎是困难的部分.在此页面上:

I am trying to access Amazon's Product Advertising API in my iOS application. Creating the signature seems to be the tough part. On this page:

http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/rest-signature.html

它说使用 SHA256 哈希算法计算符合 RFC 2104 的 HMAC".Amazon 还提供了一个 java 类来为您执行此操作:

It says to "Calculate an RFC 2104-compliant HMAC with the SHA256 hash algorithm". Amazon also provides a java class to do this for you:

http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/AuthJavaSampleSig2.html

有人知道我如何在 Objective-C 中做到这一点吗?我查看了 AWS iOS SDK,但它似乎不包含产品广告 API.

Does anybody know how I can do this in Objective-C instead? I looked into the AWS iOS SDK, but it doesn't seem to include the Product Advertising API.

推荐答案

实际上 AWS iOS SDK DID 有一个静态方法来处理所有身份验证情况.也许你应该看一眼 AmazonAuthUtils.h :

Actually the AWS iOS SDK DID have a static method to handle all auth situations. Maybe you should take a glance at the AmazonAuthUtils.h :

+(NSString *)HMACSign:(NSData *)data withKey:(NSString *)key usingAlgorithm:(CCHmacAlgorithm)algorithm;
+(NSData *)sha256HMac:(NSData *)data withKey:(NSString *)key;

您可以在文档中找到它:http://docs.amazonwebservices.com/AWSiOSSDK/latest/Classes/AmazonAuthUtils.html

you can find it in the document: http://docs.amazonwebservices.com/AWSiOSSDK/latest/Classes/AmazonAuthUtils.html

这篇关于iOS 中的亚马逊产品广告 API 签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆