Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml and digital signature

Status
Not open for further replies.

Spunny

Programmer
Jun 30, 2010
3
US
We are using C#, asp.net 2.0 and generating xml document from sql server query results. Our vendor wants to include digital signatue as part of document. They just want to embed digital signature with in xml document. They do not want XMLDSIG.



XSD looks like this:

<xs:complexType name="AuthenticationType">
<xs:choice>
<xs:element name="PKI" minOccurs="0" maxOccurs="1" type="PKIAuthenticationType"/>
<xs:element name="Password" minOccurs="0" maxOccurs="1" type="PasswordAuthenticationType"/>
</xs:choice>
<xs:attribute name="valid-until" type="xs:dateTime" use="required"/>
</xs:complexType>

<xs:complexType name="PKIAuthenticationType">
<xs:sequence>
<xs:element name="Signature" minOccurs="1" maxOccurs="1" type="SignatureType"/>
<xs:element name="Token" minOccurs="1" maxOccurs="1" type="xs:token"/>
<xs:element name="Certificate" minOccurs="1" maxOccurs="1" type="CertificateType"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="PasswordAuthenticationType">
<xs:sequence>
<xs:element name="Username" minOccurs="1" maxOccurs="1" type="xs:token"/>
<xs:element name="Password" minOccurs="1" maxOccurs="1" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="SignatureType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="algorithm" type="SignatureAlgorithmType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="SignatureAlgorithmType">
<xs:restriction base="xs:token">
<xs:enumeration value="SHA1-DSA"/>
<xs:enumeration value="MD2-RSA"/>
<xs:enumeration value="MD5-RSA"/>
<xs:enumeration value="SHA1-RSA"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="CertificateType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="format" type="CertificateFormatType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:simpleType name="CertificateFormatType">
<xs:restriction base="xs:token">
<xs:enumeration value="Base64-DER"/>
</xs:restriction>
</xs:simpleType>



when I generate sample xml using xmlsamplegenerator, I get this:



<Authentication valid-until="1900-01-01T01:01:01.0000000-06:00">
<PKI>
<Signature algorithm="SHA1-DSA">Token1</Signature>
<Token>Token1</Token>
<Certificate format="Base64-DER">Token1</Certificate>
</PKI>
</Authentication>



I am seeing lot of articles doing CanonicalizationMethod etc. Can someone please guide me how to do this programatically. Most of the articles look like this.




I appreciate your response.

Thanks,

Spunny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top