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

  • SEARCH
  • Home
  • 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 7835483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:39:19+00:00 2026-06-02T13:39:19+00:00

Spring documentation says that remember me is implemented by storing following information in cookie

  • 0

Spring documentation says that remember me is implemented by storing following information in cookie –

base64(username + “:” + expirationTime + “:” + md5Hex(username + “:” +
expirationTime + “:” password + “:” + key))

I have following confusions –

  1. Why use an unsecure hash like MD5 to digest the information instead of using SHA-1 or SHA-2. Would the performance hit from these be significant for such a small piece of information?

  2. Why transmit this information over the network at all? Why not maintain a map of cryptographically secure random number and this info on the server, returning only the map key as a cookie. AFAIK this is the approach used by Servlet API and is deemed more secure.

  • 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-02T13:39:22+00:00Added an answer on June 2, 2026 at 1:39 pm

    Lets begin with the second question because it is the more relevant one:

    second question “Why transmit the password over the network at all….” answer:

    Because what you described is only the Simple Hash-Based Token Approach

    If you scroll down the page Spring Security Reference: Chapter 10 Remember-Me Authentication you will see that spring security can also use a different remember me approaches: Chapter 10.3 Persistent Token Approach. And this is what you suggested in your second question.


    first question: Short answer to “Would the performance hit from these be significant for such a small piece of information?” – No

    So if you want to use the Simple Hash-Based Token Approach and feel that MD5 is to unsecured, then you can subclass TokenBasedRememberMeService [javadoc] and override the String makeTokenSignature(long tokenExpiryTime, String username, String password) method. For example (untested)

    protected String makeTokenSignature(long tokenExpiryTime, String username, String password) {
        String data = username + ":" + tokenExpiryTime + ":" + password + ":" + getKey();
        MessageDigest digest;
        try {
            digest = MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException("No SHA-256 algorithm available!");
        }
    
        return new String(Hex.encode(digest.digest(data.getBytes())));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The documentation says that camel-spring-ws(v2.7.1) officially supports spring-ws 1.5.9, but doesn't mention spring-ws 2.0.2.RELEASE.
I'm trying to implement my first Spring MVC controller, following Spring documentation, some tutorials
Following the spring-security documentation: http://static.springsource.org/spring-security/site/docs/3.0.x/reference/ldap.html I am trying to set up ldap authentication (very
AS3 documentation says that Strings in AS3 are in UTF-16 format. There is a
I'm trying to make a simple username/password authentication in a Spring Security web app.
When writing a Windows application, the documentation says that some VK_CODEs are displayable characters,
The adobe documentation says that when listening for a keypress event from a phone
Spring documentation says : Use the @RequestParam annotation to bind request parameters to a
Seam Solder documentation says that the @Requires annotation requires an array of Class objects
MySQL documentation says that since 5.0, varchar lengths refer to character units, not bytes.

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.