一种云端存储文件的方法和系统的制作方法_2

文档序号:8925268阅读:来源:国知局

[005引 3、如果完整,则通过明文哈希值将所述密文块解密为明文块;
[0化9] 4、将所述明文块还原为待下载文件。
[0060] 上传文件举例说明:
[0061] 1)、准备工作,在用户中屯、新建表user_file_inf0(表1),在管理中屯、新建表 cloud_file_info(表 2);
[0062] ..................................................................................................................................................................................................................................................... ................................................................................................
[00化]表2
[0066] 2)、对欲上传文件进行切块,得到明文块列表plaintext_block_list<b_ offset, b_length, block〉,将文件的文件名、文件类型存储到user_file_info中的f_name 和f_type字段中,遍历plaintext_block_list并进行哈希计算,得到plaintext_block_ hashcode,将plaintext_block_offset、plaintext_block_length、pliantext_block_ hashcode,将这些值分别存储到user_file_info中的b_offset、b_length、plaintext_HC 字段中,如图2a所示为本发明实施例提供的计算明文哈希值的示意图;
[0067] 3)、对pliantext_block_list进行去重。遍历2)中得到新的明文块和明 文块哈希值列表pliantext_block_hashcode_list<plaintext_hashcode,block〉, 对plaintext_block_hashcode_list进行去重,得到新的de_plaintext_block_ hashcode_list<plaintext_hashcode, block〉;结束此过程,则完成了源端去重(source deduplication),如图化所示为本发明实施例提供的明文块去重的示意图;
[0068] 4)、将plaintext_hashcode作为密钥,对de_plaintext_block_hashcode_list 中的block分别进行对称加密,得到密文块哈希值和密文块ciphertext_block_hashcode_ list〈ciphertext_hashcode,ciphertext-block〉并将ciphertext_block_hashcode分蔚J 对应的存储到user_file_info和cloud_file_info中的ciphertext_HC字段。在存入cloud_file_info时要进行唯一性判断(可能存在与其它文件一样的ciphertext_block), cloud_file_info中ciphertext_HC是唯一的,如果检测到已经有相同的ciphertext_ block_hashcode存在,则不再存入,并将该ciphertext_block从ciphertext_block_ hashcode_list中移除,完成密文去重工作,如图2c所示为本发明实施例提供的密文块去 重的示意图;
[0069] 5)、把密文块传输到云服务器上。通过4)得到去重后的de_ciphertext_block_ hashcode_list〈ciphertext_hashcode,ciphertext-block〉。臥ciphertext-hashcode 为云存储Key,通过冗余算法将ciphertext_block随机存储到多个云存储服务器上,并 将存储的bucket(云端文件夹)和云存储服务器的相关信息存入cloiKi_file_info中的 cloucLinfo字段当中(如存储到了S个云存储服务器云A、云B、云C,任意去bucket名 为bucketName,则在cloud_info字段中存入"云A/bucketName,云B/bucketName,云C/ bucketName")。依次遍历整个de_ciphe:rtext_block_hashcode_list,完成文件的上传,如 图2d所示为本发明实施例提供的文件上传的示意图。
[0070] 下载文件举例说明,如图2e所示为本发明实施例提供的下载文件的流程图:
[0071] 1)、首先用户发起下载文件请求,从用户请求中得到文件名和文件类型,臥文件 名和文件类型为参数,从用户中屯、的user_file_info表中查询到所有的block_record_ list<record〉。根据文件名和文件类型建立新的空文件new_file ;
[0072] 2)、从block_record_list中取出完整的ciphertext_HC集合(元素互异)的值 列表ciphertext_block_hashcode_list〈ciphertext_hashcode〉;
[0073] 3)、将 2)中得到的ciphertext_block_hashcode_list发送给管理中屯、,根据 ciphertext_block_hashcode_list中的ciphertext_hashcode从管理服务器cloud_file_ info表中查询到对应的ciphertext_hashcode_cloudinfo_list〈ciphertext_hashcode, cloud_info〉的列表;
[0074] 4)、根据 3)中的得到的ciphertext_hashcode_cloudinfo_list,从云端下载 数据块,臥ciphei'tetxjiashcode为云存储端Key,从cloud_info中取出一个相关的云 存储服务器相关信息,据臥上信息即可从云存储服务器上获取到Key为ciphertext, hashcode的ciphertext_block,对得到的cipei'textjDlock进行哈希计算,对比计算值与 ciphertext_hashcode,如果不一致说明数据块在云端已经损坏,便可臥从cloud_info中 取其它值再次下载,可臥提高数据块的完整性和可靠性。依次遍历ciphertext_hashcode_ cloudinfo_list便可臥得到密文哈希值和密文块对应的数据块列表ciphertext_ hashcode_block_list〈ciphertext_hashcode,ciphertext-block〉;
[0075] 5)、对密文块解密。依据1)中得到的block_record_list可臥筛选出一一对 应的明文块哈希值和密文块哈希值列表plaintext_hashcode_ciphertext_hashcode_ list<plaintext_hashcode,ciphertext_hashco de〉,臥该列表中明文块哈希值 plaintext_hashcode为密钥对应的对4)中得到的ciphertext_hashcode_block_list 中的密文块进行解密,得到明文块哈希值和明文块列表plaintext_hashcode_block_ list〈plaintext_hashcode,block〉;
[0076] 6)、对文件进行还原。根据1)中block_record_list得到文件块偏移量等信息 对应元数据列表block_offset_length_hashcode_list<b_offset,b_length,plaintext-hashcode〉,结合4中plaintext_hashcode_block_li
当前第2页1 2 3 
网友询问留言 已有0条留言
  • 还没有人留言评论。精彩留言会获得点赞!
1