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 ML-KEM post-quantum key agreement to _CryptoExtras #314

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

fpseverino
Copy link
Contributor

Add support for ML-KEM post-quantum key encapsulation mechanism inside _CryptoExtras.

Checklist

  • I've run tests to see all new and existing tests pass
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

If you've made changes to gyb files

  • I've run .script/generate_boilerplate_files_with_gyb and included updated generated files in a commit of this pull request

Motivation:

With the advent of quantum computing, the mathematical foundations on which the cryptographic protocols in use today are based have been questioned, as they can easily be circumvented and violated by quantum computers.

While waiting for the creation of quantum computers that work at full capacity, and to protect network communications from "Harvest Now, Decrypt Later" attacks, the cryptographic community is working on post-quantum cryptography algorithms, which work on the traditional computers we use today, but are resistant to future attacks by quantum computers.

One of these algorithms is ML-KEM (AKA Kyber), a module lattice-based key encapsulation mechanism standardized by NIST in FIPS 203, that is available inside BoringSSL.

By including ML-KEM inside Swift Crypto, we can get closer to normalizing quantum secure algorithms and start implementing them into our apps and libraries to make them quantum-proof.

Modifications:

Added MLKEM768 and MLKEM1024 enums (generated with gyb) inside the _CryptoExtras module with corresponding PrivateKey and PublicKey structs that use BoringSSL methods to decapsulate and encapsulate ML-KEM-768 and ML-KEM-1024 ciphertexts, with the code style of other KEMs in the library (they also conform to KEMPrivateKey and KEMPublicKey protocols).

Result:

ML-KEM key agreements can be handled with Swift Crypto.

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.

1 participant