proof

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 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

Index

Constants

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

The namespace used for signing the proof

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

The namespace used for signing a proof that is bound to a request, which is kept separate from Namespace so a proof made for one form can never be accepted as the other

Variables

This section is empty.

Functions

This section is empty.

Types

type Proof

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

func Generate

func Generate(signer ssh.Signer) (*Proof, error)

Generate creates a proof by signing the current timestamp using SSHSIG and the public key fingerprint with the provided signer.

The proof is returned as a string in the format: <timestamp>.<fingerprint>.<base64 armored_signature>

This form of proof is used by the v3 API of the CA. See GenerateForRequest for the form used by the v4 API.

func GenerateForRequest added in v0.24.0

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 in the same format as Generate.

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) Verify

func (p Proof) Verify(pub ssh.PublicKey, allowedrange time.Duration) error

Verify checks the proof is valid by verifying the signature and that the timestamp is within the allowed range.

This verifies a proof made by Generate. See Proof.VerifyRequest to verify a proof made by GenerateForRequest.

func (Proof) VerifyRequest added in v0.24.0

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