iPhone and HMAC-SHA-1 encoding

后端 未结 7 1044
忘了有多久
忘了有多久 2020-12-13 01:32

im trying to get a call to amazon web service and im stuck on getting the signature, looked at this but i still have a question on it.

using this example what is th

7条回答
  •  一向
    一向 (楼主)
    2020-12-13 01:56

    // This is my code used in my Twitter connection, and working well for me.
    // KeithF's code was a big help!
    //
    // This is a category added to NSData.
    
    @implementation NSData (EOUtil)
    - (NSData*)dataByHmacSHA1EncryptingWithKey:(NSData*)key
    {   
        void* buffer = malloc(CC_SHA1_DIGEST_LENGTH);
        CCHmac(kCCHmacAlgSHA1, [key bytes], [key length], [self bytes], [self length], buffer);
        return [NSData dataWithBytesNoCopy:buffer length:CC_SHA1_DIGEST_LENGTH freeWhenDone:YES];
    }
    @end
    

提交回复
热议问题