From 0153ff4377401535064968907f505fc5aad41f25 Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Thu, 4 May 2023 11:43:57 +0200 Subject: [PATCH] Remove superfluous `GetChallengePassword` --- authority/provisioner/scep.go | 9 ++------- authority/provisioners.go | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/authority/provisioner/scep.go b/authority/provisioner/scep.go index 0db40864..f098a6e4 100644 --- a/authority/provisioner/scep.go +++ b/authority/provisioner/scep.go @@ -201,11 +201,6 @@ func (s *SCEP) AuthorizeSign(ctx context.Context, token string) ([]SignOption, e }, nil } -// GetChallengePassword returns the challenge password -func (s *SCEP) GetChallengePassword() string { - return s.ChallengePassword -} - // GetCapabilities returns the CA capabilities func (s *SCEP) GetCapabilities() []string { return s.Capabilities @@ -236,7 +231,7 @@ func (s *SCEP) ValidateChallenge(ctx context.Context, challenge, transactionID s case validationMethodWebhook: return s.challengeValidationController.Validate(ctx, challenge, transactionID) default: - if subtle.ConstantTimeCompare([]byte(s.secretChallengePassword), []byte(challenge)) == 0 { + if subtle.ConstantTimeCompare([]byte(s.ChallengePassword), []byte(challenge)) == 0 { return errors.New("invalid challenge password provided") } return nil @@ -259,7 +254,7 @@ func (s *SCEP) selectValidationMethod() validationMethod { if len(s.challengeValidationController.webhooks) > 0 { return validationMethodWebhook } - if s.secretChallengePassword != "" { + if s.ChallengePassword != "" { return validationMethodStatic } return validationMethodNone diff --git a/authority/provisioners.go b/authority/provisioners.go index 24d25caa..5d594536 100644 --- a/authority/provisioners.go +++ b/authority/provisioners.go @@ -1223,7 +1223,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro Data: &linkedca.ProvisionerDetails_SCEP{ SCEP: &linkedca.SCEPProvisioner{ ForceCn: p.ForceCN, - Challenge: p.GetChallengePassword(), + Challenge: p.ChallengePassword, Capabilities: p.Capabilities, MinimumPublicKeyLength: int32(p.MinimumPublicKeyLength), IncludeRoot: p.IncludeRoot,