Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Web Crypto API tests and test vectors #34

Closed
wants to merge 13 commits into from
Closed

Add Web Crypto API tests and test vectors #34

wants to merge 13 commits into from

Conversation

tienthanh411
Copy link
Contributor

No description provided.

cryptosubtlety and others added 13 commits July 21, 2017 18:32
We use Sagemath for elliptic curve.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158512195
We use Sagemath's elliptic curve.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158512865
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158544445
- Refactor the code to make it more clear.
- The code is able to run on Chrome, Firefox, and Microsoft Edge now. It cannot run on IE because IE only supports older version of Web Crypto API (the 2014's version).

Some notes for MS Edge:
- Doesn't support ECDSA.
- Doesn't support SHA-1.
- For AES-GCM, IV's length must be 96 bits and the message's length and aad's length must be not 0.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159232933
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=159454989
Also remove some logging lines that were left on some files.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161089409
With our test vectors, no exception should be thrown during RSA and ECDSA signature verification and AES-GCM encryption.
I also changed the code from using fail() when the test fails to using reject(). It is a more proper way of dealing with asynchronous test cases.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161210264
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161677807
I modified Daniel's scripts in experimental folder to generate ECDH test vectors.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161969143
Move init into the loop. (#32)

The current code fails to initialize the cipher c after a c.doFinal()
fails. According to JCE documentation, a cipher is in an undefined state
after throwing an exception.

-------------
Release a few more bugs. (#33)

-------------
Add tests for partially-overlapping input/output buffers (#29)

update/doFinal are required to be "copy-safe". From the javadoc:

    Note: this method should be copy-safe, which means the input and output
    buffers can reference the same block of memory and no unprocessed input
    data is overwritten when the result is copied into the output buffer.

However many implementations of JCE methods do not implement this property in
all cases. Notably, BouncyCastle fails this test on arrays, and the built-in
OpenJDK providers fail when the input bytebuffer is either a read-only
array-backed byte buffer, or if the buffers are direct buffers. For SunJCE,
this has been acknowledged publicly by Oracle at
https://bugs.openjdk.java.net/browse/JDK-8181386 .

These new tests verify correct overlapping buffer handling for AES/GCM
specifically; as future work, it would be good to generalize these tests for
other ciphers and modes.

-------------
Created by MOE: https://github.com/google/moe

MOE_MIGRATED_REVID=730842ac8c39be6080a867bbfd163fae660c5248

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162496072
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162749326
…cript files.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162786781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants