コード例 #1
0
        private void btnValidateLicense_Click(object sender, EventArgs e)
        {
            LicenseInformation info = LicenseEncryption.Decrypt(txtLicense.Text, txtPublicKey.Text);

            txtProduct.Text    = info.Product;
            txtExpiration.Text = info.Expiration.HasValue ? info.Expiration.Value.ToString("yyyy-MM-dd HH:mm:ss") : "never";
            txtIsValid.Text    = info.IsValid.ToString();
        }
コード例 #2
0
        private void btnCreateLicense_Click(object sender, EventArgs e)
        {
            DateTime?expiration = null;

            if (!String.IsNullOrWhiteSpace(txtExpiration.Text))
            {
                expiration = DateTime.Parse(txtExpiration.Text);
            }

            txtLicense.Text = LicenseEncryption.Encrypt(txtProduct.Text, expiration, txtPrivateKey.Text);
        }