transport

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package transport is the Secret Service's secret transports, the encryption both ends of a session agree on: plain, and the DH session over the 1024-bit MODP group with HKDF-SHA256 and AES-128-CBC.

Index

Constants

View Source
const (
	AlgPlain = "plain"
	AlgDH    = "dh-ietf1024-sha256-aes128-cbc-pkcs7"
)

The algorithms OpenSession negotiates.

View Source
const MaxSecretLen = 1 << 27

MaxSecretLen is the longest secret a transport carries, the D-Bus specification's maximum message length: no longer secret fits in the message that carries it.

View Source
const PrimeLen = 128

PrimeLen is the prime's length in bytes, the shared secret's padded encoding.

Variables

View Source
var Generator = big.NewInt(2)

Generator is the group's generator.

View Source
var Prime, _ = new(big.Int).SetString(
	"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"+
		"29024E088A67CC74020BBEA63B139B22514A08798E3404DD"+
		"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"+
		"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"+
		"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381"+
		"FFFFFFFFFFFFFFFF", 16)

Prime is the 1024-bit MODP group of RFC 2409 §6.2 (Oakley group 2), generator Generator, the group the spec names for its DH transport.

Functions

This section is empty.

Types

type AES

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

AES is the DH session: AES-128-CBC with PKCS#7 padding under the HKDF-SHA256 of the shared secret, a fresh IV per secret as its parameters.

func NewAES

func NewAES(shared []byte) (AES, error)

NewAES derives the session from the shared secret padded to PrimeLen, with HKDF-SHA256, no salt and no info.

func (AES) Decode

func (a AES) Decode(params, value []byte) ([]byte, error)

Decode implements Transport.

func (AES) Encode

func (a AES) Encode(secret []byte) ([]byte, []byte, error)

Encode implements Transport.

type Plain

type Plain struct{}

Plain is the plain session.

func (Plain) Decode

func (Plain) Decode(params, value []byte) ([]byte, error)

Decode implements Transport.

func (Plain) Encode

func (Plain) Encode(secret []byte) ([]byte, []byte, error)

Encode implements Transport.

type Transport

type Transport interface {
	Encode(secret []byte) (params, value []byte, err error)
	Decode(params, value []byte) ([]byte, error)
}

Transport encrypts a secret for the other end and decrypts what it sends. Plain is the identity.

Jump to

Keyboard shortcuts

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