예제 #1
0
	def checkAllContactsKeys():
		for c in DbClient.getMessageableContacts():
			torId = c.get("torid", None) if c else None
			if torId:
				keyId = c.get("keyid", None)
				if not keyId:
					print("No keyid found for torid", torId)
				elif not CryptoClient.getPublicKey(keyId):
					print("CryptoClient hasn't got a public key for torid", torId)
				if not keyId or not CryptoClient.getPublicKey(keyId):
					# We haven't got their key in our keyring!
					DbClient.updateContact(torId, {"status":"requested"})
예제 #2
0
	def getPublicKey(self, torid):
		'''Use the keyid stored in mongo, and get the corresponding public key from the Crypto module'''
		profile = DbClient.getProfile(torid)
		if profile is not None:
			keyid = profile.get('keyid', None)
			if keyid is not None:
				return CryptoClient.getPublicKey(keyid)
예제 #3
0
 def checkAllContactsKeys():
     '''Return a list of names for which the key can't be found'''
     nameList = []
     for c in DbI.getMessageableProfiles():
         torId = c['torid'] if c else None
         if torId:
             keyId = c['keyid']
             if not keyId:
                 print("No keyid found for torid", torId)
                 nameList.append(c['displayName'])
             elif not CryptoClient.getPublicKey(keyId):
                 print("CryptoClient hasn't got a public key for torid",
                       torId)
                 nameList.append(c['displayName'])
             if not keyId or not CryptoClient.getPublicKey(keyId):
                 # We haven't got their key in our keyring!
                 DbI.updateProfile(torId, {"status": "requested"})
     return nameList
예제 #4
0
파일: message.py 프로젝트: bellyfat/Murmeli
 def getPublicKey(self, torid):
     '''Use the keyid stored in the db, and get the corresponding public key from the Crypto module'''
     profile = DbI.getProfile(torid)
     keyid = profile.get('keyid', None) if profile else None
     if keyid:
         return CryptoClient.getPublicKey(keyid)