Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

AES Interop #29

Merged
merged 2 commits into from
Nov 11, 2016
Merged

AES Interop #29

merged 2 commits into from
Nov 11, 2016

Conversation

dignifiedquire
Copy link
Member

@dignifiedquire dignifiedquire commented Nov 10, 2016

Challenge: Ensure three implementations of AES CTR 128 and AES CTR 256 work the same.

General Spec: NIST SP 800-38A

Implementations:

1. SubtleCrypto

2. Node.js crypto module

3. golang

Generating Fixtures

Current State

  • Node.js & go generate the same results, after multiple encryptions
  • webcrypto generates a different result after the first round, indicating the counter increments and/or reuse are different.

Due to the design of `AES-CTR` in the webcrypto spec, there
is no streaming mode provided. This results in the counter
not being reused between subsequent calls to `encrypt` or
`decrypt`. As both the node.js and the go implementation rely
on this webcrypto had to be replaced.
@dignifiedquire dignifiedquire changed the title [WIP] AES Interop AES Interop Nov 10, 2016
@dignifiedquire
Copy link
Member Author

dignifiedquire commented Nov 10, 2016

Due to the design of AES-CTR in the webcrypto spec, there
is no streaming mode provided. This results in the counter
not being reused between subsequent calls to encrypt or
decrypt. As both the node.js and the go implementation rely
on this webcrypto had to be replaced.

@dignifiedquire
Copy link
Member Author

@diasdavid this is passing and ready for review and merge

@daviddias
Copy link
Member

So, there is no streaming mode in AES-CTR? Then it is just AES-ECB. Having it being a stream, something you can add more that to encrypt making every encrypted block dependent on the previous, is one of the things that gives strength to AES encryption, that is why AES-ECB is not used at all anymore (or should not).

This must be a bug in WebCrypto (or somewhere along the way), have you seen this: https://github.com/diafygi/webcrypto-examples#aes-ctr---encrypt?

Thank you for coming up with an alternative solution though :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants