wincng

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 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 wincng is the sensor for the cryptography Windows itself provides: the CNG algorithm registry and primitive providers, key storage providers (KSPs) and legacy cryptographic service providers (CSPs). Unlike the file sensor it does not infer capability from a file's name and version; it ASKS the operating system what is registered, which is a stronger kind of evidence (`capable`, `probed`).

The sensor itself knows nothing about Windows: every call goes through the API in internal/winapi, so the logic here is tested anywhere with a fake. Security rules (ADR-0013): no subprocess and no network; no key, certificate or secret is opened or enumerated; a key storage provider is OPENED (which loads its code) only if it is on the in-box allow-list in internal/knowledge; a parameter set is probed only for the two post-quantum families; and it runs only for a live Windows host.

Index

Constants

View Source
const (
	OpCipher            = winapi.OpCipher
	OpHash              = winapi.OpHash
	OpAsymmetricEncrypt = winapi.OpAsymmetricEncrypt
	OpSecretAgreement   = winapi.OpSecretAgreement
	OpSignature         = winapi.OpSignature
	OpRNG               = winapi.OpRNG
	OpKeyDerivation     = winapi.OpKeyDerivation
	OpAll               = winapi.OpAll
	MaxName             = winapi.MaxName
)

Operation classes and limits.

View Source
const (
	// Name is the sensor's registry name.
	Name = "windows-cng"
	// Version is the version of this sensor's behaviour.
	Version = "0.1.0"
)

Variables

View Source
var ErrUnsupported = winapi.ErrUnsupported

ErrUnsupported means the API exists only on Windows.

Functions

func Register

func Register(reg *sense.Registry, api API) error

Register adds the sensor to reg, asking api. Production uses the package's init (the real Windows API); tests register a fake.

Types

type API

type API = winapi.API

API is what the sensor needs from Windows.

func NewAPI

func NewAPI() API

NewAPI returns the real Windows implementation, or a stub off Windows.

type Algorithm

type Algorithm = winapi.Algorithm

Algorithm is one registered algorithm identifier.

type CSP

type CSP = winapi.CSP

CSP is a registered legacy cryptographic service provider.

type Sensor

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

Sensor implements sense.Sensor.

func New

func New(env sense.Env, api API) *Sensor

New returns a sensor that asks api about the host described by env.

func (*Sensor) Collect

func (s *Sensor) Collect(ctx context.Context) (evidence.Batch, error)

Collect asks Windows and returns what it says.

func (*Sensor) Detect

func (s *Sensor) Detect(context.Context) (bool, error)

Detect reports whether Windows can be asked about THIS machine. The sensor asks the running operating system, so it runs only for a live Windows host: never for a mounted disk, a `--root` override, an image or a test fixture, where the answers would describe the wrong machine.

func (*Sensor) Info

func (*Sensor) Info() sense.Info

Info implements sense.Sensor.

type StatusError

type StatusError = winapi.StatusError

StatusError is a failed Windows call.

type StorageProvider

type StorageProvider = winapi.StorageProvider

StorageProvider is a registered key storage provider.

Jump to

Keyboard shortcuts

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