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

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

问题描述

我试图访​​问Amazon的产品广告API在我的iPhone应用程序。创建签名似乎是艰难的部分。本页内容:

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:

<一个href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/rest-signature.html">http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/rest-signature.html

它说,计算一个RFC 2104兼容的HMAC与SHA256散列算法。亚马逊还提供了一个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:

<一个href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/AuthJavaSampleSig2.html">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中也有一个静态方法来处理所有身份验证的情况。 也许你应该瞄了一眼 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;

您可以在文档中找到它:<一href="http://docs.amazonwebservices.com/AWSiOSSDK/latest/Classes/AmazonAuthUtils.html">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天全站免登陆