Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:40:13+00:00 2026-06-05T14:40:13+00:00

I’ve been reading this: http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/ It’s been a really great article. One problem I’m

  • 0

I’ve been reading this: http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/

It’s been a really great article. One problem I’m having in my thinking is with this step (in the second half of the article):

4. (OPTIONAL) The only way to protect against “replay attacks” on your API is to include a timestamp of time kind along with the request so the server can decide if this is an “old” request, and deny it. The timestamp must be included into the HMAC generation (effectively stamping a created-on time on the hash) in addition to being checked “within acceptable bounds” on the server.
5. [SERVER] Receive all the data from the client.
6. [SERVER] (see OPTIONAL) Compare the current server’s timestamp to the timestamp the client sent. Make sure the difference between the two timestamps it within an acceptable time limit (5-15mins maybe) to hinder replay attacks.

If a timestamp must be sent, this means it must be in both the hash on the client and the server, so the same exact time must be used. Now, this means that I must send the date as plain text or encrypted, possibly as a header value. Is this correct? Because if it’s plain, then couldn’t a replay attacker easily modify the date to within an acceptable range (for validation purposes)… So we could encrypt the date, but that would mean both hash and encrypted data is in play, instead of just encrypting all of the data together.

Is my assessment correct, or is there a way to include a date that’s secure? Or must it be encrypted in this scenario?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:40:15+00:00Added an answer on June 5, 2026 at 2:40 pm

    A HMAC is a message auhentication code. This means if you have some message M you can generate V = HMAC(M, K) with the message and your secret key K. Keep in mind that as long as you keep K secret, noone else will be able to generate the same V except through trying to guess K. This is infeasible if K is big enough.

    This also means that everything you include in M cannot be changed without V changing as well, since both M and K are used in the HMAC. So if you include a timestamp, you have to make sure it is included in the HMAC calculation. If an attacker would try to modify the timestamp, the V generated by the HMAC would be different -> you can detect the attempt and discard the request.

    A HMAC gives you “Authenticity”, meaning you can tell if it came from someone knowing the secret key. Encryption is something different: it gives you “Confidentiality” meaning noone can read the message without knowing the secret key. It is important to keep in mind that encryption does NOT give you authenticity, since an attacker could just change a random bit in the encrypted message. To have both confidentiality and authenticity, you have to use a HMAC as well as encryption.

    If you do not need confidentiality, do not encrypt your data, as it would waste CPU cycles and make your system more complicated without gaining anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.