diegoaguilar
diegoaguilar

Reputation: 8376

How to get a password encrypted since the Java Script file in my web application?

I'm designing some code for a standard login in a web application, I consider that doing the password encryption on client side is better than making mongo server doing it.

So, if I have this code ...

$("#btnSignUp").click( function () {

        var sign = {

            user:$("#signUser").val(),
            pass:$("#signPass").val()
        };

    });

And then I'd do a post of sign with the password value already encrypted, how could I achieve this? Does JavaScript support AES?

Upvotes: 0

Views: 205

Answers (3)

backtrack
backtrack

Reputation: 8144

I'd recommend using AES encryption in your JavaScript code. See Javascript AES encryption for libraries and links. The trouble you'll have is picking a key that is only available on the client side. Perhaps you can prompt the user? Or hash together some client system information that's not sent to the server.

kindly refer this link

http://point-at-infinity.org/jsaes/

AES_Init();

var block = new Array(16);
for(var i = 0; i < 16; i++)
  block[i] = 0x11 * i;

var key = new Array(32);
for(var i = 0; i < 32; i++)
  key[i] = i;

AES_ExpandKey(key);
AES_Encrypt(block, key);

AES_Done();

Upvotes: 1

TGH
TGH

Reputation: 39258

You should submit the login page over https and make use of certificates to do the encryption. JavaScript is never a good idea for things that need security since you can control/influence the execution of it using developer tools built into most browsers

Upvotes: 2

smk
smk

Reputation: 5842

There are many libraries available for javascript to encrypt your data. Check out http://crypto.stanford.edu/sjcl/

Upvotes: 1

Related Questions