Add basic version of provisioner specific SCEP decrypter

This commit is contained in:
Herman Slatman
2023-05-26 23:52:24 +02:00
parent 2ef45a204f
commit 0377fe559b
9 changed files with 184 additions and 57 deletions

View File

@@ -244,11 +244,25 @@ func (p ProvisionersResponse) MarshalJSON() ([]byte, error) {
continue
}
old := scepProv.ChallengePassword
type old struct {
challengePassword string
decrypterCertificate string
decrypterKey string
decrypterKeyPassword string
}
o := old{scepProv.ChallengePassword, scepProv.DecrypterCert, scepProv.DecrypterKey, scepProv.DecrypterKeyPassword}
scepProv.ChallengePassword = "*** REDACTED ***"
defer func(p string) { //nolint:gocritic // defer in loop required to restore initial state of provisioners
scepProv.ChallengePassword = p
}(old)
// TODO: remove the details in the API response
// scepProv.DecrypterCert = ""
// scepProv.DecrypterKey = ""
// scepProv.DecrtyperKeyPassword = ""
defer func(o old) { //nolint:gocritic // defer in loop required to restore initial state of provisioners
scepProv.ChallengePassword = o.challengePassword
scepProv.DecrypterCert = o.decrypterCertificate
scepProv.DecrypterKey = o.decrypterKey
scepProv.DecrypterKeyPassword = o.decrypterKeyPassword
}(o)
}
var list = struct {