Don't reuse certificate serials

This commit is contained in:
Jakob Borg 2014-05-23 14:43:17 +02:00
parent 8356b58b1d
commit 963078f6ac

View File

@ -11,6 +11,7 @@ import (
"encoding/binary" "encoding/binary"
"encoding/pem" "encoding/pem"
"math/big" "math/big"
mr "math/rand"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -50,7 +51,7 @@ func newCertificate(dir string, prefix string) {
notAfter := time.Date(2049, 12, 31, 23, 59, 59, 0, time.UTC) notAfter := time.Date(2049, 12, 31, 23, 59, 59, 0, time.UTC)
template := x509.Certificate{ template := x509.Certificate{
SerialNumber: new(big.Int).SetInt64(0), SerialNumber: new(big.Int).SetInt64(mr.Int63()),
Subject: pkix.Name{ Subject: pkix.Name{
CommonName: tlsName, CommonName: tlsName,
}, },