Exemplo n.º 1
0
        public async Task StoreItem(string repo, string passphrase, string itemId, StoredItemMetadata meta, Stream dataStream)
        {
            var masterKey = await GetRepositoryMasterKey(repo, passphrase);

            var iv = crypto.GenerateRandomIV();

            meta = meta with {
                Base64IV = Convert.ToBase64String(iv)
            };

            var encryptedStream = crypto.CreateEncryptionStream(dataStream, masterKey, iv);

            await SetItemMetadata(repo, passphrase, itemId, meta);

            await driver.WriteItem(repo, itemId, encryptedStream);
        }