| [1359] | 1 | /* |
|---|
| 2 | * $Id$ |
|---|
| [1675] | 3 | * Copyright 2008-2010 The Eraser Project |
|---|
| [1359] | 4 | * Original Author: Joel Low <lowjoel@users.sourceforge.net> |
|---|
| 5 | * Modified By: |
|---|
| 6 | * |
|---|
| 7 | * This file is part of Eraser. |
|---|
| 8 | * |
|---|
| 9 | * Eraser is free software: you can redistribute it and/or modify it under the |
|---|
| 10 | * terms of the GNU General Public License as published by the Free Software |
|---|
| 11 | * Foundation, either version 3 of the License, or (at your option) any later |
|---|
| 12 | * version. |
|---|
| 13 | * |
|---|
| 14 | * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY |
|---|
| 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
|---|
| 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|---|
| 17 | * |
|---|
| 18 | * A copy of the GNU General Public License can be found at |
|---|
| 19 | * <http://www.gnu.org/licenses/>. |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | using System; |
|---|
| 23 | using System.Collections.Generic; |
|---|
| 24 | using System.Text; |
|---|
| 25 | using System.Windows.Forms; |
|---|
| 26 | |
|---|
| [2294] | 27 | using Eraser.Plugins; |
|---|
| [1359] | 28 | using Eraser.Util; |
|---|
| 29 | |
|---|
| 30 | namespace Eraser.DefaultPlugins |
|---|
| 31 | { |
|---|
| 32 | public sealed class DefaultPlugin : IPlugin |
|---|
| 33 | { |
|---|
| [2372] | 34 | public void Initialize(PluginInfo info) |
|---|
| [1359] | 35 | { |
|---|
| [2372] | 36 | Settings = new DefaultPluginSettings(info.PersistentStore); |
|---|
| [1359] | 37 | |
|---|
| 38 | //Then register the erasure methods et al. |
|---|
| [2372] | 39 | Host.Instance.ErasureMethods.Add(new Gutmann()); //35 passes |
|---|
| 40 | Host.Instance.ErasureMethods.Add(new DoD_EcE()); //7 passes |
|---|
| 41 | Host.Instance.ErasureMethods.Add(new RCMP_TSSIT_OPS_II()); //7 passes |
|---|
| 42 | Host.Instance.ErasureMethods.Add(new Schneier()); //7 passes |
|---|
| 43 | Host.Instance.ErasureMethods.Add(new VSITR()); //7 passes |
|---|
| 44 | Host.Instance.ErasureMethods.Add(new DoD_E()); //3 passes |
|---|
| 45 | Host.Instance.ErasureMethods.Add(new HMGIS5Enhanced()); //3 passes |
|---|
| 46 | Host.Instance.ErasureMethods.Add(new USAF5020()); //3 passes |
|---|
| 47 | Host.Instance.ErasureMethods.Add(new USArmyAR380_19()); //3 passes |
|---|
| 48 | Host.Instance.ErasureMethods.Add(new GOSTP50739()); //2 passes |
|---|
| 49 | Host.Instance.ErasureMethods.Add(new HMGIS5Baseline()); //1 pass |
|---|
| 50 | Host.Instance.ErasureMethods.Add(new Pseudorandom()); //1 pass |
|---|
| [1359] | 51 | EraseCustom.RegisterAll(); |
|---|
| [2372] | 52 | Host.Instance.ErasureMethods.Add(new FirstLast16KB()); |
|---|
| [1359] | 53 | |
|---|
| [2372] | 54 | Host.Instance.Prngs.Add(new RngCrypto()); |
|---|
| [1359] | 55 | |
|---|
| [2372] | 56 | Host.Instance.EntropySources.Add(new KernelEntropySource()); |
|---|
| [2055] | 57 | |
|---|
| [2372] | 58 | Host.Instance.FileSystems.Add(new Fat12FileSystem()); |
|---|
| 59 | Host.Instance.FileSystems.Add(new Fat16FileSystem()); |
|---|
| 60 | Host.Instance.FileSystems.Add(new Fat32FileSystem()); |
|---|
| 61 | Host.Instance.FileSystems.Add(new NtfsFileSystem()); |
|---|
| [2036] | 62 | |
|---|
| [2372] | 63 | Host.Instance.ErasureTargetFactories.Add(new FileErasureTarget()); |
|---|
| 64 | Host.Instance.ErasureTargetFactories.Add(new FolderErasureTarget()); |
|---|
| 65 | Host.Instance.ErasureTargetFactories.Add(new RecycleBinErasureTarget()); |
|---|
| 66 | Host.Instance.ErasureTargetFactories.Add(new UnusedSpaceErasureTarget()); |
|---|
| 67 | Host.Instance.ErasureTargetFactories.Add(new SecureMoveErasureTarget()); |
|---|
| 68 | Host.Instance.ErasureTargetFactories.Add(new DriveErasureTarget()); |
|---|
| [1359] | 69 | } |
|---|
| 70 | |
|---|
| 71 | public void Dispose() |
|---|
| 72 | { |
|---|
| 73 | GC.SuppressFinalize(this); |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | public string Name |
|---|
| 77 | { |
|---|
| 78 | get { return S._("Default Erasure Methods and PRNGs"); } |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | public string Author |
|---|
| 82 | { |
|---|
| 83 | get { return S._("The Eraser Project <eraser-development@lists.sourceforge.net>"); } |
|---|
| 84 | } |
|---|
| 85 | |
|---|
| 86 | public bool Configurable |
|---|
| 87 | { |
|---|
| 88 | get { return true; } |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | public void DisplaySettings(Control parent) |
|---|
| 92 | { |
|---|
| 93 | SettingsForm form = new SettingsForm(); |
|---|
| 94 | form.ShowDialog(); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /// <summary> |
|---|
| 98 | /// The dictionary holding settings for this plugin. |
|---|
| 99 | /// </summary> |
|---|
| 100 | internal static DefaultPluginSettings Settings; |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | /// <summary> |
|---|
| 104 | /// A concrete class to manage the settings for this plugin. |
|---|
| 105 | /// </summary> |
|---|
| 106 | internal class DefaultPluginSettings |
|---|
| 107 | { |
|---|
| [2372] | 108 | public DefaultPluginSettings(PersistentStore store) |
|---|
| [1359] | 109 | { |
|---|
| [2372] | 110 | Store = store; |
|---|
| [1359] | 111 | } |
|---|
| 112 | |
|---|
| 113 | /// <summary> |
|---|
| [2377] | 114 | /// The default file erasure method. This is a GUID since methods are |
|---|
| 115 | /// implemented through plugins and plugins may not be loaded and missing |
|---|
| 116 | /// references may follow. |
|---|
| 117 | /// </summary> |
|---|
| 118 | public Guid DefaultFileErasureMethod |
|---|
| 119 | { |
|---|
| 120 | get |
|---|
| 121 | { |
|---|
| 122 | //If the user did not define anything for this field, check all plugins |
|---|
| 123 | //and use the method which was declared by us to be the highest |
|---|
| 124 | //priority default |
|---|
| 125 | Guid result = Store.GetValue<Guid>("DefaultFileErasureMethod"); |
|---|
| 126 | if (result == Guid.Empty) |
|---|
| 127 | result = new Guid("{1407FC4E-FEFF-4375-B4FB-D7EFBB7E9922}"); |
|---|
| 128 | |
|---|
| 129 | return result; |
|---|
| 130 | } |
|---|
| 131 | set |
|---|
| 132 | { |
|---|
| 133 | Store.SetValue("DefaultFileErasureMethod", value); |
|---|
| 134 | } |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | /// <summary> |
|---|
| 138 | /// The default unused space erasure method. This is a GUID since methods |
|---|
| 139 | /// are implemented through plugins and plugins may not be loaded and |
|---|
| 140 | /// missing references may follow. |
|---|
| 141 | /// </summary> |
|---|
| 142 | public Guid DefaultUnusedSpaceErasureMethod |
|---|
| 143 | { |
|---|
| 144 | get |
|---|
| 145 | { |
|---|
| 146 | Guid result = Store.GetValue<Guid>("DefaultUnusedSpaceErasureMethod"); |
|---|
| 147 | if (result == Guid.Empty) |
|---|
| 148 | result = new Guid("{BF8BA267-231A-4085-9BF9-204DE65A6641}"); |
|---|
| 149 | return result; |
|---|
| 150 | } |
|---|
| 151 | set |
|---|
| 152 | { |
|---|
| 153 | Store.SetValue("DefaultUnusedSpaceErasureMethod", value); |
|---|
| 154 | } |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | /// <summary> |
|---|
| 158 | /// The PRNG used. This is a GUID since PRNGs are implemented through |
|---|
| 159 | /// plugins and plugins may not be loaded and missing references may follow. |
|---|
| 160 | /// </summary> |
|---|
| 161 | public Guid ActivePrng |
|---|
| 162 | { |
|---|
| 163 | get |
|---|
| 164 | { |
|---|
| 165 | Guid result = Store.GetValue<Guid>("ActivePRNG"); |
|---|
| 166 | if (result == Guid.Empty) |
|---|
| 167 | result = new Guid("{6BF35B8E-F37F-476e-B6B2-9994A92C3B0C}"); |
|---|
| 168 | return result; |
|---|
| 169 | } |
|---|
| 170 | set |
|---|
| 171 | { |
|---|
| 172 | Store.SetValue("ActivePRNG", value); |
|---|
| 173 | } |
|---|
| 174 | } |
|---|
| 175 | |
|---|
| 176 | /// <summary> |
|---|
| [1359] | 177 | /// The First/last 16 kilobyte erasure method. |
|---|
| 178 | /// </summary> |
|---|
| 179 | public Guid FL16Method |
|---|
| 180 | { |
|---|
| 181 | get |
|---|
| 182 | { |
|---|
| [2372] | 183 | return Store.GetValue<Guid>("FL16Method"); |
|---|
| [1359] | 184 | } |
|---|
| 185 | set |
|---|
| 186 | { |
|---|
| [2372] | 187 | Store.SetValue("FL16Method", value); |
|---|
| [1359] | 188 | } |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | /// <summary> |
|---|
| 192 | /// The set of custom erasure methods. |
|---|
| 193 | /// </summary> |
|---|
| 194 | public Dictionary<Guid, CustomErasureMethod> EraseCustom |
|---|
| 195 | { |
|---|
| 196 | get |
|---|
| 197 | { |
|---|
| [2372] | 198 | return Store.GetValue<Dictionary<Guid, CustomErasureMethod>>("EraseCustom"); |
|---|
| [1359] | 199 | } |
|---|
| 200 | set |
|---|
| 201 | { |
|---|
| [2372] | 202 | Store.SetValue("EraseCustom", value); |
|---|
| [1359] | 203 | } |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | /// <summary> |
|---|
| 207 | /// The data store for our settings. |
|---|
| 208 | /// </summary> |
|---|
| [2372] | 209 | PersistentStore Store; |
|---|
| [1359] | 210 | } |
|---|
| 211 | } |
|---|