diff --git a/certificates.go b/certificates.go deleted file mode 100644 index 0cf3c756..00000000 --- a/certificates.go +++ /dev/null @@ -1,29 +0,0 @@ -package enroll - -import ( - "errors" - "golang.org/x/crypto/pkcs12" - "io/ioutil" -) - -const PushTopicASN1 string = "0.9.2342.19200300.100.1.1" - -func GetPushTopicFromPKCS12(certPath string, certPass string) (string, error) { - certData, err := ioutil.ReadFile(certPath) - if err != nil { - return "", err - } - - _, cert, err := pkcs12.Decode(certData, certPass) - if err != nil { - return "", err - } - - for _, v := range cert.Subject.Names { - if v.Type.String() == PushTopicASN1 { - return v.Value.(string), nil - } - } - - return "", errors.New("Could not find Push Topic in the provided pkcs12 bundle.") -} diff --git a/service.go b/service.go index 8e41b7fb..c23e1ac2 100644 --- a/service.go +++ b/service.go @@ -10,13 +10,9 @@ type Service interface { Enroll(ctx context.Context) (Profile, error) } -func NewService(pushCertPath, pushCertPass, caCertPath, scepURL, scepChallenge, url, tlsCertPath, scepSubject string) (Service, error) { - pushTopic, err := GetPushTopicFromPKCS12(pushCertPath, pushCertPass) - if err != nil { - return nil, err - } - +func NewService(pushTopic, caCertPath, scepURL, scepChallenge, url, tlsCertPath, scepSubject string) (Service, error) { var caCert, tlsCert []byte + var err error if caCertPath != "" { caCert, err = ioutil.ReadFile(caCertPath)