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

Missing AES-KW #294

Closed
cryptographix opened this issue Jan 2, 2022 · 17 comments
Closed

Missing AES-KW #294

cryptographix opened this issue Jan 2, 2022 · 17 comments

Comments

@cryptographix
Copy link

cryptographix commented Jan 2, 2022

AFAICS, there is currently no implementation of AES-KW. Is that on the roadmap?

The only mention I could find was offer here to submit code for this mode.

@tarcieri
Copy link
Member

tarcieri commented Jan 3, 2022

AES-KW is something of a difficult construction to place within our taxonomy. I wouldn't call it a block cipher in and of itself: rather it is closer to a mode of operation.

We don't have plans to implement it: personally I'd say it was largely obsoleted by AES-SIV and its successor AES-GCM-SIV, both of which we provide crates for.

However, if someone is interested in contributing it, we'd be happy to have an upstream implementation, if we can figure out the proper place to put it.

@cryptographix
Copy link
Author

Hi. AES-KW is one of the last remaining WebCrypto bits missing from Deno, and trying to fill in the gaps in the impl. The problem is, of course, that WebCrypto has not evolved to include newer algs such as AES-SIV, Ed25519 etc.

@dignifiedquire do you still have your implementation, could it be submitted as a PR?

Thanks

@tarcieri
Copy link
Member

tarcieri commented Jan 3, 2022

@jedisct1 has an implementation https://github.com/jedisct1/rust-aes-keywrap

@dignifiedquire
Copy link
Member

I am using the code here, which has some audit done when rpgp was audited. Feel free to take it https://github.com/rpgp/rpgp/blob/master/src/crypto/aes_kw.rs

@dignifiedquire
Copy link
Member

regarding location, either standalone repo or sth like "key-wraps" or "KWs" given the special nature of these kinds of algorithms

@tarcieri
Copy link
Member

tarcieri commented Jan 3, 2022

The problem with a key-wraps repo is the other notable crates we have for this purpose, aes-siv and aes-gcm-siv, are also specified as full-blown AEADs and as such are probably better kept in the current repos.

That said we do have a KDFs repo containing only hkdf so I guess there's precedent.

@cryptographix
Copy link
Author

cryptographix commented Jan 4, 2022

Hi. Just committed a version of @dignifiedquire's code to a personal repo, modified to fit into my initial impression of RustCrypto standards. Repo structure copied from KDF repo and adjusted.

Perhaps you guys could have a look and if ok, decide on a suitable location in RustCrypto org and, if needs be, create a new repo. Then I can submit the code as a PR and we can do some Code Review stuff to ensure compatibility with RustCrypto standards and stuff.

Let me know ...

@tarcieri
Copy link
Member

tarcieri commented Jan 4, 2022

@seanwykes is it private? I can't see it...

@cryptographix
Copy link
Author

cryptographix commented Jan 4, 2022 via email

@tarcieri
Copy link
Member

tarcieri commented Jan 4, 2022

Looks like a start, although there's still some copypasta from HKDF.

If it's okay with @newpavlov I can make a new repo and then you can PR the individual crate so we can review it.

Alternatively we could put it in https://github.com/rustcrypto/block-modes

@cryptographix
Copy link
Author

Great. I'll check out the copy-paste stuff ..

If there's any trait-trickery you want me to impl, pls let me know during CR. (I'm still learning to find my way around RustCrypto ..)

From my point of view, I think it would be very interesting to release an initial crate with Deno-compatible dependencies (aes 0.7.5) to avoid dep upgrades at this point.

@cryptographix
Copy link
Author

Ops. I updated the lib.rs and 'doc-test' code, but not the read-me. Is there an automatic way of generating one from the other, or is it copy-paste?

@tarcieri
Copy link
Member

tarcieri commented Jan 4, 2022

If you're okay with an MSRV of 1.56+ (i.e. a 2021 edition crate), you can use:

#![doc = include_str!("../README.md")]

...to place the contents of README.md into the rustdoc, and also doctest any code examples that appear in the README.

We've moved to doing this in our crates that are MSRV 1.56. Here's an example: https://github.com/RustCrypto/traits/blob/master/kem/src/lib.rs#L1

@cryptographix
Copy link
Author

Just dropped a DRAFT-PR@Deno. Passing all relevant WPT and JOSE tests for AES-KW algorithms.

Thanks @dignifiedquire and @tarcieri for your code and help - once the code lands here, I'll update the PR to the released crate.

@newpavlov
Copy link
Member

@tarcieri
Feel free to create a new repo. I am not sure whether it should be aes-kw or key-wrapps. I lean slightly towards the latter, but only because we have precedent with the KDFs repo.

@tarcieri
Copy link
Member

tarcieri commented Jan 5, 2022

I created a new repo: https://github.com/RustCrypto/key-wraps

@seanwykes can you PR your proposed structure against it?

@newpavlov
Copy link
Member

Going to close this issue, since aes-kw got merged to the key-wraps repo.

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

No branches or pull requests

4 participants