You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
преди 5 години
преди 3 години
преди 3 години
преди 1 година
преди 3 години
преди 3 години
преди 2 години
преди 2 години
преди 2 години
преди 2 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # PQ Crypto Catalog
  2. Implementation of quantum-safe signature and KEM schemes submitted to NIST PQC Standardization Process.
  3. The goal is to provide an easy-to-use API in C and Rust to enable experimentation. The code is derived from the submission to the NIST Post-Quantum Standardization, either directly or by leveraging [PQClean](https://github.com/PQClean/PQClean) project.
  4. Users shouldn't expect any level of security provided by this code. The library is not meant to be used on production systems.
  5. ## Supported schemes
  6. All schemes selected by NIST duing PQC standardization:
  7. | Name | x86 optimized |
  8. |--------------------------|------------|
  9. | Kyber | x |
  10. | Dilithium | x |
  11. | Falcon | |
  12. | SPHINCS+ SHA256/SHAKE256 | x |
  13. KEM candidates for an additional round 4.
  14. | Name | x86 optimized |
  15. |--------------------------|------------|
  16. | HQC-RMRS | x |
  17. | McEliece | |
  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. const params_t *p = pqc_kem_alg_by_id(KYBER512);
  32. std::vector<uint8_t> ct(ciphertext_bsz(p));
  33. std::vector<uint8_t> ss1(shared_secret_bsz(p));
  34. std::vector<uint8_t> ss2(shared_secret_bsz(p));
  35. std::vector<uint8_t> sk(private_key_bsz(p));
  36. std::vector<uint8_t> pk(public_key_bsz(p));
  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. ```