Пример #1
0
        public static IDstFSInterop Load(string accountid, string applicationkey,
                                         string bucketid, string bucketname, string connectionSettingsFile = null,
                                         string password = null)
        {
            BackblazeDstInterop backblazeDstInterop = new BackblazeDstInterop(accountid, applicationkey, bucketid, bucketname,
                                                                              connectionSettingsFile);

            if (password != null)
            {
                byte[]    keyfile   = backblazeDstInterop.LoadIndexFileAsync(null, IndexFileType.EncryptorKeyFile).Result;
                AesHelper encryptor = AesHelper.CreateFromKeyFile(keyfile, password);
                backblazeDstInterop.Encryptor = encryptor;
            }
            return(backblazeDstInterop);
        }
Пример #2
0
        public static IDstFSInterop InitializeNew(string accountid,
                                                  string applicationkey, string bucketid, string bucketname,
                                                  string connectionSettingsFile = null, string password = null)
        {
            BackblazeDstInterop backblazeDstInterop = new BackblazeDstInterop(accountid, applicationkey, bucketid,
                                                                              bucketname, connectionSettingsFile);

            if (password != null)
            {
                AesHelper encryptor = AesHelper.CreateFromPassword(password);
                byte[]    keyfile   = encryptor.CreateKeyFile();
                backblazeDstInterop.StoreIndexFileAsync(null, IndexFileType.EncryptorKeyFile, keyfile).Wait();
                backblazeDstInterop.Encryptor = encryptor;
            }
            return(backblazeDstInterop);
        }