proof

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 9 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 proof generates and parses the proofs of possession the client sends to the CA, which show that the client holds a private key.

A proof is bound to the request it is sent with: it signs the current timestamp, the key's fingerprint and the request's method and path, so it cannot be replayed against another endpoint or with other path parameters. See the CA's ADR 0006 for the format.

Index

Constants

View Source
const RequestNamespace = "request-proof-of-possession@com.github.serverless-ssh-ca.andrewheberle"

RequestNamespace is the SSHSIG namespace a proof is signed in.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proof

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

Proof is a proof of possession made by GenerateForRequest or read by Parse.

func GenerateForRequest

func GenerateForRequest(signer ssh.Signer, method, path string) (*Proof, error)

GenerateForRequest creates a proof that is bound to a request, so it cannot be replayed against another endpoint or with other path parameters (such as a different certificate serial), by signing the current timestamp, the public key fingerprint and the request using SSHSIG with the provided signer and the RequestNamespace namespace.

The method is the HTTP method of the request and path is the path of the request as the CA serves it, with any parameters filled in, for example "/api/v4/user/certificates/12345678901234567890".

The signed data is "<timestamp>.<fingerprint>.<METHOD> <path>" and the proof is returned as a string in the format: <timestamp>.<fingerprint>.<base64 armored_signature>

func Parse

func Parse(proof string) (Proof, error)

Parse takes a proof string and validates it is in the expected format, returning a Proof struct if valid.

func (Proof) MarshalJSON

func (p Proof) MarshalJSON() ([]byte, error)

MarshalJSON returns the proof data as a JSON string

func (Proof) String

func (p Proof) String() string

String returns the proof data as a string

func (Proof) VerifyRequest

func (p Proof) VerifyRequest(pub ssh.PublicKey, method, path string, allowedrange time.Duration) error

VerifyRequest checks the proof is valid for the request with the provided method and path by verifying the signature and that the timestamp is within the allowed range.

This verifies a proof made by GenerateForRequest.

Jump to

Keyboard shortcuts

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