0

Is It possible to generate HMACSHA1 oauth_signature in java without using OAuthConsumer of signpost library, so it can be easily implemented with other languages like objective-c etc?

Shahab Rauf
  • 3,651
  • 29
  • 38

1 Answers1

2

Yes, since HMACSHA1 is a standard you can write your own implementation.

This is a gist with an example

Here a gist with Objective-c example

Marcel Dias
  • 4,271
  • 1
  • 14
  • 10
  • Thanks for your consideration. can you tell me what would be the data as a parameter in 'calculateRFC2104HMAC()' method in the above first example. I am curious about the parameter 'data'. – Shahab Rauf May 19 '16 at 06:12
  • 1
    The parameter `data` is the message that you want to encrypt. You can take a look [here](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code). This is the [HMAC spec](https://tools.ietf.org/html/rfc2104). But in your code what you need to inform depends of what are you doing. This is a [tutorial](http://oauth1.wp-api.org/docs/basics/Signing.html) of how to sign a request using OAuth1. – Marcel Dias May 19 '16 at 11:29
  • can you please tell me how would i generate signature base string so that can i be sent it as a parameter in method. – Shahab Rauf May 19 '16 at 14:11
  • Could you describe the kind of system are you trying to develop and what service are you trying to connect ? – Marcel Dias May 19 '16 at 17:22
  • I am trying to make request of request_token api using OAuth1.0 – Shahab Rauf May 21 '16 at 07:21
  • Here is the [twitter documentation](https://dev.twitter.com/oauth/reference/post/oauth/request_token) to request the request_token. I hope it will help you – Marcel Dias May 27 '16 at 16:56