hkp

package
v0.0.0-...-cbc4e0b Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2014 License: AGPL-3.0, AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package hkp implements the OpenPGP HTTP Keyserver Protocol, as described in the Internet-Draft, http://ietfreport.isoc.org/idref/draft-shaw-openpgp-hkp/.

hkp provides a few extensions to the protocol, such as SKS hashquery, server statistics and JSON-formatted search results.

Index

Constants

This section is empty.

Variables

View Source
var AddFormTemplate *template.Template

AddFormTemplate is used to render the form to add a key.

View Source
var AddResultTemplate *template.Template

AddResultTemplate displays the fingerprints of updated keys.

View Source
var BaseTemplateSrcs = []string{
	headTmplSrc, headerTmplSrc, footerTmplSrc,
	layoutTmplSrc}

baseTmplSrcs contains common templates that need to be defined for all PRL PKS HKP templates.

View Source
var DeleteFormTemplate *template.Template

PRC START DeleteFormTemplate is used to render the form to delete a key.

View Source
var DeleteResultTemplate *template.Template

AddResultTemplate displays the fingerprints of updated keys.

View Source
var PksIndexTemplate *template.Template

PksIndexTemplate is used to render the op=index and op=vindex responses when not in machine readable mode.

View Source
var SearchFormTemplate *template.Template

SearchFormTemplate is used to render the default search form at '/'

View Source
var StatsTemplate *template.Template

StatsTemplate renders the op=stats page

Functions

func ErrorInvalidMethod

func ErrorInvalidMethod(method string) error

ErrorMissingParam constructs an informative error when an invalid HTTP method was requested for the given HKP endpoint.

func ErrorMissingParam

func ErrorMissingParam(param string) error

ErrorMissingParam constructs an informative error when a required parameter was missing from a request.

func ErrorUnknownOperation

func ErrorUnknownOperation(op string) error

ErrorMissingParam constructs an informative error when an unknown operation was requested.

Types

type Add

type Add struct {
	*http.Request
	Keytext string
	Option  Option

	ShaOfTarget string
	// contains filtered or unexported fields
}

An HKP "add" request.

func NewAdd

func NewAdd() *Add

func (*Add) Parse

func (a *Add) Parse() (err error)

func (*Add) Response

func (a *Add) Response() ResponseChan

Get the response channel for sending a response to an add request.

func (*Add) SetResponse

func (a *Add) SetResponse(respChan ResponseChan)

PRC START

type AllStatesReq

type AllStatesReq struct {
	*http.Request
	// contains filtered or unexported fields
}

PRC Start New GetState Request

func NewAllStatesReq

func NewAllStatesReq() *AllStatesReq

func (*AllStatesReq) Parse

func (allStatesReq *AllStatesReq) Parse() (err error)

func (*AllStatesReq) Response

func (allStatesReq *AllStatesReq) Response() ResponseChan

Get the response channel for sending a response to AllStatus Request

func (*AllStatesReq) SetResponse

func (allStatesReq *AllStatesReq) SetResponse(respChan ResponseChan)

type DeleteReq

type DeleteReq struct {
	*http.Request
	EmailToDelete string
	KeyID         string
	// contains filtered or unexported fields
}

PRC START

func NewDeleteReq

func NewDeleteReq() *DeleteReq

func (*DeleteReq) Parse

func (delReq *DeleteReq) Parse() (err error)

Set the otl text from query of url to response chan

func (*DeleteReq) Response

func (delReq *DeleteReq) Response() ResponseChan

Get the response channel for sending a response to an OTL verify request.

func (*DeleteReq) SetResponse

func (delReq *DeleteReq) SetResponse(respChan ResponseChan)

type HashQuery

type HashQuery struct {
	*http.Request
	Digests []string
	// contains filtered or unexported fields
}

func NewHashQuery

func NewHashQuery() *HashQuery

func (*HashQuery) Parse

func (hq *HashQuery) Parse() error

func (*HashQuery) Response

func (hq *HashQuery) Response() ResponseChan

type Lookup

type Lookup struct {
	*http.Request
	Op          Operation
	Search      string
	Option      Option
	Fingerprint bool
	Exact       bool
	Hash        bool
	// contains filtered or unexported fields
}

An HKP "lookup" request.

func NewLookup

func NewLookup() *Lookup

func (*Lookup) MachineReadable

func (l *Lookup) MachineReadable() bool

func (*Lookup) Parse

func (l *Lookup) Parse() (err error)

func (*Lookup) Response

func (l *Lookup) Response() ResponseChan

Get the response channel that a worker processing a lookup request will use to send the response back to the web server.

type OTLVerify

type OTLVerify struct {
	*http.Request
	OTLtext string
	// contains filtered or unexported fields
}

PRC START

func NewOTLVerify

func NewOTLVerify() *OTLVerify

func (*OTLVerify) Parse

func (otlv *OTLVerify) Parse() (err error)

Set the otl text from query of url

func (*OTLVerify) Response

func (otlv *OTLVerify) Response() ResponseChan

Get the response channel for sending a response to an OTL verify request.

type Operation

type Operation int

Operation enumerates the supported HKP operations (op parameter) in the request.

const (
	UnknownOperation           = iota
	Get              Operation = iota
	Index            Operation = iota
	Vindex           Operation = iota
	Stats            Operation = iota
	HashGet          Operation = iota
)

prlpks supported Operations.

type Option

type Option int

Option bit mask in request.

const (
	MachineReadable Option = 1 << iota
	NotModifiable   Option = 1 << iota
	JsonFormat      Option = 1 << iota
	NoOption               = Option(0)
)

prlpks supported HKP options.

type Request

type Request interface {
	// Response returns a channel through which to send the response.
	Response() ResponseChan
	// Parse interprets the URL and POST parameters according to the HKP draft specification.
	Parse() error
}

Request defines an interface for all HKP web requests.

type RequestChan

type RequestChan chan Request

Channel of HKP requests, to be read by a worker.

type Response

type Response interface {
	Error() error
	WriteTo(http.ResponseWriter) error
}

Worker responses.

type ResponseChan

type ResponseChan chan Response

Response channel to which the workers send their results.

type Router

type Router struct {
	*mux.Router
	*Service
}

func NewRouter

func NewRouter(r *mux.Router) *Router

func (*Router) HandleAll

func (r *Router) HandleAll()

func (*Router) HandleDeleteRequest

func (r *Router) HandleDeleteRequest()

TO DELETE

func (*Router) HandleGetAllStates

func (r *Router) HandleGetAllStates()

TO Get AllStates

func (*Router) HandleOTLVerify

func (r *Router) HandleOTLVerify()

PRC EDIT START

func (*Router) HandlePksAdd

func (r *Router) HandlePksAdd()

func (*Router) HandlePksHashQuery

func (r *Router) HandlePksHashQuery()

func (*Router) HandlePksLookup

func (r *Router) HandlePksLookup()

func (*Router) HandleWebUI

func (r *Router) HandleWebUI()

func (*Router) Respond

func (r *Router) Respond(w http.ResponseWriter, req Request)

type Service

type Service struct {
	Requests RequestChan
}

func NewService

func NewService() *Service

type Settings

type Settings struct {
	*prlpks.Settings
}

Settings stores HKP-specific settings for prlpks.

func Config

func Config() *Settings

Config returns the global HKP-specific Settings for prlpks.

func (*Settings) HttpBind

func (s *Settings) HttpBind() string

Jump to

Keyboard shortcuts

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