def _get_signature_date(self, uri):
        """Read the date-stamp from the signature of the cached interface.
		If the date-stamp is unavailable, returns None."""
        import trust
        sigs = self.get_cached_signatures(uri)
        if sigs:
            return self._oldest_trusted(sigs, trust.domain_from_url(uri))
示例#2
0
	def _get_signature_date(self, uri):
		"""Read the date-stamp from the signature of the cached interface.
		If the date-stamp is unavailable, returns None."""
		import trust
		sigs = self.get_cached_signatures(uri)
		if sigs:
			return self._oldest_trusted(sigs, trust.domain_from_url(uri))
    def update_interface_if_trusted(self, interface, sigs, xml):
        """Update a cached interface (using L{update_interface_from_network})
		if we trust the signatures.
		If we don't trust any of the signatures, do nothing.
		@param interface: the interface being updated
		@type interface: L{model.Interface}
		@param sigs: signatures from L{gpg.check_stream}
		@type sigs: [L{gpg.Signature}]
		@param xml: the downloaded replacement interface document
		@type xml: str
		@return: True if the interface was updated
		@rtype: bool
		"""
        import trust
        updated = self._oldest_trusted(sigs,
                                       trust.domain_from_url(interface.uri))
        if updated is None: return False  # None are trusted

        self.update_interface_from_network(interface, xml, updated)
        return True
示例#4
0
	def update_feed_if_trusted(self, feed_url, sigs, xml):
		"""Update a cached feed (using L{update_feed_from_network})
		if we trust the signatures.
		If we don't trust any of the signatures, do nothing.
		@param feed_url: the feed being updated
		@type feed_url: str
		@param sigs: signatures from L{gpg.check_stream}
		@type sigs: [L{gpg.Signature}]
		@param xml: the downloaded replacement feed document
		@type xml: str
		@return: True if the feed was updated
		@rtype: bool
		@since: 0.48
		"""
		import trust
		updated = self._oldest_trusted(sigs, trust.domain_from_url(feed_url))
		if updated is None: return False	# None are trusted

		self.update_feed_from_network(feed_url, xml, updated)
		return True