source: trunk/CrypPlugins/TEA/TEASettings.cs @ 2220

Last change on this file since 2220 was 1042, checked in by Sören Rinne, 12 years ago
  • bugfixing
  • replaced all licenses with the short version
File size: 4.0 KB
Line 
1/*
2   Copyright 2009 Sören Rinne, Ruhr-Universität Bochum, Germany
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;
21
22using System.IO;
23using System.Security.Cryptography;
24using Cryptool.PluginBase;
25using System.ComponentModel;
26using Cryptool.PluginBase.Cryptography;
27using Cryptool.PluginBase.IO;
28using System.Runtime.CompilerServices;
29using Cryptool.PluginBase.Miscellaneous;
30using System.Runtime.Remoting.Contexts;
31
32namespace Cryptool.TEA
33{
34    public class TEASettings : ISettings
35    {
36        #region ISettings Members
37
38        private bool hasChanges = false;
39        private int action = 0; //0=encrypt, 1=decrypt
40        private int padding = 0; //0="Zeros"=default, 1="None", 2="PKCS7"
41        private int version = 0; //0="TEA"=default, 1="XTEA, 2=XXTEA"
42        private int rounds = 64;
43
44        [ContextMenu("Action","Do you want the input data to be encrypted or decrypted?",1, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, new int[] { 1, 2}, "Encrypt","Decrypt")]
45        [TaskPane("Action", "Do you want the input data to be encrypted or decrypted?", null, 1, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "Encrypt", "Decrypt" })]
46        public int Action
47        {
48            get { return this.action; }
49            set { this.action = (int)value; }
50        }
51
52        [ContextMenu("Padding mode", "Select a mode to fill partial data blocks.", 3, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, null, "Zeros", "None", "PKCS7")]
53        [TaskPane("Padding Mode", "Select a mode to fill partial data blocks.", "", 3, false, DisplayLevel.Experienced, ControlType.ComboBox, new String[] { "Zeros", "None", "PKCS7" })]
54        public int Padding
55        {
56            get { return this.padding; }
57            set
58            {
59                if (((int)value) != padding) hasChanges = true;
60                this.padding = (int)value;
61                //OnPropertyChanged("Padding");
62            }
63        }
64
65        [ContextMenu("TEA version", "Select the version of TEA you want to use.", 4, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, null, "TEA", "XTEA", "XXTEA")]
66        [TaskPane("TEA version", "Select the version of TEA you want to use.", "", 4, false, DisplayLevel.Experienced, ControlType.ComboBox, new String[] { "TEA (1994)", "XTEA (1997)", "XXTEA (1998)" })]
67        public int Version
68        {
69            get { return this.version; }
70            set
71            {
72                if (((int)value) != version) hasChanges = true;
73                this.version = (int)value;
74                //OnPropertyChanged("Padding");
75            }
76        }
77
78        [TaskPane("Number of rounds", "This applies only to XTEA. Default are 64 rounds.", "Rounds", 5, false, DisplayLevel.Beginner, ControlType.NumericUpDown, ValidationType.RangeInteger, 0, int.MaxValue)]
79        public int Rounds
80        {
81            get { return this.rounds; }
82            set
83            {
84                if (((int)value) != rounds) hasChanges = true;
85                this.rounds = value;
86                //OnPropertyChanged("Rounds");
87            }
88        }
89
90        public bool HasChanges
91        {
92            get { return hasChanges; }
93            set { hasChanges = value; }
94        }
95
96        #endregion
97
98        #region INotifyPropertyChanged Members
99
100        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
101
102        #endregion
103    }
104}
Note: See TracBrowser for help on using the repository browser.