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(); }
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); }