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); } }
public void DeleteArchive(Archive archive) { using (DalArchive dalArchive = new DalArchive()) { dalArchive.DeleteArchive(archive); } }
public IEnumerable GetArchives() { using (DalArchive dalArchive = new DalArchive()) { return(dalArchive.GetArchivesList()); } }
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); } }