def verify_signature()

in src/local_gpu_verifier/src/verifier/rim/__init__.py [0:0]


    def verify_signature(self, settings):
        """ Verifies the signature of the base RIM.
        
        Arguments:
        settings (config.HopperSettings): the object containing the various config info.
        
        Returns: 
            [bool] : If signature verification is successful, then return the True. Otherwise,
                raises RIMSignatureVerificationError.
        """
        if self.rim_name == 'driver':
            event_log.info("Driver rim cert has been extracted successfully")
        else:
            event_log.info("Vbios rim cert has been extracted successfully")
        try:
            # performs the signature verification of the RIM. We will get the root of the RIM
            # if the signature verification is successful otherwise, it raises InvalidSignature exception.
            verified_root = XMLVerifier().verify(self.root, ca_pem_file = settings.RIM_ROOT_CERT, ca_path = settings.ROOT_CERT_DIR).signed_xml

            if verified_root is None:
                err_msg = "\t\t\tRIM signature verification failed."
                event_log.error(err_msg)
                raise RIMSignatureVerificationError(err_msg)

        except InvalidSignature as error:
            err_msg = "\t\t\tRIM signature verification failed."
            event_log.error(err_msg)
            raise RIMSignatureVerificationError(err_msg)

        except Exception as error:
            info_log.error(error)
            err_msg = "\t\t\tRIM signature verification failed."
            event_log.error(err_msg)
            raise RIMSignatureVerificationError(err_msg)

        info_log.info(f"\t\t\t{self.rim_name} RIM signature verification successful.")
        self.root = verified_root
        if self.rim_name == 'driver':
            settings.mark_driver_rim_cert_validated_successfully()
        else:
            settings.mark_vbios_rim_cert_validated_successfully()
        return True