dmrcrypto

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package dmrcrypto generates the keystreams DMR's link-layer privacy algorithms produce, so the assessment harness and recipe pipeline can attempt DMR decryption the same way p25crypto handles P25.

Honesty note: DMR encryption is vendor-specific. The cipher *cores* are standard — Motorola "Enhanced Privacy" is RC4, and the DMRA types map to DES/3DES/AES — but the key and IV *derivation* from the air interface is proprietary and reverse-engineered, and differs between Motorola and Hytera. This package therefore implements the standard cores keyed with the material the caller supplies (the reconstructed key, and the frame's IV bytes used directly): it does not fabricate a vendor key schedule. An analyst who has recovered the key can decrypt; the package makes no claim to derive that key from the signalling.

Index

Constants

View Source
const (
	AlgRC4    = 0x21 // Motorola "Enhanced Privacy"
	AlgDESOFB = 0x22
	AlgTDES   = 0x23
	AlgAES128 = 0x24
	AlgAES256 = 0x25
)

DMRA / vendor privacy algorithm identifiers, as surfaced by common decoders.

Variables

This section is empty.

Functions

func AlgName

func AlgName(algid uint8) string

AlgName returns a short human label for algid.

func DefaultKeys

func DefaultKeys(algid uint8) [][]byte

DefaultKeys returns a small dictionary of weak/default/test keys to try for algid (all-zero, all-FF, and an incrementing pattern), or nil if unsupported.

func KeySize

func KeySize(algid uint8) int

KeySize returns the canonical key length in bytes for algid (RC4 keys are variable; 5 bytes / 40 bits is the common Enhanced-Privacy size used for the default-key dictionary and brute), or 0 when unsupported.

func Keystream

func Keystream(algid uint8, key, iv []byte, n int) ([]byte, error)

Keystream returns n keystream bytes for the algorithm, key, and IV. For RC4 the IV (if present) is appended to the key — the common Enhanced-Privacy model — and no warm-up bytes are discarded (unlike P25 ADP). For the block ciphers the IV seeds OFB directly. RC4 accepts a 1..256-byte key; the block ciphers require the exact KeySize.

func Supported

func Supported(algid uint8) bool

Supported reports whether Keystream can realise this algorithm.

Types

This section is empty.

Jump to

Keyboard shortcuts

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