Is Javascript a proper platform for cryptography?

2019-06-22 08:13发布

I noticed a good while back that Wikipedia links to a Javascript implementation of different hash functions. Also found Clipperz Crypto. Even Mozilla implements a crypto object in Firefox.

So, Is Javascript a proper platform for cryptography? Or, can it be?
Or, I suppose.. Are there any purposes or benefits for hashing data before POST?

7条回答
时光不老,我们不散
2楼-- · 2019-06-22 08:24

These blog articles describe valuable uses for cryptography in JavaScript:

For securely identifying yourself:

http://digitalbazaar.com/2010/08/07/webid/

For providing a secure interface to localhost applications w/embedded-servers via a website:

http://digitalbazaar.com/2010/07/20/javascript-tls-1/

http://digitalbazaar.com/2010/07/20/javascript-tls-2/

查看更多
Root(大扎)
3楼-- · 2019-06-22 08:27

I can see at least one use: If you are sending the client encrypted data, then decrypting it in JavaScript based on a key/password that the user enters locally. This presupposes a shared key or a known password that you used to originally encrypt the data at the server. Also, these functions are frequently used by malicious and/or obfuscated JavaScript.

查看更多
迷人小祖宗
4楼-- · 2019-06-22 08:30

You can encrypt data using JavaScript; however I'm not sure about the benefits. Because if you are using, let's say bas64, you need to send the encryption key to the client, and if someone can intercept the encrypted information he/ she would probably be able to intercept the encryption key too.

You should never use this for replacing SSL certificates.

查看更多
爷、活的狠高调
5楼-- · 2019-06-22 08:38

Never ever can you use javascript as a safe platform for transferring secure data ...

But it is possible to make a md5 or other type of encryption client-side, that gives you a reasonably secure way of validation you could test server-side !-)

查看更多
看我几分像从前
6楼-- · 2019-06-22 08:41

The answer depends on what you want to do.

If you want to use cryptography on client side, off-line, persistent web applications then yes. So for example do you want to encrypt all data that is stored in an embedded database using the HTML 5 specifications 'globalStorage()'. Then use javascript crypto, because the likelihood is that you wont have a connection to handle all the crypto on the server side.

If not use the tried and tested methods

查看更多
三岁会撩人
7楼-- · 2019-06-22 08:46

There are uses for hashing functions in Javascript, for example validating captchas client side (by comparing hash in session to computed hash from input). Obviously, the uses are limited since it runs almost exclusively client side (and you can't trust client input), but the potential is there.

查看更多
登录 后发表回答