Commit Graph

19 Commits (6cbde7894ab9633aff43e816a84d3188c4f079b2)

Author SHA1 Message Date
lilia 1ad898a62e Simplify webcrypto type conversion
Previously we'd get a WordArray and convert to string before converting
to array buffer. Instead, go directly to array buffer.
11 years ago
lilia e190582d9e Build CryptoJS components into webcrypto.js
We only depend on cryptojs for this webcrypto polyfill, so let Grunt
concatenate them into one file.

The reference in the getString helper isn't needed since we use the
built in string converters on CryptoJS's word arrays.
11 years ago
lilia 9f676af9bb Refactor crypto.js and native client interface
NB: this diff is best viewed with --ignore-whitespace

Distills crypto.js down to the hard cryptoey bones. It pulls from
webcrypto for aes and hmac, and from native client for curve25519 stuff
or potentially another object implementing the handful of needed
curve25519 functions.

Everything else formerly known as crypto, including session storage and
management, axolotl, etc.. is now protocol.js. The separation is not
quite perfect, but it's a big step.

nativeclient.js now enables talking to the native client module through
a high level interface as well as registering callbacks that will be
executed once the module is loaded. And it has tests!

Finally, this commit removes all references to the "testing_only"
object, preferring to run tests on textsecure.crypto instead.
11 years ago
lilia 6e3014895b Fix cryptojs hmac implementation
Apparently the bowerized version of cryptojs's WordArray.create doesn't
handle arraybuffers correctly.
11 years ago
lilia 39505c81b1 Finish up webcrypto integration, Fixes #72
We now correctly and opportunistically use the webcrypto API if
available, polyfilling if it's not detected. This change also includes a
layer of abstraction over the webcrypto interface so we no longer have
to deal with key-imports or algorithm names all over the place. Since we
no longer support AES-CTR, code outside this file can simply call
`textsecure.subtle.<encrypt|decrypt|sign>(key, data [, iv])`.
11 years ago
lilia 244e051fc3 Add importKey to webcrypto.js 11 years ago
Matt Corallo 2e7b5b46e3 Remove AES-CTR entirely 11 years ago
Matt Corallo 3a39602385 Fix borked spacing in webcrypto.js 11 years ago
Matt Corallo 68a42a6ae7 Give up on webcrypto :( 11 years ago
lilia e07759a93c Fix CBC encryption, test 11 years ago
lilia 674b173c59 Add support for cbc encryption 11 years ago
lilia 4675cdf3f2 Webcrypto won't go down without a fight
Turns out that assigning a new object to window.crypto.subtle
is not so easy. That's probably a good thing.
11 years ago
lilia a4b25f7df1 Disable the real webcrypto
Sadly, we are not quite compliant with the WC3 webcrypto spec
due to our insistance on passing around key data in plain old
ArrayBuffers.

Also converted whitespace.
11 years ago
Matt Corallo 68131a6e2a Add human readable version of errors 11 years ago
Marco 14ebef70cb fixed 'TypeError: Promise.resolve is not a constructor' in Firefox 11 years ago
Matt Corallo 8d408e6d8f THOUGH SALL USE TABSTOP AND SHIFTWIDTH 4 (so that indents read right) 11 years ago
Matt Corallo 5583e82a20 Refactor some low-level crypto things 11 years ago
Matt Corallo 3fffbad11a Fix now-broken test cases and change lots of things over to promises 11 years ago
lilia 41d50d7480 Lilia's Webcrypto branch rebased and a few very tiny tweaks 11 years ago