Пример #1
0
        private void generateKeyPairMenuItem_Click(object sender, EventArgs e)
        {
            KeyPairGeneratorForm generator = new KeyPairGeneratorForm();

            if (generator.ShowDialog() == DialogResult.OK)
            {
                RSACryptoServiceProvider RSAProvider = new RSACryptoServiceProvider(currentBitStrength);
                string publicAndPrivateKeys          = "<BitStrength>" + currentBitStrength.ToString() + "</BitStrength>" + RSAProvider.ToXmlString(true);
                string justPublicKey = "<BitStrength>" + currentBitStrength.ToString() + "</BitStrength>" + RSAProvider.ToXmlString(false);
                if (saveFile("Save Private Keys As", "Lanetor Private Key( *.kez )|*.kez", publicAndPrivateKeys))
                {
                    while (!saveFile("Save Public Key As", "Lanetor Public Key( *.pke )|*.pke", justPublicKey))
                    {
                        ;
                    }
                }
            }
        }
Пример #2
0
        private void button5_Click_1(object sender, EventArgs e)
        {
            //input the number from list
            //key generate
            //save keys (public key: just show saving.. private: save as file)
            //share public key (just show/inform sharing and make available to every1)
            KeyPairGeneratorForm generator = new KeyPairGeneratorForm();

            if (generator.ShowDialog() == DialogResult.OK)
            {
                RSACryptoServiceProvider RSAProvider = new RSACryptoServiceProvider(currentBitStrength);
                string publicAndPrivateKeys          = "<BitStrength>" + currentBitStrength.ToString() + "</BitStrength>" + RSAProvider.ToXmlString(true);
                string justPublicKey = "<BitStrength>" + currentBitStrength.ToString() + "</BitStrength>" + RSAProvider.ToXmlString(false);
                if (saveFile("Save Public/Private Keys As", "Public/Private Keys Document( *.kez )|*.kez", publicAndPrivateKeys))
                {
                    while (!saveFile("Save Public Key As", "Public Key Document( *.pke )|*.pke", justPublicKey))
                    {
                        ;
                    }
                }
            }
        }