public static IDstFSInterop Load(string dstpath, string?password = null) { DiskDstFSInterop diskDstFSInterop = new DiskDstFSInterop(dstpath); if (password != null) { byte[] keyfile = diskDstFSInterop.LoadIndexFileAsync(null, IndexFileType.EncryptorKeyFile).Result; AesHelper encryptor = AesHelper.CreateFromKeyFile(keyfile, password); diskDstFSInterop.Encryptor = encryptor; } return(diskDstFSInterop); }
public static IDstFSInterop InitializeNew(string dstpath, string?password = null) { DiskDstFSInterop diskDstFSInterop = new DiskDstFSInterop(dstpath); if (password != null) { AesHelper encryptor = AesHelper.CreateFromPassword(password); byte[] keyfile = encryptor.CreateKeyFile(); diskDstFSInterop.StoreIndexFileAsync(null, IndexFileType.EncryptorKeyFile, keyfile).Wait(); diskDstFSInterop.Encryptor = encryptor; } return(diskDstFSInterop); }