def testDeleteSignedBinary(self): binary1_urn = rdfvalue.RDFURN("aff4:/config/executables/foo1") binary2_urn = rdfvalue.RDFURN("aff4:/config/executables/foo2") signed_binary_utils.WriteSignedBinaryBlobs( binary1_urn, [rdf_crypto.SignedBlob().Sign(b"\x00", self._private_key)]) signed_binary_utils.WriteSignedBinaryBlobs( binary2_urn, [rdf_crypto.SignedBlob().Sign(b"\x11", self._private_key)]) self.assertCountEqual(signed_binary_utils.FetchURNsForAllSignedBinaries(), [binary1_urn, binary2_urn]) signed_binary_utils.DeleteSignedBinary(binary1_urn) self.assertCountEqual(signed_binary_utils.FetchURNsForAllSignedBinaries(), [binary2_urn])
def _ListSignedBlobs(self, token=None): roots = _GetSignedBlobsRoots() binary_urns = signed_binary_utils.FetchURNsForAllSignedBinaries(token=token) api_binaries = [] for binary_urn in sorted(binary_urns): for binary_type, root in iteritems(roots): relative_path = binary_urn.RelativeName(root) if relative_path: api_binary = _GetSignedBinaryMetadata(binary_type, relative_path) api_binaries.append(api_binary) return api_binaries