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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:46:51+00:00 2026-06-16T02:46:51+00:00

I am passing an encrypted password through json and a querystring. Lets say for

  • 0

I am passing an encrypted password through json and a querystring. Lets say for examples sake the password is something like: V0VuDF9ITK+A744HD=

When I pass the string through json I use JSON.stringify to stringify the string so it can be used on server.

var request = sb.serverRequest('changePassword', JSON.stringify({username: username, password: credentialsInput.value, original: password}));
request.done(function() {
    var response = JSON.parse(request.responseText);
    if(response.success) {
        console.log('password changed');
    } else {
        setInstructions('That didn\'t work. Please try again.');
    }
    credentialsInput.value = ''; //Clear input
});

However when I try to use the password on the server, it has replaced the + with a space so the new password will be V0VuDF9ITK A744HD= (notice the space in the middle)? How can I pre-parse the string in java so it includes the non letters and digits in the actual string thats passed? It seems to pass the string down to javascript just fine, but i’d prefer to pre-process in java if possible because there are also cases where I will pass the string via querystring.

I use the base64 encoder in java to encrypt so I am not sure if there are any other possibilities that may have to be taken into considering when escaping characters in the string in javascript. It seems = gets passed fine. Are there any other characters this encoding type uses that might become a problem?

P.S. I do not actually do any encrypting in javascript, that is all handled on the server, but in this particular instance I need the encrypted password in javascript because I need to compare it server side…I won’t get into all the boring details. I will however be passing this encrypted password through a querystring as well which I assume will be faulted by a + or an =. How would I pass a string like that in a querystring as well?

UPDATE: The encoding algorthm I use to encrypt passwords is as follows. I may have been mistaken on it being only base64. Is this a safe way to secure passwords?

public static synchronized String encrypt(String plainText) throws RuntimeException {
    MessageDigest md = null;

    try{
        md = MessageDigest.getInstance("SHA");
    }catch(NoSuchAlgorithmException e){
        throw new RuntimeException(e.getMessage());
    }

    try{
        md.update(plainText.getBytes("UTF-8"));
    }catch(UnsupportedEncodingException e){
        throw new RuntimeException(e.getMessage());
    }

    byte raw[] = md.digest();
    String hash = (new BASE64Encoder().encode(raw));
    return hash;
}
  • 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-16T02:46:53+00:00Added an answer on June 16, 2026 at 2:46 am

    To make a string safe for passing through a URL, use encodeURIComponent(your_string_here)

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

Sidebar

Related Questions

I am passing an encrypted URL string: Default.aspx?S3tLlnIKKzE%3d I want to pass that URL
Passing beginning date and final date as parameter through the following code as no
I have encrypted .class files and would like to jar them so that I
When passing symetrically encrypted data in a URL or possibly storing encrypted data in
I have a rest service that requires passing an encrypted key as part of
Passing User defined argument to RPM is possible while installing?. for example: ~>rpm -i
passing post data using cURL requires that the name of the input. However, I
Passing in an Expression to a Linq query behaves differently depending on syntax used,
When passing a date from datepicker to sort an excel table, somewhere the format
when passing parameters after index.php its showing 404 error .. its apache error not

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.