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 7827719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:00:40+00:00 2026-06-02T10:00:40+00:00

I am building a secure system, that must be sure, that the user sending

  • 0

I am building a secure system, that must be sure, that the user sending it messages is the same that received an access key. Example.

User Bob, has a property uniqueCode, that is unique just to him, and would enable him to receive various information from the server.

There is a web service, that has various methods for returning various sensitive data. When a client the user is using first connects to the web service, it does so via authenticate method, that

  1. generates a pseudo random key for this user
  2. saves that key on the server and returns it to the user.

Each subsequent request from the client to the WS requires the uniqueCode and the key. If the pair is valid, the request returns the needed information. If there has been no activity for x minutes, the key is invalidated, and the client asks the user to log in again.

Now my question is, how to store the key on the server? The key would be a Java object, that could be serialized.

My options

  • Keep them in a session. This is what a senior programmer at the company suggested, but that doesn’t seem to be the way to go. Everywhere I read, the suggest that WS should not rely on underlying HTTP sessions.
  • Keep them in a database. A possible solution, but that would require me to create a specific database, adding a whole another level to the problem.
  • Keep them in binary encrypted files. This one seems the way to go, but is it? Since I would generate a key upon login, I could save the key+some info in a binary file, encrypt it by itself, and the pass it to the user. If the key I receive back can decipher the users file, and the information is correct, return the information the user requested.

Is my thinking correct, or am I missing something? I reckon that the last one would be the safest way to go, since if someone gains access to my system, breaking into db would be easy, but deciphering a file without knowing another users key would be quite tough.

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-02T10:00:41+00:00Added an answer on June 2, 2026 at 10:00 am

    Do you need to persist the the key, so that it is available after server restart?

    If yes, then you do have to go with keeping the keys in database, or on the file system, or some other mechanism that works for you. I would go with the database – that way you don’t rely on the filesystem in case you move your application, change permissions, etc.

    If no, why not just use some cache with Time To Live inside your app? Just use uniqueCode as key, and the encryption key as value. Popular options would be:

    • Ehcache
    • Guava Caches
    • If you don’t mind cleaning old sessions manually on time, a plain old HashMap could do.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a system that need to collect some user sensitive data via secured
I am building a suite of batch jobs that require regular access to a
I'm building a site that has one authentication system for both general users and
I am building a system that allows for an entry into the database (think
I am building a system where some users have access to certain pieces of
I am building an rails app and I want to secure the user's downloads.
I am building a site that requires a simple authentication system to sit on
I'm building a web app that needs to work offline. The system is built
I'm building an Azure-hosted WCF service that I'd like to secure with ACS using
We are building a service that uses location-based pricing. The user can input an

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.