Example #1
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider();
            using (StreamReader stream = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Format("{0}.Keys.private.xml", this.GetType().Namespace))))
            {
                rsaProvider.FromXmlString(stream.ReadToEnd());
                stream.Close();
            }

            RSALicenseCodec codec = new RSALicenseCodec(rsaProvider.ExportParameters(true));
            XorLicenseCodec codec2 = new XorLicenseCodec();
            Deprotector deprotector = new Deprotector(new EncoderSequence(new IEncoder[] { codec, codec2 }));

            txtLicense.Text = FormatKey(deprotector.GenerateLicense(license));
        }
Example #2
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider();

            using (StreamReader stream = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Format("{0}.Keys.private.xml", this.GetType().Namespace))))
            {
                rsaProvider.FromXmlString(stream.ReadToEnd());
                stream.Close();
            }

            RSALicenseCodec codec       = new RSALicenseCodec(rsaProvider.ExportParameters(true));
            XorLicenseCodec codec2      = new XorLicenseCodec();
            Deprotector     deprotector = new Deprotector(new EncoderSequence(new IEncoder[] { codec, codec2 }));

            txtLicense.Text = FormatKey(deprotector.GenerateLicense(license));
        }