Skip to content

Commit

Permalink
Set subject DN to load certificate into keystore
Browse files Browse the repository at this point in the history
  • Loading branch information
vsliouniaev committed Jul 15, 2020
1 parent 736bd36 commit c936fba
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 c936fba

Please sign in to comment.