Шифрование AES JavaScript [закрывается]

См. Ссылку для обновления кода: https://codesandbox.io/s/mmjvp25z38

  1. Я использовал onFocus, чтобы показать раскрывающийся список
  2. в методе handleSelectedChange и обновленном меню «Открыть винт» через заданное состояние

108
задан Cheeso 1 September 2009 в 02:17
поделиться

5 ответов

JSAES - это мощная реализация AES в JavaScript. http://point-at-infinity.org/jsaes/

65
ответ дан 24 November 2019 в 03:32
поделиться

http://www.movable-type.co.uk/scripts/aes.html библиотека может иметь некоторая помощь.

1
ответ дан 24 November 2019 в 03:32
поделиться

Погуглив "JavaScript AES" , нашел несколько примеров. Первый, который появился, предназначен для объяснения алгоритма, а также для предоставления решения:

Скрипты подвижного типа: AES

12
ответ дан 24 November 2019 в 03:32
поделиться

Here's a demonstration page that uses slowAES.

slowAES was easy to use. Logically designed. Reasonable OO packaging. Supports knobs and levers like IV and Encryption mode. Good compatibility with .NET/C#. The name is tongue-in-cheek; it's called "slow AES" because it's not implemented in C++. But in my tests it was not impractically slow.

It lacks an ECB mode. Also lacks a CTR mode, although you could build one pretty easily given an ECB mode, I guess.

It is solely focused on encryption. A nice complementary class that does RFC2898-compliant password-based key derivation, in Javascript, is available from Anandam. This pair of libraries works well with the analogous .NET classes. Good interop. Though, in contrast to SlowAES, the Javascript PBKDF2 is noticeably slower than the Rfc2898DeriveBytes class when generating keys.

It's not surprising that technically there is good interop, but the key point for me was the model adopted by SlowAES is familiar and easy to use. I found some of the other Javascript libraries for AES to be hard to understand and use. For example, in some of them I couldn't find the place to set the IV, or the mode (CBC, ECB, etc). Things were not where I expected them to be. SlowAES was not like that. The properties were right where I expected them to be. It was easy for me to pick up, having been familiar with the Java and .NET crypto programming models.

Anandam's PBKDF2 was not quite on that level. It supported only a single call to DeriveBytes function, so if you need to derive both a key and an IV from a password, this library won't work, unchanged. Some slight modification, and it is working just fine for that purpose.

EDIT: I put together an example of packaging SlowAES and a modified version of Anandam's PBKDF2 into Windows Script Components. Using this AES with a password-derived key shows good interop with the .NET RijndaelManaged class.

EDIT2: the demo page shows how to use this AES encryption from a web page. Using the same inputs (iv, key, mode, etc) supported in .NET gives you good interop with the .NET Rijndael class. You can do a "view source" to get the javascript for that page.

EDIT3
a late addition: Javascript Cryptography considered harmful. Worth the read.

35
ответ дан 24 November 2019 в 03:32
поделиться

При поиске шифрования AES я нашел это у некоторых студентов Стэндфорда. Утверждает, что он самый быстрый. Поддерживает CCM, OCB, http://crypto.stanford.edu/sjcl/

25
ответ дан 24 November 2019 в 03:32
поделиться
Другие вопросы по тегам:

Похожие вопросы: