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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:12:49+00:00 2026-06-08T19:12:49+00:00

With the same IV,key,iteration and salt as input, is everytime the generated PBEKeySpec the

  • 0

With the same IV,key,iteration and salt as input, is everytime the generated PBEKeySpec the same? That is:

SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEWithSHA256And256BitAES-CBC-BC");
KeySpec spec = new PBEKeySpec(secureKey.toCharArray(), SALT.getBytes(), KEY_ITERATION, KEY_LENGTH);
SecretKey tmp = factory.generateSecret(spec);
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), "AES");

Would I get the same SecretKey every time?
I just fear when user start the program next time, the SecretKey object is changed and cannot used to decrypt the value.

  • 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-08T19:12:50+00:00Added an answer on June 8, 2026 at 7:12 pm

    Yes. It will continue to produce the same key given the same inputs as long as the inputs and the algorithm are fixed as you specified in the question. You should be able to test this by just running your code in a loop and printing each time through

    System.out.println(Arrays.toString(secret.getEncoded));
    

    Moreover, the API specifies an immutable object except for the password. For the password (a char[]) the API specifies that the user may overwrite the value after the PBE operation.

    Note that in principle classes derived from SecretKeySpec could implement a mutable interface. It would be extremely unlikely that SecretKeySpec is extended, mutable and that the keyfactory class or any other would alter the contents however.

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

Sidebar

Related Questions

How do I add more then one object for the same key? is that
I have a class that contains two sets. They both contain the same key
I have a table containing primary key and foreign key that references same table.
I am trying to test PBE encryption/decryption. I found that PBE generates same key
Dictionary cannot have two values with same key. please tell which logic/algorithm being used
Are all emit() s of the same key guaranteed to be sent to a
I have seen the related question here: An object with the same key already
I have a function which repeatedly indexes into a dictionary with the same key.
There is the same question listed under The key 'UserID' does not exist in
I'm trying to do the same as Get the key corresponding to the minimum

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.