forked from TrueCloudLab/certificates
Fix linter issues
This commit is contained in:
parent
cc1ecb9438
commit
538fe8114d
5 changed files with 18 additions and 37 deletions
|
@ -224,6 +224,9 @@ func (a *Authority) init() error {
|
|||
DecryptionKey: a.config.IntermediateKey,
|
||||
Password: []byte(a.config.Password),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
a.scepService = &scep.Service{
|
||||
|
|
|
@ -315,13 +315,6 @@ func (h *Handler) PKIOperation(ctx context.Context, request SCEPRequest) (SCEPRe
|
|||
return response, nil
|
||||
}
|
||||
|
||||
func certName(cert *x509.Certificate) string {
|
||||
if cert.Subject.CommonName != "" {
|
||||
return cert.Subject.CommonName
|
||||
}
|
||||
return string(cert.Signature)
|
||||
}
|
||||
|
||||
func formatCapabilities(caps []string) []byte {
|
||||
return []byte(strings.Join(caps, "\r\n"))
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ package scep
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto"
|
||||
"crypto/sha1"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
@ -512,20 +510,6 @@ func degenerateCertificates(certs []*x509.Certificate) ([]byte, error) {
|
|||
return degenerate, nil
|
||||
}
|
||||
|
||||
// createKeyIdentifier creates an identifier for public keys
|
||||
// according to the first method in RFC5280 section 4.2.1.2.
|
||||
func createKeyIdentifier(pub crypto.PublicKey) ([]byte, error) {
|
||||
|
||||
keyBytes, err := x509.MarshalPKIXPublicKey(pub)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
id := sha1.Sum(keyBytes)
|
||||
|
||||
return id[:], nil
|
||||
}
|
||||
|
||||
// Interface guards
|
||||
var (
|
||||
_ Interface = (*Authority)(nil)
|
||||
|
|
|
@ -65,16 +65,16 @@ func newCert(db nosql.DB, ops CertOptions) (*certificate, error) {
|
|||
}
|
||||
}
|
||||
|
||||
func getCert(db nosql.DB, id string) (*certificate, error) {
|
||||
b, err := db.Get(certTable, []byte(id))
|
||||
if nosql.IsErrNotFound(err) {
|
||||
return nil, fmt.Errorf("certificate %s not found", id)
|
||||
} else if err != nil {
|
||||
return nil, fmt.Errorf("error loading certificate")
|
||||
}
|
||||
var cert certificate
|
||||
if err := json.Unmarshal(b, &cert); err != nil {
|
||||
return nil, fmt.Errorf("%w: error unmarshaling certificate", err)
|
||||
}
|
||||
return &cert, nil
|
||||
}
|
||||
// func getCert(db nosql.DB, id string) (*certificate, error) {
|
||||
// b, err := db.Get(certTable, []byte(id))
|
||||
// if nosql.IsErrNotFound(err) {
|
||||
// return nil, fmt.Errorf("certificate %s not found", id)
|
||||
// } else if err != nil {
|
||||
// return nil, fmt.Errorf("error loading certificate")
|
||||
// }
|
||||
// var cert certificate
|
||||
// if err := json.Unmarshal(b, &cert); err != nil {
|
||||
// return nil, fmt.Errorf("%w: error unmarshaling certificate", err)
|
||||
// }
|
||||
// return &cert, nil
|
||||
// }
|
||||
|
|
|
@ -31,8 +31,9 @@ var (
|
|||
oidSCEPsenderNonce = asn1.ObjectIdentifier{2, 16, 840, 1, 113733, 1, 9, 5}
|
||||
oidSCEPrecipientNonce = asn1.ObjectIdentifier{2, 16, 840, 1, 113733, 1, 9, 6}
|
||||
oidSCEPtransactionID = asn1.ObjectIdentifier{2, 16, 840, 1, 113733, 1, 9, 7}
|
||||
oidChallengePassword = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 7}
|
||||
oidSCEPfailInfoText = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 24}
|
||||
//oidChallengePassword = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 7}
|
||||
|
||||
)
|
||||
|
||||
// PKIMessage defines the possible SCEP message types
|
||||
|
|
Loading…
Reference in a new issue