|
1 | | -# practical_cryptography_engineering |
2 | | -Practical cryptography code examples using libsodium and mbedtls C libraries and Python cryptography module |
| 1 | +Practical Cryptography Engineering |
| 2 | +================================== |
| 3 | +This repository contains some practical code examples of using the following cryptograpy libraries: |
| 4 | +* [libsodium](https://github.com/jedisct1/libsodium) |
| 5 | + * A modern, portable, easy to use crypto library written in C |
| 6 | + * Focuses on providing a small number of high-quality, easy-to-use cryptographic primitives |
| 7 | +* [mbedTLS](https://github.com/ARMmbed/mbedtls) |
| 8 | + * An ultra-portable crypto library written in C which should build anywhere |
| 9 | + * Provides a wide range of cryptographic primitives |
| 10 | +* [cryptography](https://github.com/pyca/cryptography) |
| 11 | + * Python's "standard" cryptographic library which is a wrapper around [OpenSSL](https://www.openssl.org) |
| 12 | + * Provides almost all cryptographic primitives you would want in Python |
| 13 | +* [PyNaCl](https://github.com/pyca/pynacl) |
| 14 | + * Python bindings for libsodium (very partial wrapper around libsodium) |
| 15 | + * Provides a few nice cryptographic primitives not currently available in the cryptography module |
| 16 | + |
| 17 | + |
| 18 | +File Contents |
| 19 | +============= |
| 20 | +* aes_gcm.c |
| 21 | + * Simple self-contained C code example of using AES-256 in Galois Counter Mode (GCM) using hard-coded everything |
| 22 | +* aes_gcm_cryptography.py |
| 23 | + * Simple self-contained Python code example identical to the above |
| 24 | +* aesgcm_file.c |
| 25 | + * C code example of file-based AES-256 GCM, works with aesgcm_file.py |
| 26 | + * Takes arguments on command line and produces output to file |
| 27 | +* aesgcm_file.py |
| 28 | + * Python code example of file-based ASES-256 GCM, works with aesgcm_file.c |
| 29 | +* CMakeLists.txt |
| 30 | + * CMake file for building the mbedTLS C code projects |
| 31 | +* ecdh.c |
| 32 | + * Elliptic Curve Diffie-Hellman key exchange C code example |
| 33 | +* ecdh.py |
| 34 | + * Elliptic Curve Diffie-Hellman key exchange Python code example |
| 35 | +* kdf.c |
| 36 | + * Key Derivation Function (KDF) C code example |
| 37 | +* kdf.py |
| 38 | + * Key Derivation Function (KDF) Python code example |
| 39 | +* mbedtls |
| 40 | + * Directory containing the mbedTLS C code |
| 41 | +* rsa_signature.c |
| 42 | + * RSA Signature C code example |
| 43 | +* rsa_signature.py |
| 44 | + * RSA Signature Python code example |
| 45 | +* sodium |
| 46 | + * Directory containing libsodium examples, headers, and Windows pre-compiled library |
| 47 | + |
| 48 | + |
| 49 | +Building |
| 50 | +======== |
| 51 | + |
| 52 | +Build requires CMake and platform default C compiler installed and works on both Windows, macOS, and Linux. |
| 53 | + |
| 54 | +The first stage of building is the same on all platforms: |
| 55 | + |
| 56 | +```bash |
| 57 | +rm -rf build |
| 58 | +mkdir build |
| 59 | +cd build |
| 60 | +cmake .. |
| 61 | +``` |
| 62 | + |
| 63 | +The second stage of building is platform dependent ... |
| 64 | + |
| 65 | +Linux or macOS |
| 66 | +-------------- |
| 67 | +```bash |
| 68 | +make |
| 69 | +``` |
| 70 | + |
| 71 | +This produces the following executable files directly in the **build** directory: |
| 72 | + |
| 73 | +* aes_gcm |
| 74 | +* aesgcm_file |
| 75 | +* ecdh |
| 76 | +* kdf |
| 77 | +* rsa_signature |
| 78 | + |
| 79 | +Windows |
| 80 | +------- |
| 81 | +```bash |
| 82 | +devenv mbed_AES.sln /build Debug |
| 83 | +``` |
| 84 | +This creates the following executable files under the **build\Debug** directory: |
| 85 | + |
| 86 | +* aes_gcm.exe |
| 87 | +* aesgcm_file.exe |
| 88 | +* ecdh.exe |
| 89 | +* kdf.exe |
| 90 | +* rsa_signature.exe |
| 91 | + |
| 92 | + |
| 93 | +Where to learn more about cryptography |
| 94 | +====================================== |
| 95 | + |
| 96 | +Books |
| 97 | +----- |
| 98 | + |
| 99 | +* Understading Cryptography |
| 100 | +* Cryptograpy Engineering |
| 101 | + |
| 102 | +Online Courses |
| 103 | +-------------- |
| 104 | + |
| 105 | +* Coursera |
| 106 | +* Udacity |
0 commit comments