Exemple #1
0
        public Archive GetArchive(string archiveName, string archivePassphrase)
        {
            using (DalArchive dalArchive = new DalArchive())
            {
                // Call Entity framework
                Archive archiveFound = dalArchive.GetArchiveData(archiveName);

                if (archiveFound == null)
                {
                    throw new Exception("Unable to retrieve archive with name " + archiveName);
                }

                try
                {
                    archiveFound.OwnerDecrypted = DataEncrypter.Decrypt(archiveFound.OwnerEncrypted, archivePassphrase);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw new Exception("Error, cannot decrypt archive.");
                }

                return(archiveFound);
            }
        }
Exemple #2
0
 public void DeleteArchive(Archive archive)
 {
     using (DalArchive dalArchive = new DalArchive())
     {
         dalArchive.DeleteArchive(archive);
     }
 }
Exemple #3
0
 public IEnumerable GetArchives()
 {
     using (DalArchive dalArchive = new DalArchive())
     {
         return(dalArchive.GetArchivesList());
     }
 }
Exemple #4
0
        public void CreateArchive(string archiveName, string archivePassphrase)
        {
            using (DalArchive dalArchive = new DalArchive())
            {
                // Generate owner unique name that'll be used for decrypting
                string ownerReference = DateTime.Now.ToString("yyyyMMddHHmmssffff");

                string encryptedName = DataEncrypter.Encrypt(ownerReference, archivePassphrase);

                // Call Entity framework
                dalArchive.CreateArchive(encryptedOwnerName: (encryptedName), archiveName: archiveName);
            }
        }