Skip to content

Commit

Permalink
Set subject DN to load certificate into keystore (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsliouniaev authored Oct 3, 2020
1 parent cbf2fef commit 5c964d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/certs/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
log "github.com/sirupsen/logrus"
"math/big"
Expand Down Expand Up @@ -36,6 +37,7 @@ func GenerateCerts(host string) (ca []byte, cert []byte, key []byte) {
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
BasicConstraintsValid: true,
IsCA: true,
Subject: pkix.Name{Organization: []string{"nil"}},
}

derBytes, err := x509.CreateCertificate(rand.Reader, &rootTemplate, &rootTemplate, &rootKey.PublicKey, rootKey)
Expand Down Expand Up @@ -64,6 +66,7 @@ func GenerateCerts(host string) (ca []byte, cert []byte, key []byte) {
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
BasicConstraintsValid: true,
IsCA: false,
Subject: pkix.Name{Organization: []string{"nil"}},
}
hosts := strings.Split(host, ",")
for _, h := range hosts {
Expand Down

0 comments on commit 5c964d0

Please sign in to comment.