Esempio n. 1
0
def attachment_storage_name( message_timestamp, message_id, attachment ):
   m = hashlib.sha256()
   m.update( storage.PATH_SALT )        # defend against attacker knowing the hash of the content
   m.update( str(attachment) )
   attachment_hash = m.hexdigest()
   
   full_name = "%s-%s-%s" % (str(message_timestamp), str(message_id), str(attachment_hash))
   
   full_name_safe = storage.salt_string( full_name )
   return full_name_safe
Esempio n. 2
0
def make_contact_path( pubkey_str, email_addr ):
   global STORAGE_DIR
   
   """
   enc_filename = storage.encrypt_data( pubkey_str, email_addr )
   enc_filename_salted = storage.salt_string( enc_filename )
   enc_filename_b64 = base64.b64encode( enc_filename_salted )
   """
   # TODO: make this scheme IND-CPA
   filename_salted = storage.salt_string( email_addr )
   filename_b64 = base64.b64encode( filename_salted )
   return storage.volume_path( STORAGE_DIR, filename_b64 )