Reference implementations of PQC
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # PQ Crypto Catalog
  2. This is a repository of post-quantum schemes copied from either the submission to the NIST Post-Quantum Standardization or [PQClean](https://github.com/PQClean/PQClean) project. The goal of the library is to provide easy to use API which enables quick experimentation with some post-quantum cryptographic schemes.
  3. Users shouldn't expect any level of security provided by this code. The library is not meant to be used on live production systems.
  4. ## Schemes support
  5. | Name | NIST Round | x86 optimized |
  6. |--------------------------|------------|---------------|
  7. | Kyber | 3 | x |
  8. | NTRU | 3 | x |
  9. | SABER | 3 | x |
  10. | FrodoKEM | 3 | |
  11. | NTRU Prime | 3 | x |
  12. | HQC-RMRS | 3 | x |
  13. | Dilithium | 3 | x |
  14. | Falcon | 2 | |
  15. | Rainbow | 3 | |
  16. | SPHINCS+ SHA256/SHAKE256 | 3 | x |
  17. | SIKE/p434 | 3 | x |
  18. ## Building
  19. CMake is used to build the library:
  20. ```bash
  21. mkdir build
  22. cd build
  23. cmake -DCMAKE_BUILD_TYPE=Release ..
  24. make
  25. ```
  26. Build outputs two libraries, a static ``libpqc_s.a`` and dynamic ``libpqc.so``, which can be linked with a project.
  27. ## API
  28. Library provides simple API, wrapping PQClean. For example to use KEM, one should call the library in following way:
  29. ```c
  30. #include <pqc/pqc.h>
  31. std::vector<uint8_t> ct(ciphertext_bsz(p));
  32. std::vector<uint8_t> ss1(shared_secret_bsz(p));
  33. std::vector<uint8_t> ss2(shared_secret_bsz(p));
  34. std::vector<uint8_t> sk(private_key_bsz(p));
  35. std::vector<uint8_t> pk(public_key_bsz(p));
  36. const params_t *p = pqc_kem_alg_by_id(KYBER512);
  37. pqc_keygen(p, pk.data(), sk.data());
  38. pqc_kem_encapsulate(p, ct.data(), ss1.data(), pk.data());
  39. pqc_kem_decapsulate(p, ss2.data(), ct.data(), sk.data());
  40. p = pqc_sig_alg_by_id(DILITHIUM2);
  41. size_t sigsz = sig.capacity();
  42. pqc_keygen(p, pk.data(), sk.data());
  43. pqc_sig_create(p, sig.data(), &sigsz, msg.data(), msg.size(), sk.data());
  44. pqc_sig_verify(p, sig.data(), sig.size(), msg.data(), msg.size(), pk.data());
  45. ```
  46. See test implemetnation in ``test/ut.cpp`` for more details.
  47. ## Rust binding
  48. Rust bindgings are provided in the ``src/rustapi/pqc-sys`` and can be regenerated automatically by running ``cargo build`` in that directory.
  49. ## Testing against Known Answer Tests
  50. Algorithms are tested against KATs, by the Rust-based runner implemented in the ``test/katrunner`` (only verification/decpaulation). The runner uses ``katwalk`` crate for parsing NIST format. To run it:
  51. ```bash
  52. cd test/katrunner
  53. curl http://amongbytes.com/~flowher/permalinks/kat.zip --output kat.zip
  54. unzip kat.zip
  55. cargo run -- --katdir KAT
  56. ```