Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Encryptoglyph is an open-source encryption-at-rest library and self-hosted servi

## Features

- **XChaCha20-Poly1305 AEAD.** New ciphertext uses a 192-bit nonce and a 256-bit key. The header carries a version, an algorithm id, and a key id. Legacy AES-256-GCM envelopes still decrypt, and `rewrap` upgrades them. Rust (`crates/encryptoglyph`) and Python (`api/eg_crypto`) share the wire format and the vectors in `testvectors/envelope.json`.
- **XChaCha20-Poly1305 AEAD.** New ciphertext uses a 192-bit nonce and a 256-bit key. The header carries a version, an algorithm id, and a key id. Legacy AES-256-GCM envelopes still decrypt, and `rewrap` upgrades them. Rust (`crates/encryptoglyph`), Python (`api/eg_crypto`), and Go (`bindings/go`) share the wire format and the vectors in `testvectors/envelope.json`.
- **Key custody.** The compose file runs OpenBao on an internal network for Transit keys and KV. The library itself has no escrow key and no master override. Root keys are 32 bytes, derived with HKDF-SHA256 per tenant, purpose, and algorithm, or from a password with Argon2id. The console and `/v1` sidecar do not call OpenBao. The custody design is in [docs/plan.md](docs/plan.md) and [docs/SECURITY-HARDENING.md](docs/SECURITY-HARDENING.md).
- **Encrypted backup.** `restic/rest-server` sits on the same internal network as the backup target. Host ports are not published. Backup scheduling and restore evidence are described in the plan and are not implemented in this tree.
- **Console.** `console/` is the operator UI, served by the API at `/`. It seals fields, rotates and shreds keys, and runs a deterministic assistant. OpenBao and restic stay unwired until a deployment supplies them. The compose service builds the same image as the API.
Expand Down Expand Up @@ -137,6 +137,29 @@ cd crates/encryptoglyph
cargo test --locked
```

### Go

`bindings/go` matches the Rust wire format using `golang.org/x/crypto` (XChaCha20-Poly1305, HKDF-SHA256, Argon2id). `Encrypt` writes version 3. `Decrypt` still opens version 2 and legacy AES-256-GCM version 1. `Rewrap` writes a fresh version-3 blob.

```bash
cd bindings/go
go test -count=1
```

```go
import "github.com/GoDeskio/Encryptoglyph/bindings/go"

kr, err := encryptoglyph.NewKeyring("k1", key)
ctx := encryptoglyph.RecordContext{
Tenant: "acme", Purpose: "field", Table: "customers",
RecordID: "42", Field: "email", SchemaVersion: 1,
}
blob, err := encryptoglyph.Encrypt(kr, ctx, []byte("ada@example.com"))
plain, err := encryptoglyph.Decrypt(kr, ctx, blob, encryptoglyph.VersionLegacy)
```

Module path: `github.com/GoDeskio/Encryptoglyph/bindings/go`.

### Python

`api/eg_crypto` matches the Rust wire format. Tests run it directly. The API container image does not copy this package.
Expand Down
7 changes: 7 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ Encryptoglyph runs the following third-party software unmodified. Attribute them
- License: MIT
- Source: https://git.distrust.co/public/blahaj

## golang.org/x/crypto

- Project: Go cryptography packages
- Use: Go envelope (`bindings/go`) for XChaCha20-Poly1305, HKDF-SHA256, and Argon2id
- License: BSD 3-Clause License
- Source: https://cs.opensource.google/go/x/crypto

## FastAPI

- Project: FastAPI
Expand Down
48 changes: 48 additions & 0 deletions bindings/go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# bindings/go

Go package for the Encryptoglyph envelope. Wire-compatible with `crates/encryptoglyph` and `api/eg_crypto`.

Primitives, all from `golang.org/x/crypto` or the Go standard library:

- XChaCha20-Poly1305 (`golang.org/x/crypto/chacha20poly1305`)
- AES-256-GCM for legacy version-1 decrypt (`crypto/aes`, `crypto/cipher`)
- HKDF-SHA256 (`golang.org/x/crypto/hkdf`)
- Argon2id (`golang.org/x/crypto/argon2`), m = 256 MiB, t = 3, p = 1

`Encrypt` writes version 3. `Decrypt` accepts version 3, version 2, and legacy version 1. `Rewrap` writes a fresh version-3 blob under the current key id.

## Install

```bash
go get github.com/GoDeskio/Encryptoglyph/bindings/go@<commit>
```

Until that commit is the version you depend on, a replace directive points at a checkout:

```
require github.com/GoDeskio/Encryptoglyph/bindings/go v0.0.0
replace github.com/GoDeskio/Encryptoglyph/bindings/go => ../Encryptoglyph/bindings/go
```

## Seal a credential

The 32-byte root key stays outside the repo.

```go
kr, err := encryptoglyph.NewKeyring("k1", rootKey)
ctx := encryptoglyph.RecordContext{
Tenant: "railyard", Purpose: "credential", Table: "connections",
RecordID: id, Field: "secret", SchemaVersion: 1,
}
blob, err := encryptoglyph.Encrypt(kr, ctx, secret)
plain, err := encryptoglyph.Decrypt(kr, ctx, blob, encryptoglyph.VersionLegacy)
```

## Tests

```bash
cd bindings/go
go test -count=1
```

The tests decrypt `testvectors/envelope.json` and reseal the version-3 known answer.
Loading
Loading