private void CreateXMLFile(string filename)
        {
            XmlDocument xdoc;
            string      hashbase64;

            if (!UpdatePackageInfoHelper.CreateSHA512HashForFile(eUpdateFile.Text, out hashbase64))
            {
                return;
            }

            try
            {
                AppendLog("Creating xml...");
                UpdatePackageInfo ud = new UpdatePackageInfo();
                ud.Title               = eTitle.Text;
                ud.Description         = eDescription.Text;
                ud.Version             = eNewVersion.Text;
                ud.PublishDate         = (DateTime)ePublishDate.EditValue;
                ud.ReleaseNotesUri     = eReleaseLink.Text;
                ud.UpdateFileName      = Path.GetFileName(eUpdateFile.Text);
                ud.UpdateFileUri       = eUpdateFileLink.Text;
                ud.UpdateFileSignature = hashbase64;

                ud.ToFile(filename, _PrivateKey.ToXmlString(true));
            }
            catch (Exception ex)
            {
                AppendLog("Error creating updatefile");
                AppendLog(ex.Message);
                return;
            }

            AppendLog("--------------------");
        }
        private void bVerify_Click(object sender, EventArgs e)
        {
            UpdatePackageInfo desc;
            string            hashbase64;

            AppendLog("Verifying Signature");
            eVerDescriptionFile.Text = dlgSelectUpdateDescFile.FileName;

            try
            {
                desc = UpdatePackageInfo.FromFile(dlgSelectUpdateDescFile.FileName, _PrivateKey.ToXmlString(false));

                if (desc != null)
                {
                    AppendLog("OK - xml signature is ok");
                    iXmlSignature.Text       = "Xml signature is OK";
                    iXmlSignature.ImageIndex = 10;
                }
                else
                {
                    AppendLog("ERROR - xml signature missmatch");
                    iXmlSignature.Text              = "Xml signature is NOT OK";
                    iXmlSignature.ImageIndex        = 11;
                    iUpdateFileSignature.Text       = "Not tested";
                    iUpdateFileSignature.ImageIndex = 9;
                    return;
                }


                if (!UpdatePackageInfoHelper.CreateSHA512HashForFile(eVerUpdateFile.Text, out hashbase64))
                {
                    AppendLog("Could not create hash for updatefile - only verifying xml!");
                    iUpdateFileSignature.Text       = "Cannot be tested (file error)";
                    iUpdateFileSignature.ImageIndex = 9;
                }
                else
                {
                    if (desc.UpdateFileSignature == hashbase64)
                    {
                        AppendLog("Hash is OK");
                        iUpdateFileSignature.Text       = "Update file signatures match";
                        iUpdateFileSignature.ImageIndex = 10;
                    }
                    else
                    {
                        AppendLog("Hash is NOT OK");
                        iUpdateFileSignature.Text       = "Update file signatures DO NOT match";
                        iUpdateFileSignature.ImageIndex = 11;
                    }
                }
            }
            catch
            { AppendLog("Error verifying signature"); }
        }