Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions App.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XDocument_Sample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XDocument_Sample.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<XDocument_Sample.Properties.Settings>
Expand All @@ -16,16 +13,12 @@
<setting name="InterID" serializeAs="String">
<value>1</value>
</setting>
</XDocument_Sample.Properties.Settings>
</applicationSettings>
<userSettings>
<XDocument_Sample.Properties.Settings>
<setting name="ServerID" serializeAs="String">
<value>1</value>
</setting>
<setting name="UserID" serializeAs="String">
<value>1</value>
</setting>
</XDocument_Sample.Properties.Settings>
</userSettings>
</applicationSettings>
</configuration>
119 changes: 119 additions & 0 deletions CreateXml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace XDocument_Sample
{
class CreateXml
{
string file = "xml.xml";

public CreateXml(string xml) {

XDocument doc =
new XDocument(
new XElement("file",
new XElement("name", new XAttribute("filename", "sample")),
new XElement("date", new XAttribute("modified", DateTime.Now), new XAttribute("hallo", "dsd")),

// From here the CA Section
new XElement("CA",
new XElement("name", "Sample-CA"),
new XElement("type", "CA"),
new XElement("id", "0"),
new XElement("Private",
new XElement("Bits", "4096"),
new XElement("Pass", "passwortca"),
new XElement("file", "Sample-CA.key.pem")
),
new XElement("Public",
new XElement("duration", "7300"),
new XElement("pass", "passwortca"),
new XElement("cnf", "openssl-ca.cnf"),
new XElement("subj",
new XElement("C", "DE"),
new XElement("ST", "Bavaria"),
new XElement("L", "Hausen"),
new XElement("OU", "IT"),
new XElement("CN", "Lang-CA"),
new XElement("email", "[email protected]")
)
)
),
// From here the Intermediate Section
new XElement("Intermediate",
new XElement("name", "Sample-Intermediate"),
new XElement("type", "Intermediate"),
new XElement("id", "1"),
new XElement("Private",
new XElement("Bits", "4096"),
new XElement("pass", "passwortint")
),
new XElement("CSR",
new XElement("cnf", "openssl-int.cnf"),
new XElement("pass_priv", "passwortint"),
new XElement("subj",
new XElement("C", "DE"),
new XElement("ST", "Bavaria"),
new XElement("L", "Hausen"),
new XElement("OU", "IT"),
new XElement("CN", "Lang-Intermediate"),
new XElement("email", "[email protected]")
)
),
new XElement("Sign",
new XElement("cnf-ca", "openssl-ca.cnf"),
new XElement("duration", "3650"),
new XElement("CA",
new XElement("id", "0"),
new XElement("passCa", "passwordca")
)
)
),
// From here server section
new XElement("Server",
new XElement("name", "Sample-Server"),

new XElement("type", "Server"),
new XElement("id", "1"),
new XElement("Private",

new XElement("Bits", "4096"),
new XElement("pass", "")
),
new XElement("CSR",
new XElement("pass_priv", ""),
new XElement("subj",
new XElement("C", "DE"),
new XElement("ST", "Bavaria"),
new XElement("L", "Hausen"),
new XElement("OU", "IT"),
new XElement("CN", "Lang-Server"),
new XElement("email", "[email protected]")
),
new XElement("SAN",
new XElement("DNS.1", "SAN"),
new XElement("IP.1", "192.168.1.1")
)
),
new XElement("Sign",
new XElement("cnf", "openssl-int.cnf"),
new XElement("duration", "365"),
new XElement("passInt", "passwordint"),
new XElement("Intermediate",
new XElement("id", "1"),
new XElement("passInt", "passwordint")
)
)
)
)
);

doc.Save(xml);

}
}
}
Loading