source: trunk/CrypPlugins/RC2/RC2Settings.cs @ 2527

Last change on this file since 2527 was 2334, checked in by Matthäus Wander, 11 years ago

removed 1006 occurences of DisplayLevel in 218 files (see #122)

File size: 3.9 KB
Line 
1/*
2   Copyright 2008 Sebastian Przybylski, University of Siegen
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21using System.IO;
22using Cryptool.PluginBase;
23using System.Security.Cryptography;
24using System.ComponentModel;
25
26namespace Cryptool.Plugins.Cryptography.Encryption
27{
28    public class RC2Settings : ISettings
29    {
30        private bool hasChanges = false;
31        private int action = 0; //0=encrypt, 1=decrypt
32        private int mode = 0; //0="ECB", 1="CBC", 2="CFB", 3="OFB"
33        private int padding = 0; //="Zeros"=default, 1="None", 2="PKCS7", 3="ANSIX923", 4="ISO10126"
34
35        [ContextMenu("Action","Do you want the input data to be encrypted or decrypted?",1,ContextMenuControlType.ComboBox,new int[] {1,2},"Encrypt","Decrypt")]
36        [TaskPane("Action","Do you want the input data do be encrypted or decrypted?", "", 1, false,ControlType.ComboBox, new string[] {"Encrypt","Decrypt"})]
37        public int Action
38        {
39            get { return this.action; }
40            set
41            {
42                if (((int)value) != action) hasChanges = true;
43                this.action = (int)value;
44                OnPropertyChanged("Action");
45            }
46        }
47
48        [ContextMenu("Chaining mode","Select the block cipher mode of operation.",2, ContextMenuControlType.ComboBox, null, new string[] {"Electronic Code Book (ECB)","Cipher Block Chaining (CBC)","Cipher Feedback (CFB)"})]
49        [TaskPane("Chaining mode", "Select the block cipher mode of operation.", "", 2, false, ControlType.ComboBox,new String[] {"Electronic Code Book (ECB)","Cipher Block Chaining (CBC)","Cipher Feedback (CFB)"})]
50        public int Mode
51        {
52            get { return this.mode; }
53            set
54            {
55                if (((int)value) != mode) hasChanges = true;
56                this.mode = (int)value;
57                OnPropertyChanged("Mode");
58            }
59        }
60
61        [ContextMenu("Padding mode","Select a mode to fill partial data blocks.",3, ContextMenuControlType.ComboBox, null, "Zeros","None","PKCS7","ANSIX923","ISO10126")]
62        [TaskPane("Padding mode","Select a mode to fill partial data blocks.", "", 3, false, ControlType.ComboBox, new String[]{"Zeros","None","PKCS7","ANSIX923","ISO10126"})]
63        public int Padding
64        {
65            get { return this.padding; }
66            set
67            {
68                if (((int)value) != padding) hasChanges = true;
69                this.padding = (int)value;
70                OnPropertyChanged("Padding");
71            }
72        }
73
74        public bool HasChanges
75        {
76            get { return hasChanges; }
77            set { hasChanges = value; }
78        }
79
80        #region INotifyPropertyChanged Members
81
82        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
83
84        protected void OnPropertyChanged(string name)
85        {
86            if (PropertyChanged != null)
87            {
88                PropertyChanged(this, new PropertyChangedEventArgs(name));
89            }
90        }
91
92        #endregion
93
94        public event StatusChangedEventHandler OnPluginStatusChanged;
95
96        private void ChangePluginIcon(int Icon)
97        {
98          if (OnPluginStatusChanged != null) OnPluginStatusChanged(null, new StatusEventArgs(StatusChangedMode.ImageUpdate, Icon));
99        }
100    }
101}
Note: See TracBrowser for help on using the repository browser.