将秘密共享文件上载到Azure Blob存储

时间:2016-04-05 22:52:56

标签: c# asp.net byte azure-storage azure-storage-blobs

我正在尝试将文件拆分成碎片,然后将每个共享上传到blob存储中,这是我到目前为止的代码。

                [HttpPost]
    public ActionResult Upload(HttpPostedFileBase image)
    {
        int n = 5, t = 3;
        RandomSources r = RandomSources.SHA1;
        Encryptors e = Encryptors.ChaCha20;
        Algorithms a = Algorithms.CSS;
        if (image.ContentLength > 0)

        {
            Facade f = new Facade(n, t, r, e, a);
            Byte[] bytes = ObjectToByteArray(image.InputStream);
            Share[] shares = f.split(bytes);

            foreach (Share share in shares)
            {
                byte[] serialized = share.serialize();
            }

            CloudBlobContainer blobContainer = _blobStorageService.GetCloudBlobContainer();
            CloudBlockBlob blob = blobContainer.GetBlockBlobReference(image.FileName);

                 blob.UploadFromByteArray(bytes, 0, bytes.Length);
                blob.UploadFromStream(serialized);

        }
        return RedirectToAction("Upload");
    }

有没有人有任何关于如何改变这一点的建议,因为当我尝试使用上传表格时它不起作用并且不会产生任何错误。

0 个答案:

没有答案
相关问题