source: trunk/PKCS1/WpfControls/Components/SigGenKuehnControl.xaml.cs @ 1743

Last change on this file since 1743 was 1743, checked in by schomburg, 11 years ago

Limitation on Kuehn Signature Generation editable by User
beta version of helpfile Gen_Kuehn_Sig_Tab.html

File size: 2.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7using System.Windows.Data;
8using System.Windows.Documents;
9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14using PKCS1.Library;
15
16namespace PKCS1.WpfControls.Components
17{
18    /// <summary>
19    /// Interaktionslogik für SigGenKuehnControl.xaml
20    /// </summary>
21    public partial class SigGenKuehnControl : UserControl
22    {
23        private KuehnSignature m_signature = new KuehnSignature();
24        public KuehnSignature Signature
25        {
26            get { return this.m_signature; }
27            set { this.m_signature = (KuehnSignature)value; }
28        }
29
30        public SigGenKuehnControl()
31        {
32            InitializeComponent();
33            RSAKeyManager.Instance.RaiseKeyGeneratedEvent += handleCustomEvent; // listen
34            this.handleCustomEvent(ParameterChangeType.RsaKey);
35        }
36
37        private void handleCustomEvent(ParameterChangeType type)
38        {
39            this.lblPublicKeyRes.Content = RSAKeyManager.Instance.PubExponent.ToString();
40            this.lblRsaKeySizeRes.Content = RSAKeyManager.Instance.RsaKeySize.ToString();
41        }
42
43        private void bExecute_Click(object sender, RoutedEventArgs e)
44        {
45            Cursor = Cursors.Wait;
46
47            this.Signature = (KuehnSignature)SignatureHandler.getInstance().getKuehnSig();
48
49            if (this.Signature.GenerateSignature())
50            {
51                UserControlHelper.loadRtbColoredSig(this.rtbResult, this.Signature.GetSignatureDecToHexString());
52                this.tbResultEncrypted.Text = this.Signature.GetSignatureToHexString();
53                SignatureHandler.getInstance().setKuehnSig(this.Signature);
54            }
55            else
56            {
57                this.tbError.Text = "Es ist ein Fehler aufgetreten. Signatur konnte nicht erstellt werden.";
58            }
59
60            Cursor = Cursors.Arrow;
61        }
62
63        private void tbResultEncrypted_TextChanged(object sender, TextChangedEventArgs e)
64        {           
65            this.lblEncryptedSignatureLength.Content = "(Länge: " + this.tbResultEncrypted.Text.Length * 4 + " bit)";
66        }
67
68        private void rtbResult_TextChanged(object sender, TextChangedEventArgs e)
69        {
70            this.lblSignatureLength.Content = "(Länge: " + UserControlHelper.GetRtbTextLength(this.rtbResult) * 4 + " bit)";
71        }
72    }
73}
Note: See TracBrowser for help on using the repository browser.