Commit a1389127 authored by Heiko Reese's avatar Heiko Reese
Browse files

../..

parent d05728a8
......@@ -37,9 +37,9 @@ func (cc *CertCache) Delete(serial string) {
func (cc *CertCache) Len() int {
cc.RLock()
l := len(cc.certs)
l := len(cc.certs)
cc.RUnlock()
return l
return l
}
func (cc *CertCache) Get(serial string) *SearchableCert {
......
package websearch
import (
"crypto/x509"
"encoding/pem"
"io/ioutil"
"log"
"crypto/x509"
"encoding/pem"
"io/ioutil"
"log"
)
func ReadCertificates(filenames ...string) []*x509.Certificate {
......@@ -36,7 +36,7 @@ func ReadCertificates(filenames ...string) []*x509.Certificate {
}
}
} else {
log.Println(err)
log.Println("X", err)
}
}
return allcerts
......
......@@ -2,18 +2,17 @@ package main
import (
"flag"
"fmt"
"path/filepath"
. "git.scc.kit.edu/KIT-CA/websearch"
"github.com/gorilla/mux"
_ "github.com/k0kubun/pp"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/fcgi"
"path/filepath"
"strings"
_ "github.com/k0kubun/pp"
)
const (
......@@ -71,7 +70,7 @@ func main() {
select {
case newcert := <-newFileChan:
for _, c := range ReadCertificates(newcert) {
log.Println("Adding new certificate", newcert)
log.Println("Adding new certificate", newcert)
ccache.Add(c)
}
}
......@@ -82,18 +81,18 @@ func main() {
if err != nil {
log.Fatal(err)
}
allfiles := make([]string, len(files))
for _, file := range files {
if !file.IsDir() {
fmt.Println(allCertDir, file.Name(), filepath.Join(allCertDir, file.Name()))
allfiles = append(allfiles, filepath.Join(allCertDir, file.Name()))
}
}
for _, c := range ReadCertificates(allfiles...) {
ccache.Add(c)
}
var allfiles []string
for _, file := range files {
if !file.IsDir() {
fullname := filepath.Join(allCertDir, file.Name())
allfiles = append(allfiles, fullname)
}
}
for _, c := range ReadCertificates(allfiles...) {
ccache.Add(c)
}
// create http interface
// create http interface
r := mux.NewRouter()
r.HandleFunc("/p/getcert/{serial}", getcertHandler)
......
package websearch
import (
"encoding/asn1"
"crypto/x509"
"encoding/asn1"
)
const (
kitcag1 = "kit-ca-g1"
kitcag2 = "kit-ca-g2"
kitcag1 = "kit-ca-g1"
kitcag2 = "kit-ca-g2"
)
var (
......@@ -38,10 +38,10 @@ var (
0x66, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6e, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x31, 0x0f, 0x30, 0x0d,
0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x06, 0x4b, 0x49, 0x54, 0x2d, 0x43, 0x41,
}
RawIssuers = map[string][]byte{
kitcag1 : RawIssuerG1,
kitcag2 : RawIssuerG2,
}
RawIssuers = map[string][]byte{
kitcag1: RawIssuerG1,
kitcag2: RawIssuerG2,
}
)
var (
......@@ -62,4 +62,3 @@ var (
}
oidEmail = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}
)
package websearch
import (
"math/big"
"errors"
"errors"
"math/big"
)
var (
......@@ -38,7 +38,7 @@ func BuildCertificateLink(serial string) (string, error) {
return kitcag2, nil
}
// TODO: memdb befragen
// TODO: memdb befragen
return "", errors.New("both callouts failed")
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment