Documentation ¶
Index ¶
- func FetchCN(cn string) (*x509.Certificate, error)
- func FetchCertificateChain(cl_cert *x509.Certificate, root *x509.Certificate) ([]x509.Certificate, error)
- func FetchFPCA(hostname string) (*x509.Certificate, error)
- func FetchRootCA(hostname string) (*x509.Certificate, error)
- func PEMDecode(pemBytes []byte) x509.Certificate
- func PEMEncode(cert *x509.Certificate) []byte
- func ParseCN(cn string) (username, realm string, err error)
- func ParseCert(cert string) (*x509.Certificate, error)
- func ParseCertByteA(cert []byte) (*x509.Certificate, error)
- func ParseCertString(cert string) (*x509.Certificate, error)
- func ReadCert(certFile string) *x509.CertPool
- func ValidateEccentricCertificate(cl_cert *x509.Certificate) (caCert *x509.Certificate, err error)
- func ValidateEccentricCertificateChain(cl_cert *x509.Certificate, root *x509.Certificate) (chain []x509.Certificate, err error)
- type AppHandler
- type Authentication
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchCN ¶
func FetchCN(cn string) (*x509.Certificate, error)
FetchCN fetches a DANE record for CN in DNSSEC
func FetchCertificateChain ¶
func FetchCertificateChain(cl_cert *x509.Certificate, root *x509.Certificate) ([]x509.Certificate, error)
Fetch the certificate chain from the given certifcate upto the root. Return the chain that validates the cl_cert. This version looks up certificate in DNS based upon their CommonName. ie. FPCA.domain.tld, ROOTCA.domain.tld. We stop searching when certX.Issuer.CN == Root.Subject.CN We return at least 1 certificate, the Root. TODO: Get certificates based upon Serials
func FetchFPCA ¶
func FetchFPCA(hostname string) (*x509.Certificate, error)
FetchFPCA fetches the FPCA certificate for the given hostname.
func FetchRootCA ¶
func FetchRootCA(hostname string) (*x509.Certificate, error)
FetchRootCA fetches the RootCA certificate for the given hostname.
func PEMDecode ¶
func PEMDecode(pemBytes []byte) x509.Certificate
func PEMEncode ¶
func PEMEncode(cert *x509.Certificate) []byte
func ParseCN ¶
parseCN parses the string and returns the username and realm parts if it mathes the cnRE - regular expression. Otherwise, it returns two empty strings.
func ParseCert ¶
func ParseCert(cert string) (*x509.Certificate, error)
Parse a single (client) certificate, Return a x509.Certificate structure To Be Deprecated. Use ParseCertString or ParseCertByteA instead
func ParseCertByteA ¶
func ParseCertByteA(cert []byte) (*x509.Certificate, error)
Parse a single (client) certificate, Return a x509.Certificate structure
func ParseCertString ¶
func ParseCertString(cert string) (*x509.Certificate, error)
Parse a single (client) certificate, Return a x509.Certificate structure
func ValidateEccentricCertificate ¶
func ValidateEccentricCertificate(cl_cert *x509.Certificate) (caCert *x509.Certificate, err error)
ValidateEccentricCertificate verifies that the given certificate parses to a real x509 certificate and that it is signed by the FPCA DANE/TLSA record it specifies in the CN. TODO: Deprecate this function as it handles only direct signing by the FPCA, no SubCAs Use ValidateEccentricCertificateChain instead
func ValidateEccentricCertificateChain ¶
func ValidateEccentricCertificateChain(cl_cert *x509.Certificate, root *x509.Certificate) (chain []x509.Certificate, err error)
ValidateEccentricCertificate verifies that the given certificate parses to a real x509 certificate It is signed by the FPCA DANE/TLSA record it specifies in the CN.
Types ¶
type AppHandler ¶
type AppHandler func(http.ResponseWriter, *http.Request) error
func (AppHandler) ServeHTTP ¶
func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Catch panics and show them.
type Authentication ¶
Authentication contains the configuration parameters for the application. RegisterURL: URL of the page at the FPCA where the user agent signs up for a certificate
example: "https://register-dating.wtmnd.nl:10444/register-pubkey"
Debug: Boolean to determine debugging
func (*Authentication) LoggedInHandler ¶
func (ecca *Authentication) LoggedInHandler(handler http.HandlerFunc, templateParams ...interface{}) http.Handler
loggedInHandler returns a handler that calls the given handler when the client uses a certificate to authenticate. Otherwise it sends a Ecca-login page
func (*Authentication) SendToLoginPage ¶
func (ecca *Authentication) SendToLoginPage(w http.ResponseWriter, template_params ...interface{})
SendToLoginPage redirects the browser to the sites' FPCA. It sets the WWW-Authenticate header so the user agent knows where to sign up. It sets response headers so no output may have been written so far.
func (*Authentication) TemplateHandler ¶
func (ecca *Authentication) TemplateHandler(templateName string) http.HandlerFunc
templateHandler returns a handler that serves HTTP requests by applying the named template without parameters to the template