@@ -93,6 +93,81 @@ use the cryptography module.
93
93
Building
94
94
========
95
95
96
+ libsodium C examples
97
+ --------------------
98
+
99
+ The [ libsodium] ( https://download.libsodium.org/doc/ ) C code examples are all in the ** sodium** directory and can be
100
+ built using the [ Cmake] ( https://cmake.org ) cross-platform build tool along with your platform default C compiler
101
+ installed on Windows, macOS, or Linux.
102
+
103
+ The first stage of building is the same on all platforms:
104
+
105
+ ``` bash
106
+ cd sodium
107
+ rm -rf build
108
+ mkdir build
109
+ cd build
110
+ cmake ..
111
+ ```
112
+
113
+ The second stage of building is platform dependent and will create the following executable files:
114
+
115
+ * hello_sodium
116
+ * nacl_keygen
117
+ * nacl_sign
118
+ * nacl_verify
119
+ * symmetric_decrypt
120
+ * symmetric_encrypt
121
+ * symmetric_keygen
122
+ * test_ed25519
123
+ * test_pynacl_compatibility
124
+
125
+ ### Linux or macOS
126
+ ``` bash
127
+ make
128
+ ```
129
+
130
+ This produces the executable files directly in the ** build** directory.
131
+
132
+ ### Windows
133
+ ``` bash
134
+ devenv hello_sodium.sln /build Debug
135
+ ```
136
+ This creates the executable files under the ** build\Debug** directory.
137
+
138
+ Python examples
139
+ ---------------
140
+
141
+ The Python examples are located in the root directory and should work with Python 3.4 or newer. The Python examples
142
+ require a mix of the following Python packages:
143
+
144
+ * [ cryptography] ( https://cryptography.io/en/latest/ ) - high-level wrapper around [ OpenSSL] ( https://www.openssl.org )
145
+ * [ pynacl] ( https://pynacl.readthedocs.io/en/stable/ ) - Python binding to [ libsodium] ( https://libsodium.org )
146
+ * [ colorama] ( https://github.com/tartley/colorama ) - cross-platform colored terminal text
147
+
148
+ The required dependencies can easily be installed using [ Pipenv] ( https://github.com/pypa/pipenv ) :
149
+ ``` shell script
150
+ pipenv install
151
+ ```
152
+
153
+ Then a shell using the underlying virtual environment can be entered with:
154
+ ``` shell script
155
+ pipenv shell
156
+ ```
157
+
158
+ Inside that Pipenv shell, any of the examples can be ran directly. e.g.:
159
+ ``` shell script
160
+ python ./aes_gcm_cryptography.py
161
+ ```
162
+
163
+ The Python examples are intended to interoperate with either the libsodium or mbedTLS C code examples. Thus encryption
164
+ or signing can be done in C and decryption or verifying can be done in Python or vice versa.
165
+
166
+ mbedtls C examples
167
+ ------------------
168
+ The [ mbedTLS] ( https://github.com/ARMmbed/mbedtls ) C code examples are located in the root directory and build mbedTLS
169
+ from source from the ** mbedtls** directory.
170
+
96
171
Build requires CMake and platform default C compiler installed and works on both Windows, macOS, and Linux.
97
172
98
173
The first stage of building is the same on all platforms:
@@ -106,8 +181,7 @@ cmake ..
106
181
107
182
The second stage of building is platform dependent ...
108
183
109
- Linux or macOS
110
- --------------
184
+ ### Linux or macOS
111
185
``` bash
112
186
make
113
187
```
@@ -120,8 +194,7 @@ This produces the following executable files directly in the **build** directory
120
194
* kdf
121
195
* rsa_signature
122
196
123
- Windows
124
- -------
197
+ ### Windows
125
198
``` bash
126
199
devenv mbed_AES.sln /build Debug
127
200
```
0 commit comments