Documentation
¶
Index ¶
Constants ¶
const Namespace = "proof-of-possession@com.github.serverless-ssh-ca.andrewheberle"
The namespace used for signing the proof
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 ¶
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
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 ¶
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) Verify ¶
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.