cryptocap

package
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cryptocap is the bridge from GopherTrunk's live decoders to the offline cryptolab toolkit. The voice composer already extracts each encrypted P25 call's Message Indicator (the per-superframe IV), algorithm id, and key id, and recovers the encrypted voice frames; this package captures those as a JSONL artifact that `gophertrunk cryptolab ks reuse/mtp` consumes directly.

The captured artifact feeds `gophertrunk cryptolab assess`, the security-test harness that attempts to break the encryption offline by every applicable method (keystream reuse, known-plaintext recovery, default/weak keys against the real ADP/DES/AES ciphers, keystream-LFSR prediction) and grades the deployment's resistance. This package itself only records the encrypted frames and their IVs; the decryption attempts run later, offline, in the assess harness.

The Sink interface lives here (a small leaf package) so the composer can depend on it without importing the optional, build-tagged cryptolab tree, and so the file writer is always compiled and unit-tested regardless of build tags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWriter

type FileWriter struct {
	// contains filtered or unexported fields
}

FileWriter is a goroutine-safe Sink that appends one JSON line per frame to a file. It is the concrete sink the daemon wires in when recordings.crypto_capture_path is set.

func NewFileWriter

func NewFileWriter(path string) (*FileWriter, error)

NewFileWriter opens (creating or appending to) path for capture.

func (*FileWriter) Close

func (fw *FileWriter) Close() error

Close flushes and closes the underlying file. Idempotent-safe to call once.

func (*FileWriter) WriteCryptoFrame

func (fw *FileWriter) WriteCryptoFrame(fr Frame)

WriteCryptoFrame appends one record. A frame with no IV or no ciphertext is dropped — without both there is nothing for keystream-reuse analysis to use. Errors are intentionally swallowed (best-effort capture must never disturb the live voice path); the writer flushes on Close.

type Frame

type Frame struct {
	System   string
	Protocol string
	Serial   string
	CallID   uint64
	TG       uint32
	AlgID    uint8
	KeyID    uint16
	MI       []byte
	CT       []byte
	At       time.Time
}

Frame is one captured encrypted unit handed to a Sink. MI is the IV (P25 Message Indicator); CT is the encrypted payload (the superframe's voice frames). The remaining fields are provenance for the analyst.

type Sink

type Sink interface {
	WriteCryptoFrame(Frame)
}

Sink receives captured encrypted frames. Implementations must be safe for concurrent use — the composer runs one voice chain per device in its own goroutine, and they share a single sink.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL