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 ¶
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 ¶
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 ¶
Parse takes a proof string and validates it is in the expected format, returning a Proof struct if valid.
func (Proof) MarshalJSON ¶
MarshalJSON returns the proof data as a JSON 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.