blob: c1e91b8f13845215479bc34d5aa404b2b2b97d1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# Kate libsodium Compatibility Tests
This directory contains tests to verify that the `kate` package's `seal` and `open` functions are compatible with the real libsodium implementation.
## Why?
The `kate` library is designed to be CGO-free to avoid the complexity and deployment challenges that come with C dependencies. Rather than requiring applications to link against libsodium, `kate` implements a pure Go version of the NaCl secretbox encryption scheme.
This separate compatibility test project verifies that `kate`'s implementation produces ciphertext that is fully interoperable with libsodium while keeping the CGO dependency isolated from the main package. This way, applications get the benefits of a pure Go library while maintaining confidence in libsodium compatibility.
## Setup
The tests require libsodium to be installed on your system. The project uses the `github.com/jamesruan/sodium` Go bindings for libsodium.
### Installing libsodium
On macOS:
```bash
brew install libsodium
```
On Ubuntu/Debian:
```bash
sudo apt-get install libsodium-dev
```
On CentOS/RHEL:
```bash
sudo yum install libsodium-devel
```
## Running the Tests
```bash
cd compat-test
go test
```
## Test Cases
The test suite includes:
1. **KateEncrypt_LibsodiumDecrypt**: Encrypts data with kate's library and decrypts with libsodium
2. **LibsodiumEncrypt_KateDecrypt**: Encrypts data with libsodium and decrypts with kate's library
|