Put registration checks together
This commit is contained in:
parent
129b05f42a
commit
e30d3594f8
|
|
@ -161,6 +161,12 @@ func (ra *RegistrationAuthorityImpl) NewCertificate(req core.CertificateRequest,
|
|||
return emptyCert, err
|
||||
}
|
||||
|
||||
registration, err := ra.SA.GetRegistration(regID)
|
||||
if err != nil {
|
||||
logEvent.Error = err.Error()
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
// Verify the CSR
|
||||
csr := req.CSR
|
||||
if err = core.VerifyCSR(csr); err != nil {
|
||||
|
|
@ -196,13 +202,6 @@ func (ra *RegistrationAuthorityImpl) NewCertificate(req core.CertificateRequest,
|
|||
return emptyCert, err
|
||||
}
|
||||
|
||||
registration, err := ra.SA.GetRegistration(regID)
|
||||
if err != nil {
|
||||
err = core.InternalServerError(err.Error())
|
||||
logEvent.Error = err.Error()
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
if core.KeyDigestEquals(csr.PublicKey, registration.Key) {
|
||||
err = core.MalformedRequestError("Certificate public key must be different than account key")
|
||||
return emptyCert, err
|
||||
|
|
|
|||
Loading…
Reference in New Issue