0

Currently, I am working on an API where only the access key and secret key are available. To access their API I need to generate the signature in algorithm="hmac-sha256.

They have some python code as an example like

response = requests.post('https://' + host + url_path,
                         json=body,
                         auth=HTTPSignatureAuth(algorithm="hmac-sha256",
                                                key=b64decode(key_secret_id),
                                                key_id=key_id,
                                                headers=[
                                                    '(request-target)', 'host',
                                                    'date', 'content-type',
                                                    'content-length'
                                                ]),
                         headers=headers)

But I am trying to access it using java and not getting any good library or suggestion to do same.

It will be very helpful if someone help me or suggest me any solution..

Yuri Schimke
  • 12,435
  • 3
  • 35
  • 69
Zakaria Shahed
  • 2,589
  • 6
  • 23
  • 52
  • 1
    Because of HTTPS, HTTP request signing is today an obsolete technology. As far as I remember is was also used by oAuth v1 (dropped in v2), therefore you may find an implementation in some old oAuth v1 Java libraries. – Robert Aug 09 '21 at 14:44
  • You can take joauth as an example for oauth 1 signing, but it has some twitter specific restrictions, so it may need adaption. https://github.com/twitter/joauth/blob/3aab711e746c155b1a0359c7abb928ffeca2280e/src/main/java/com/twitter/joauth/Signer.java#L73-L109 – Yuri Schimke Aug 10 '21 at 06:24

0 Answers0