Пример #1
0
        public Task <bool> CreateFolder(string path, bool encrypt = true)
        {
            return(Task.Run(() =>
            {
                var explorer = new RemoteExplorer();
                var result = explorer.CreateFolder(path);

                // kijken of het een map op rootniveau is
                if (encrypt && path.Count(e => e == '/') == 1)
                {
                    AESKeyAndIVGenerator gen = new AESKeyAndIVGenerator();
                    var box = GetSelectedOrDefaultBox();
                    var post = new AesKeyPost()
                    {
                        User = null,
                        Key = Convert.ToBase64String(CryptoHelper.EncryptPgp(gen.aesKey, box.PublicKey)),
                        IV = Convert.ToBase64String(CryptoHelper.EncryptPgp(gen.aesIV, box.PublicKey))
                    };

                    var keyResult = explorer.AddAesKey(path, post);
                }
                return result;
            }));
        }
Пример #2
0
        public Task<bool> CreateFolder(string path, bool encrypt = true) {
            return Task.Run(() =>
            {
                var explorer = new RemoteExplorer();
                var result = explorer.CreateFolder(path);

                // kijken of het een map op rootniveau is
                if(encrypt && path.Count(e => e == '/') == 1) {
                    AESKeyAndIVGenerator gen = new AESKeyAndIVGenerator();
                    var box = GetSelectedOrDefaultBox();
                    var post = new AesKeyPost() {
                        User = null,
                        Key = Convert.ToBase64String(CryptoHelper.EncryptPgp(gen.aesKey, box.PublicKey)),
                        IV = Convert.ToBase64String(CryptoHelper.EncryptPgp(gen.aesIV, box.PublicKey))
                    };

                    var keyResult = explorer.AddAesKey(path, post);
                }
                return result;
            });
        }