forked from TrueCloudLab/certificates
Remove superfluous call to StoreCertificate
This commit is contained in:
parent
583d60dc0d
commit
b97f024f8a
4 changed files with 0 additions and 42 deletions
1
ca/ca.go
1
ca/ca.go
|
@ -152,7 +152,6 @@ func (ca *CA) Init(config *authority.Config) (*CA, error) {
|
||||||
scepPrefix := "scep"
|
scepPrefix := "scep"
|
||||||
scepAuthority, err := scep.New(auth, scep.AuthorityOptions{
|
scepAuthority, err := scep.New(auth, scep.AuthorityOptions{
|
||||||
Service: auth.GetSCEPService(),
|
Service: auth.GetSCEPService(),
|
||||||
DB: auth.GetDatabase().(scep.DB),
|
|
||||||
DNS: dns,
|
DNS: dns,
|
||||||
Prefix: scepPrefix,
|
Prefix: scepPrefix,
|
||||||
})
|
})
|
||||||
|
|
|
@ -34,7 +34,6 @@ type Interface interface {
|
||||||
|
|
||||||
// Authority is the layer that handles all SCEP interactions.
|
// Authority is the layer that handles all SCEP interactions.
|
||||||
type Authority struct {
|
type Authority struct {
|
||||||
db DB
|
|
||||||
prefix string
|
prefix string
|
||||||
dns string
|
dns string
|
||||||
intermediateCertificate *x509.Certificate
|
intermediateCertificate *x509.Certificate
|
||||||
|
@ -46,8 +45,6 @@ type Authority struct {
|
||||||
type AuthorityOptions struct {
|
type AuthorityOptions struct {
|
||||||
// Service provides the certificate chain, the signer and the decrypter to the Authority
|
// Service provides the certificate chain, the signer and the decrypter to the Authority
|
||||||
Service *Service
|
Service *Service
|
||||||
// DB is the database used by SCEP
|
|
||||||
DB DB
|
|
||||||
// DNS is the host used to generate accurate SCEP links. By default the authority
|
// DNS is the host used to generate accurate SCEP links. By default the authority
|
||||||
// will use the Host from the request, so this value will only be used if
|
// will use the Host from the request, so this value will only be used if
|
||||||
// request.Host is empty.
|
// request.Host is empty.
|
||||||
|
@ -67,7 +64,6 @@ type SignAuthority interface {
|
||||||
func New(signAuth SignAuthority, ops AuthorityOptions) (*Authority, error) {
|
func New(signAuth SignAuthority, ops AuthorityOptions) (*Authority, error) {
|
||||||
|
|
||||||
authority := &Authority{
|
authority := &Authority{
|
||||||
db: ops.DB,
|
|
||||||
prefix: ops.Prefix,
|
prefix: ops.Prefix,
|
||||||
dns: ops.DNS,
|
dns: ops.DNS,
|
||||||
signAuth: signAuth,
|
signAuth: signAuth,
|
||||||
|
@ -341,15 +337,6 @@ func (a *Authority) SignCSR(ctx context.Context, csr *x509.CertificateRequest, m
|
||||||
CertRepMessage: cr,
|
CertRepMessage: cr,
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the newly created certificate
|
|
||||||
err = newCert(a.db, CertOptions{
|
|
||||||
Leaf: certChain[0],
|
|
||||||
Intermediates: certChain[1:],
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return crepMsg, nil
|
return crepMsg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
package scep
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/x509"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
// CertOptions options with which to create and store a cert object.
|
|
||||||
type CertOptions struct {
|
|
||||||
Leaf *x509.Certificate
|
|
||||||
Intermediates []*x509.Certificate
|
|
||||||
}
|
|
||||||
|
|
||||||
func newCert(db DB, ops CertOptions) error {
|
|
||||||
err := db.StoreCertificate(ops.Leaf)
|
|
||||||
if err != nil {
|
|
||||||
errors.Wrap(err, "error while storing certificate")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -2,18 +2,11 @@ package scep
|
||||||
|
|
||||||
// Error is an SCEP error type
|
// Error is an SCEP error type
|
||||||
type Error struct {
|
type Error struct {
|
||||||
// Type ProbType
|
|
||||||
// Detail string
|
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Status int `json:"-"`
|
Status int `json:"-"`
|
||||||
// Sub []*Error
|
|
||||||
// Identifier *Identifier
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error implements the error interface.
|
// Error implements the error interface.
|
||||||
func (e *Error) Error() string {
|
func (e *Error) Error() string {
|
||||||
// if e.Err == nil {
|
|
||||||
// return e.Detail
|
|
||||||
// }
|
|
||||||
return e.Message
|
return e.Message
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue