@@ -871,21 +871,21 @@ func (wfe *WebFrontEndImpl) NewAccount(
871871// or revocation reason don't pass simple static checks. Also populates some
872872// metadata fields on the given logEvent.
873873func (wfe * WebFrontEndImpl ) parseRevocation (
874- jwsBody []byte , logEvent * web.RequestEvent ) (* x509.Certificate , revocation.Reason , * probs. ProblemDetails ) {
874+ jwsBody []byte , logEvent * web.RequestEvent ) (* x509.Certificate , revocation.Reason , error ) {
875875 // Read the revoke request from the JWS payload
876876 var revokeRequest struct {
877877 CertificateDER core.JSONBuffer `json:"certificate"`
878878 Reason * revocation.Reason `json:"reason"`
879879 }
880880 err := json .Unmarshal (jwsBody , & revokeRequest )
881881 if err != nil {
882- return nil , 0 , probs . Malformed ("Unable to JSON parse revoke request" )
882+ return nil , 0 , berrors . MalformedError ("Unable to JSON parse revoke request" )
883883 }
884884
885885 // Parse the provided certificate
886886 parsedCertificate , err := x509 .ParseCertificate (revokeRequest .CertificateDER )
887887 if err != nil {
888- return nil , 0 , probs . Malformed ("Unable to parse certificate DER" )
888+ return nil , 0 , berrors . MalformedError ("Unable to parse certificate DER" )
889889 }
890890
891891 // Compute and record the serial number of the provided certificate
@@ -899,31 +899,23 @@ func (wfe *WebFrontEndImpl) parseRevocation(
899899 // issuer certificate.
900900 issuerCert , ok := wfe .issuerCertificates [issuance .IssuerNameID (parsedCertificate )]
901901 if ! ok || issuerCert == nil {
902- return nil , 0 , probs . NotFound ("Certificate from unrecognized issuer" )
902+ return nil , 0 , berrors . NotFoundError ("Certificate from unrecognized issuer" )
903903 }
904904 err = parsedCertificate .CheckSignatureFrom (issuerCert .Certificate )
905905 if err != nil {
906- return nil , 0 , probs . NotFound ("No such certificate" )
906+ return nil , 0 , berrors . NotFoundError ("No such certificate" )
907907 }
908908 logEvent .DNSNames = parsedCertificate .DNSNames
909909
910910 if parsedCertificate .NotAfter .Before (wfe .clk .Now ()) {
911- return nil , 0 , probs . Unauthorized ("Certificate is expired" )
911+ return nil , 0 , berrors . UnauthorizedError ("Certificate is expired" )
912912 }
913913
914914 // Verify the revocation reason supplied is allowed
915915 reason := revocation .Reason (0 )
916916 if revokeRequest .Reason != nil {
917917 if _ , present := revocation .UserAllowedReasons [* revokeRequest .Reason ]; ! present {
918- reasonStr , ok := revocation .ReasonToString [* revokeRequest .Reason ]
919- if ! ok {
920- reasonStr = "unknown"
921- }
922- return nil , 0 , probs .BadRevocationReason (fmt .Sprintf (
923- "unsupported revocation reason code provided: %s (%d). Supported reasons: %s" ,
924- reasonStr ,
925- * revokeRequest .Reason ,
926- revocation .UserAllowedReasonsMessage ))
918+ return nil , 0 , berrors .BadRevocationReasonError (int64 (* revokeRequest .Reason ))
927919 }
928920 reason = * revokeRequest .Reason
929921 }
@@ -952,9 +944,9 @@ func (wfe *WebFrontEndImpl) revokeCertBySubscriberKey(
952944 return prob
953945 }
954946
955- cert , reason , prob := wfe .parseRevocation (jwsBody , logEvent )
956- if prob != nil {
957- return prob
947+ cert , reason , err := wfe .parseRevocation (jwsBody , logEvent )
948+ if err != nil {
949+ return err
958950 }
959951
960952 wfe .log .AuditObject ("Authenticated revocation" , revocationEvidence {
@@ -967,7 +959,7 @@ func (wfe *WebFrontEndImpl) revokeCertBySubscriberKey(
967959 // The RA will confirm that the authenticated account either originally
968960 // issued the certificate, or has demonstrated control over all identifiers
969961 // in the certificate.
970- _ , err : = wfe .ra .RevokeCertByApplicant (ctx , & rapb.RevokeCertByApplicantRequest {
962+ _ , err = wfe .ra .RevokeCertByApplicant (ctx , & rapb.RevokeCertByApplicantRequest {
971963 Cert : cert .Raw ,
972964 Code : int64 (reason ),
973965 RegID : acct .ID ,
@@ -997,9 +989,9 @@ func (wfe *WebFrontEndImpl) revokeCertByCertKey(
997989 return prob
998990 }
999991
1000- cert , reason , prob := wfe .parseRevocation (jwsBody , logEvent )
1001- if prob != nil {
1002- return prob
992+ cert , reason , err := wfe .parseRevocation (jwsBody , logEvent )
993+ if err != nil {
994+ return err
1003995 }
1004996
1005997 // For embedded JWK revocations we decide if a requester is able to revoke a specific
@@ -1019,7 +1011,7 @@ func (wfe *WebFrontEndImpl) revokeCertByCertKey(
10191011
10201012 // The RA assumes here that the WFE2 has validated the JWS as proving
10211013 // control of the private key corresponding to this certificate.
1022- _ , err : = wfe .ra .RevokeCertByKey (ctx , & rapb.RevokeCertByKeyRequest {
1014+ _ , err = wfe .ra .RevokeCertByKey (ctx , & rapb.RevokeCertByKeyRequest {
10231015 Cert : cert .Raw ,
10241016 })
10251017 if err != nil {
@@ -1071,7 +1063,7 @@ func (wfe *WebFrontEndImpl) RevokeCertificate(
10711063 err = berrors .MalformedError ("Malformed JWS, no KeyID or embedded JWK" )
10721064 }
10731065 if err != nil {
1074- wfe .sendError (response , logEvent , web .ProblemDetailsForError (err , "unable to revoke" ), nil )
1066+ wfe .sendError (response , logEvent , web .ProblemDetailsForError (err , "Unable to revoke" ), nil )
10751067 return
10761068 }
10771069
0 commit comments