Changeset 727


Ignore:
Timestamp:
Oct 15, 2009, 2:27:33 PM (12 years ago)
Author:
kopal
Message:
  • cleaned up the source code of RSA (added comments header for each method, sorted methods and so on)
  • also corrected a failure which appeared because of the context menu (icons missing) -> RSAKeyGenerator now do not have (and do not need) a context menu for selecting the src of the keys
Location:
trunk/CrypPlugins/RSA
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/RSA/RSA.cs

    r665 r727  
    3131    [Author("Dennis Nolte,Raoul Falk, Sven Rech, Nils Kopal", null, "Uni Duisburg-Essen", "http://www.uni-due.de")]
    3232    [PluginInfo(false, "RSA", "RSA En/Decryption", "", "RSA/iconrsa.png", "RSA/Images/encrypt.png", "RSA/Images/decrypt.png")]
    33 
    3433    [EncryptionType(EncryptionType.Asymmetric)]
    35 
     34    /// <summary>
     35    /// This plugin does a RSA encryption/decryption on a Message M / Ciphertext C
     36    /// It also encrypts/decrypts text with RSA
     37    /// </summary>
    3638    class RSA : IEncryption
    3739    {
    38         #region IPlugin Members
     40        #region private members
    3941
    4042        private RSASettings settings = new RSASettings();
     
    4951        private bool stopped = true;
    5052
     53        #endregion
     54
     55        #region events
     56
    5157        public event GuiLogNotificationEventHandler OnGuiLogNotificationOccured;
    5258        public event PluginProgressChangedEventHandler OnPluginProgressChanged;
    53 
     59        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
     60        public event StatusChangedEventHandler OnPluginStatusChanged;
     61
     62        #endregion
     63
     64        #region public
     65       
     66        /// <summary>
     67        /// Notify that a property changed
     68        /// </summary>
     69        /// <param name="name">property name</param>
     70        public void OnPropertyChanged(string name)
     71        {
     72            EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs(name));
     73        }
     74
     75        /// <summary>
     76        /// Gets/Sets the Settings of this plugin
     77        /// </summary>
    5478        public ISettings Settings
    5579        {
     
    5882        }
    5983
     84        /// <summary>
     85        /// Get the Presentation of this plugin
     86        /// </summary>
    6087        public System.Windows.Controls.UserControl Presentation
    6188        {
     
    6390        }
    6491
     92        /// <summary>
     93        /// Get the QuickWatchRepresentation of this plugin
     94        /// </summary>
    6595        public System.Windows.Controls.UserControl QuickWatchPresentation
    6696        {
     
    6898        }
    6999
     100        /// <summary>
     101        /// Called by the environment before execution
     102        /// </summary>
    70103        public void PreExecution()
    71104        {
     
    73106        }
    74107
     108        /// <summary>
     109        /// Called by the environment to execute this plugin
     110        /// Does RSA on M/C and encrypt/decrypt the input Text
     111        /// This method starts threads to speed RSA up if the user switched on more than one
     112        /// thread
     113        /// </summary>
    75114        public void Execute()
    76115        {
     
    178217        }//end Execute
    179218
    180         /**
    181          * Encrypts/Decrypts all blocks belonging to the thread nr
    182          */
     219        /// <summary>
     220        /// Called by the environment after execution of this plugin
     221        /// </summary>
     222        public void PostExecution()
     223        {
     224            this.stopped = true;
     225        }
     226
     227        /// <summary>
     228        /// Called by the environment to pause this plugin
     229        /// </summary>
     230        public void Pause()
     231        {
     232        }
     233
     234        /// <summary>
     235        /// Called by the environment to stop this plugin
     236        /// </summary>
     237        public void Stop()
     238        {
     239            this.stopped = true;
     240        }
     241
     242        /// <summary>
     243        /// Called by the environment to initialize this plugin
     244        /// </summary>
     245        public void Initialize()
     246        {
     247            this.stopped = true;
     248        }
     249
     250        /// <summary>
     251        /// Called by the environment to Dispose this plugin
     252        /// </summary>
     253        public void Dispose()
     254        {
     255
     256        }
     257
     258        /// <summary>
     259        /// Gets/Sets the one part of the public/private key called N
     260        /// </summary>
     261        [PropertyInfo(Direction.InputData, "Public Key / Private Key N Input", "Input your Public Key / Private key N here", "", DisplayLevel.Beginner)]
     262        public BigInteger InputN
     263        {
     264            get
     265            {
     266                return inputN;
     267            }
     268            set
     269            {
     270                this.inputN = value;
     271                OnPropertyChanged("InputN");
     272            }
     273        }
     274
     275        /// <summary>
     276        /// Gets/Sets a input message/ciphertext as BigInteger called M / C
     277        /// </summary>
     278        [PropertyInfo(Direction.InputData, "Message M / Ciphertext C Input", "Input your Message M / Ciphertext C here", "", DisplayLevel.Beginner)]
     279        public BigInteger InputMC
     280        {
     281            get
     282            {
     283                return inputmc;
     284            }
     285            set
     286            {
     287                this.inputmc = value;
     288                OnPropertyChanged("InputMC");
     289            }
     290        }
     291
     292        /// <summary>
     293        /// Gets/Sets the one part of the public/private key called E / D
     294        /// </summary>
     295        [PropertyInfo(Direction.InputData, "Public Key E / Private Key D input", "Input your public Key E / Private Key D here", "", DisplayLevel.Beginner)]
     296        public BigInteger InputED
     297        {
     298            get
     299            {
     300                return inputed;
     301            }
     302            set
     303            {
     304                this.inputed = value;
     305                OnPropertyChanged("InputED");
     306            }
     307        }
     308
     309        /// <summary>
     310        /// Gets/Sets a output message/ciphertext as BigInteger called C / M
     311        /// </summary>
     312        [PropertyInfo(Direction.OutputData, "Cipher C Output / Message M Output", "Your Cipher C / Message M will be send here", "", DisplayLevel.Beginner)]
     313        public BigInteger OutputMC
     314        {
     315            get
     316            {
     317                return outputmc;
     318            }
     319            set
     320            {
     321                this.outputmc = value;
     322                OnPropertyChanged("OutputMC");
     323            }
     324        }
     325
     326        /// <summary>
     327        /// Gets/Sets a text input for encryption/decryption
     328        /// </summary>
     329        [PropertyInfo(Direction.InputData, "Text Input", "Input your Text here", "", DisplayLevel.Beginner)]
     330        public byte[] InputText
     331        {
     332            get
     333            {
     334                return inputText;
     335            }
     336            set
     337            {
     338                this.inputText = value;
     339                //GuiLogMessage("InputText: " + (int)inputText[0] + " " + (int)inputText[1] + " " + (int)inputText[2] + " " + (int)inputText[3] + " ", NotificationLevel.Info);
     340                OnPropertyChanged("InputText");
     341            }
     342        }
     343
     344        /// <summary>
     345        /// Gets/Sets a text output for encrypted/decrypted data
     346        /// </summary>       
     347        [PropertyInfo(Direction.OutputData, "Text Output", "Your Text will be send here", "", DisplayLevel.Beginner)]
     348        public byte[] OutputText
     349        {
     350            get
     351            {
     352                return outputText;
     353            }
     354            set
     355            {
     356                this.outputText = value;
     357                //GuiLogMessage("OutputText: " + (int)outputText[0] + " " +(int)outputText[1] + " "+(int)outputText[2] + " "+(int)outputText[3] + " ", NotificationLevel.Info);
     358                OnPropertyChanged("OutputText");
     359            }
     360        }
     361
     362        #endregion
     363
     364        #region private
     365
     366        /// <summary>
     367        /// Encrypts/Decrypts all blocks belonging to the thread nr
     368        /// </summary>
     369        /// <param name="parameters">parameters</param>
    183370        private void crypt(Object parameters)
    184371        {
     
    255442        }//end crypt
    256443       
    257         /*
    258          * Remove all '0' from a byte array
    259          */
     444        /// <summary>
     445        /// Remove all '0' from a byte arrays end
     446        /// example
     447        ///
     448        /// { 'a','b','c',0,0 } => { 'a','b','c' }
     449        /// </summary>
     450        /// <param name="input">byte array</param>
     451        /// <returns>byte array</returns>
    260452        private byte[] removeZeros(byte[] input)
    261453        {
     
    285477
    286478            return output;
    287         }       
    288 
    289         public void PostExecution()
    290         {
    291             this.stopped = true;
    292         }
    293 
    294         public void Pause()
    295         {
    296            
    297         }
    298 
    299         public void Stop()
    300         {
    301             this.stopped = true;
    302         }
    303 
    304         public void Initialize()
    305         {
    306             this.stopped = true;
    307         }
    308 
    309         public void Dispose()
    310         {
    311            
     479        }
     480
     481        /// <summary>
     482        /// Change the progress of this plugin
     483        /// </summary>
     484        /// <param name="value">value</param>
     485        /// <param name="max">max</param>
     486        private void ProgressChanged(double value, double max)
     487        {
     488            EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(value, max));
     489        }
     490
     491        /// <summary>
     492        /// Logg a message to cryptool
     493        /// </summary>
     494        /// <param name="p">p</param>
     495        /// <param name="notificationLevel">notificationLevel</param>
     496        private void GuiLogMessage(string p, NotificationLevel notificationLevel)
     497        {
     498            EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p, this, notificationLevel));
    312499        }
    313500
    314501        #endregion
    315502
    316         #region RSAInOut
    317 
    318         [PropertyInfo(Direction.InputData, "Public Key / Private Key N Input", "Input your Public Key / Private key N here", "", DisplayLevel.Beginner)]
    319         public BigInteger InputN
    320         {
    321             get
    322             {
    323                 return inputN;
    324             }
    325             set
    326             {
    327                 this.inputN = value;
    328                 OnPropertyChanged("InputN");
    329             }
    330         }
    331 
    332         [PropertyInfo(Direction.InputData, "Message M / Ciphertext C Input", "Input your Message M / Ciphertext C here", "", DisplayLevel.Beginner)]
    333         public BigInteger InputMC
    334         {
    335             get
    336             {
    337                 return inputmc;
    338             }
    339             set
    340             {
    341                 this.inputmc = value;
    342                 OnPropertyChanged("InputMC");
    343             }
    344         }
    345 
    346         [PropertyInfo(Direction.InputData, "Public Key E / Private Key D input", "Input your public Key E / Private Key D here", "", DisplayLevel.Beginner)]
    347         public BigInteger InputED
    348         {
    349             get
    350             {
    351                 return inputed;
    352             }
    353             set
    354             {
    355                 this.inputed = value;
    356                 OnPropertyChanged("InputED");
    357             }
    358         }
    359        
    360         [PropertyInfo(Direction.OutputData, "Cipher C Output / Message M Output", "Your Cipher C / Message M will be send here", "", DisplayLevel.Beginner)]
    361         public BigInteger OutputMC
    362         {
    363             get
    364             {
    365                 return outputmc;
    366             }
    367             set
    368             {
    369                 this.outputmc = value;
    370                 OnPropertyChanged("OutputMC");
    371             }
    372         }
    373 
    374         [PropertyInfo(Direction.InputData, "Text Input", "Input your Text here", "", DisplayLevel.Beginner)]
    375         public byte[] InputText
    376         {
    377             get
    378             {
    379                 return inputText;
    380             }
    381             set
    382             {
    383                 this.inputText = value;
    384                 //GuiLogMessage("InputText: " + (int)inputText[0] + " " + (int)inputText[1] + " " + (int)inputText[2] + " " + (int)inputText[3] + " ", NotificationLevel.Info);
    385                 OnPropertyChanged("InputText");
    386             }
    387         }
    388 
    389         [PropertyInfo(Direction.OutputData, "Text Output", "Your Text will be send here", "", DisplayLevel.Beginner)]
    390         public byte[] OutputText
    391         {
    392             get
    393             {
    394                 return outputText;
    395             }
    396             set
    397             {
    398                 this.outputText = value;
    399                 //GuiLogMessage("OutputText: " + (int)outputText[0] + " " +(int)outputText[1] + " "+(int)outputText[2] + " "+(int)outputText[3] + " ", NotificationLevel.Info);
    400                 OnPropertyChanged("OutputText");
    401             }
    402         }
    403 
    404         #endregion
    405 
    406         #region INotifyPropertyChanged Members
    407 
    408 
    409         public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    410 
    411         public void OnPropertyChanged(string name)
    412         {
    413             EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs(name));
    414         }
    415 
    416         private void ProgressChanged(double value, double max)
    417         {
    418             EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(value, max));
    419         }
    420 
    421         private void GuiLogMessage(string p, NotificationLevel notificationLevel)
    422         {
    423             EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p, this, notificationLevel));
    424         }
    425 
    426         #endregion
    427 
    428         #region IPlugin Members
    429 
    430         public event StatusChangedEventHandler OnPluginStatusChanged;
    431 
    432         #endregion
    433     }
    434 }
     503    }//end rsa
     504
     505}//end namespace
  • trunk/CrypPlugins/RSA/RSAKeyGenerator.cs

    r668 r727  
    2626using System.Security.Cryptography.X509Certificates;
    2727
     28
    2829namespace Cryptool.Plugins.RSA
    2930{
    3031    [Author("Dennis Nolte,Raoul Falk, Sven Rech, Nils Kopal", "", "Uni Duisburg-Essen", "http://www.uni-due.de")]
    3132    [PluginInfo(true, "RSAKeyGenerator", "RSA Key Generator", "", "RSA/iconkey.png", "RSA/iconkey.png", "RSA/iconkey.png", "RSA/iconkey.png")]
    32 
    3333    [EncryptionType(EncryptionType.Asymmetric)]
     34    ///<summary>
     35    /// This plugin is a generator plugin which helps the user to generate pairs of private/public keys
     36    /// for the RSA algorithm
     37    ///
     38    /// there are several modes:
     39    ///
     40    /// 1. manual
     41    ///     in this mode the p and q or the n and e and d are given by the user, the d also may be generated
     42    ///     
     43    /// 2. generated
     44    ///     in this mode all will be generated by microsoft classes
     45    ///     
     46    /// 3. certificate
     47    ///     in this mode a x509 certificate will be loaded (the user can give a password for loading)
     48    /// </summary>   
    3449    class RSAKeyGenerator : IEncryption
    3550    {
    36         #region Properties
    37 
    38         private BigInteger n;
    39         [PropertyInfo(Direction.OutputData, "N", "N", "", DisplayLevel.Beginner)]
    40         public BigInteger N
    41         {
    42             get
    43             {
    44                 return n;
    45             }
    46             set
    47             {
    48                 this.n = value;
    49                 OnPropertyChanged("N");
    50             }
    51         }
    52 
     51        #region private members
     52
     53        private BigInteger n;       
    5354        private BigInteger e;
    54         [PropertyInfo(Direction.OutputData, "E", "public exponent", "", DisplayLevel.Beginner)]
    55         public BigInteger E
    56         {
    57             get
    58             {
    59                 return e;
    60             }
    61             set
    62             {
    63                 this.e = value;
    64                 OnPropertyChanged("E");
    65             }
    66         }
    67 
    6855        private BigInteger d;
    69         [PropertyInfo(Direction.OutputData, "D", "private exponent", "", DisplayLevel.Beginner)]
    70         public BigInteger D
    71         {
    72             get
    73             {
    74                 return d;
    75             }
    76             set
    77             {
    78                 this.d = value;
    79                 OnPropertyChanged("D");
    80             }
    81         }
     56        private RSAKeyGeneratorSettings settings = new RSAKeyGeneratorSettings();
    8257
    8358        #endregion
    84 
    85         #region IPlugin Members
     59       
     60        #region envents
    8661
    8762        public event Cryptool.PluginBase.StatusChangedEventHandler OnPluginStatusChanged;
    8863        public event Cryptool.PluginBase.GuiLogNotificationEventHandler OnGuiLogNotificationOccured;
    8964        public event Cryptool.PluginBase.PluginProgressChangedEventHandler OnPluginProgressChanged;
    90 
    91 
    92         private RSAKeyGeneratorSettings settings = new RSAKeyGeneratorSettings();
     65        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
     66
     67        #endregion
     68
     69        #region public
     70
     71        /// <summary>
     72        /// Sets the N of the public/private key
     73        /// </summary>
     74        [PropertyInfo(Direction.OutputData, "N", "N", "", DisplayLevel.Beginner)]
     75        public BigInteger N
     76        {
     77            get
     78            {
     79                return n;
     80            }
     81            set
     82            {
     83                this.n = value;
     84                OnPropertyChanged("N");
     85            }
     86        }
     87
     88        /// <summary>
     89        /// Sets the E of the public key
     90        /// </summary>
     91        [PropertyInfo(Direction.OutputData, "E", "public exponent", "", DisplayLevel.Beginner)]
     92        public BigInteger E
     93        {
     94            get
     95            {
     96                return e;
     97            }
     98            set
     99            {
     100                this.e = value;
     101                OnPropertyChanged("E");
     102            }
     103        }
     104
     105        /// <summary>
     106        /// Sets the D of the private key
     107        /// </summary>
     108        [PropertyInfo(Direction.OutputData, "D", "private exponent", "", DisplayLevel.Beginner)]
     109        public BigInteger D
     110        {
     111            get
     112            {
     113                return d;
     114            }
     115            set
     116            {
     117                this.d = value;
     118                OnPropertyChanged("D");
     119            }
     120        }
     121
     122        /// <summary>
     123        /// Getter/Setter for the settings of this plugin
     124        /// </summary>
    93125        public ISettings Settings
    94126        {
     
    97129        }
    98130
     131        /// <summary>
     132        /// Get the presentation of this plugin
     133        /// </summary>
    99134        public System.Windows.Controls.UserControl Presentation
    100135        {
     
    102137        }
    103138
     139        /// <summary>
     140        /// Get the quickwatchpresentation of this plugin
     141        /// </summary>
    104142        public System.Windows.Controls.UserControl QuickWatchPresentation
    105143        {
     
    107145        }
    108146
     147        /// <summary>
     148        /// This method is called by the environment before execution
     149        /// </summary>
    109150        public void PreExecution()
    110151        {
     
    112153        }
    113154
     155        /// <summary>
     156        /// Called by the environment to start generating of public/private keys
     157        /// </summary>
    114158        public void Execute()
    115159        {
     
    291335        }
    292336
     337        /// <summary>
     338        /// This method is called by the environment after execution
     339        /// </summary>
    293340        public void PostExecution()
    294341        {
    295342        }
    296343
     344        /// <summary>
     345        /// This method is called by the environment to pause this plugin
     346        /// </summary>
    297347        public void Pause()
    298348        {
     
    300350        }
    301351
     352        /// <summary>
     353        /// This method is called by the environment to stop execution
     354        /// </summary>
    302355        public void Stop()
    303356        {
    304 
    305         }
    306 
     357        }
     358
     359        /// <summary>
     360        /// This method is called by the environment to initialise the plugin
     361        /// </summary>
    307362        public void Initialize()
    308363        {
    309364        }
    310365
     366        /// <summary>
     367        /// This method is called by the environment to dispose
     368        /// </summary>
    311369        public void Dispose()
    312370        {
     371        }
     372       
     373        #endregion
     374
     375        #region private
     376
     377        /// <summary>
     378        /// Changes the progress of this plugin
     379        /// </summary>
     380        private void ProgressChanged(double value, double max)
     381        {
     382            EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(value, max));
     383        }
     384
     385        /// <summary>
     386        /// Logs a message to cryptool
     387        /// </summary>
     388        private void GuiLogMessage(string p, NotificationLevel notificationLevel)
     389        {
     390            EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p, this, notificationLevel));
     391        }
     392
     393        /// <summary>
     394        /// The property name changed
     395        /// </summary>
     396        /// <param name="name">name</param>
     397        public void OnPropertyChanged(string name)
     398        {
     399            EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs(name));
     400        }
     401
     402        #endregion
    313403   
    314         }
    315 
    316         #endregion
    317 
    318         #region INotifyPropertyChanged Members
    319 
    320         public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    321 
    322         private void ProgressChanged(double value, double max)
    323         {
    324             EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(value, max));
    325         }
    326 
    327         private void GuiLogMessage(string p, NotificationLevel notificationLevel)
    328         {
    329             EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p, this, notificationLevel));
    330         }
    331 
    332         public void OnPropertyChanged(string name)
    333         {
    334             EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs(name));
    335         }
    336 
    337         #endregion
    338     }
    339 }
     404    }//end RSAKeyGenerator
     405
     406}//end Cryptool.Plugins.RSA
  • trunk/CrypPlugins/RSA/RSAKeyGeneratorSettings.cs

    r721 r727  
    2525namespace Cryptool.Plugins.RSA
    2626{
     27    /// <summary>
     28    /// Settings class for the RSAKeyGenerator plugin
     29    /// </summary>
    2730    class RSAKeyGeneratorSettings : ISettings
    2831    {
     32
     33        #region private members
     34
     35        private int source;
     36        private String p = "23";
     37        private String q = "13";
     38        private String n = "299";
     39        private String e = "23";
     40        private String d = "23";
     41        private string certificateFile;
     42        private String password = "";
     43        private bool hasChanges = false;
     44       
     45        #endregion
     46
     47        #region events
     48       
    2949        public event TaskPaneAttributeChangedHandler TaskPaneAttributeChanged;
    30 
    31         private int source;
    32         [ContextMenu("Source", "Select the source of the Key Data", 1, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, new int[] { 1, 2, 3, 4 }, "Manual Primes", "Manual Keys", "Random", "Certificate")]
     50        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
     51
     52        #endregion
     53
     54        #region public
     55
     56        /// <summary>
     57        /// Getter/Setter for the source of the Key Data
     58        /// </summary>
    3359        [TaskPane("Source", "Select the source of the Key Data", null, 1, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "Manual Primes", "Manual Keys", "Random", "Certificate" })]
    3460        public int Source
     
    89115        }
    90116
    91         private String p = "23";
     117        /// <summary>
     118        /// Getter/Setter for prime P
     119        /// </summary>
    92120        [TaskPane("P", "P", null, 2, false, DisplayLevel.Beginner, ControlType.TextBox)]
    93121        public String P
     
    103131            }
    104132        }
    105 
    106         private String q = "13";
     133       
     134        /// <summary>
     135        /// Getter/Setter for the prime Q
     136        /// </summary>
    107137        [TaskPane("Q", "Q", null, 3, false, DisplayLevel.Beginner, ControlType.TextBox)]
    108138        public String Q
     
    119149        }
    120150
    121         private String n = "299";
     151        /// <summary>
     152        /// Getter/Setter for the N
     153        /// </summary>
    122154        [TaskPane("N", "N", null, 4, false, DisplayLevel.Beginner, ControlType.TextBox)]
    123155        public String N
     
    134166        }
    135167
    136         private String e = "23";
     168        /// <summary>
     169        /// Getter/Setter for the E
     170        /// </summary>
    137171        [TaskPane("E", "E", null, 5, false, DisplayLevel.Beginner, ControlType.TextBox)]
    138172        public String E
     
    149183        }
    150184
    151         private String d = "23";
     185        /// <summary>
     186        /// Getter/Setter for the D
     187        /// </summary>
    152188        [TaskPane("D", "D", null, 6, false, DisplayLevel.Beginner, ControlType.TextBox)]
    153189        public String D
     
    164200        }
    165201
    166 
    167         private string certificateFile;
     202        /// <summary>
     203        /// Getter/Setter for the certificate file
     204        /// </summary>
    168205        [TaskPane("Open X.509 Certificate", "Select the X.509 certificate you want to open.", null, 5, false, DisplayLevel.Beginner, ControlType.OpenFileDialog, FileExtension = "X.509 certificates (*.cer)|*.cer")]
    169206        public string CertificateFile
     
    181218        }
    182219
    183         private String password = "";
     220        /// <summary>
     221        /// Getter/Setter for the password of the certificate
     222        /// </summary>
    184223        [TaskPane("Password", "Password", null, 4, false, DisplayLevel.Beginner, ControlType.TextBoxHidden)]
    185224        public String Password
     
    196235        }
    197236
     237        /// <summary>
     238        /// Button to "close" the certificate file. That means it will not appear any more in the text field
     239        /// </summary>
    198240        [TaskPane("Close file", "Close file", null, 6, false, DisplayLevel.Beginner, ControlType.Button)]
    199241        public void CloseFile()
     
    202244        }
    203245
    204         #region ISettings Members
    205 
    206         private bool hasChanges = false;
    207246        public bool HasChanges
    208247        {
     
    219258        #endregion
    220259
    221         #region INotifyPropertyChanged Members
    222 
    223         public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    224 
     260        #region private
     261
     262        /// <summary>
     263        /// The property p changed
     264        /// </summary>
     265        /// <param name="p">p</param>
    225266        private void OnPropertyChanged(string p)
    226267        {
     
    232273
    233274        #endregion
    234     }
    235 }
     275
     276    }//end RSAKeyGeneratorSettings
     277
     278}//end Cryptool.Plugins.RSA
  • trunk/CrypPlugins/RSA/RSASettings.cs

    r665 r727  
    2525namespace Cryptool.Plugins.RSA
    2626{
     27    /// <summary>
     28    /// Settings class for the RSA plugin
     29    /// </summary>
    2730    class RSASettings : ISettings
    2831    {
    29         #region private variables
     32        #region private members
     33
    3034        private int action;
    3135        private int coresUsed;
    3236        private bool hasChanges = false;
     37        private ObservableCollection<string> coresAvailable = new ObservableCollection<string>();
     38
    3339        #endregion
    3440
     41        #region events
     42
     43        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
     44
     45        #endregion
     46
     47        #region public
     48
     49        /// <summary>
     50        /// Constructs a new RSASettings
     51        /// detects the number of cores of the system and sets those to maximum number of cores
     52        /// which can be used
     53        /// </summary>
    3554        public RSASettings()
    3655        {
     
    4059            CoresUsed = Environment.ProcessorCount - 1;
    4160        }
    42 
    43         private ObservableCollection<string> coresAvailable = new ObservableCollection<string>();
     61       
     62        /// <summary>
     63        /// Get the number of cores in a collection, used for the selection of cores
     64        /// </summary>
    4465        public ObservableCollection<string> CoresAvailable
    4566        {
     
    5576        }
    5677
    57         #region taskpane
     78        /// <summary>
     79        /// Getter/Setter for the number of cores which should be used by RSA
     80        /// </summary>
    5881        [TaskPane("CoresUsed", "Choose how many cores should be used", null, 1, false, DisplayLevel.Beginner, ControlType.DynamicComboBox, new string[] { "CoresAvailable" })]
    5982        public int CoresUsed
     
    7194        }
    7295
     96        /// <summary>
     97        /// Getter/Setter for the action (encryption or decryption)
     98        /// </summary>
    7399        [ContextMenu("Action", "Do you want the input data to be encrypted or decrypted?", 1, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, new int[] { 1, 2 }, "Encryption", "Decryption")]
    74100        [TaskPane("Action", "Do you want the input data to be encrypted or decrypted?", null, 1, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "Encryption", "Decryption" })]
     
    83109        }
    84110
    85         #endregion
    86 
    87         #region ISettings Members
    88 
     111        /// <summary>
     112        /// Did anything change on the settigns?
     113        /// </summary>
    89114        public bool HasChanges
    90115        {
     
    101126        #endregion
    102127
    103         #region INotifyPropertyChanged Members
     128        #region private
    104129
    105         public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    106 
     130        /// <summary>
     131        /// The property p has changes
     132        /// </summary>
     133        /// <param name="p">p</param>
    107134        private void OnPropertyChanged(string p)
    108135        {
     
    114141
    115142        #endregion
    116     }
    117    
    118    
    119 }
     143
     144    }//end RSASettings
     145
     146}//end Cryptool.Plugins.RSA
Note: See TracChangeset for help on using the changeset viewer.