xml-dsig

.NET doesn't support non-standard XMLDSIG signature element names

走远了吗. 提交于 2019-12-10 12:13:53
问题 I'm trying to implement an industry spec that requires enveloped XML digital signatures (XMLDSIG). Instead of conforming to the examples ( <Signature> ) my spec uses its own name for the signature element: <xs:element name="ensembleSignature" type="dsig:SignatureType" /> <!-- wish this was: <xs:element ref="dsig:Signature" /> --> So the element isn't named 'Signature' and is in the domain's XML namespace instead of the dsig XML namespace. With a lot of extra work I can create this custom

How can I compare public keys in .NET?

痴心易碎 提交于 2019-12-06 12:59:19
问题 I've got an X509Certificate2 containing a public key. I've got an RSACryptoServiceProvider (which came from calling SignedXml.CheckSignatureReturningKey), also containing a public key. I want to find out if one came from the other. How can I compare the two? 回答1: You can compare the PublicKey property of signing certificates in the SignedXml.KeyIfo with signing key output from SignedXml.CheckSignatureReturningKey. This C# extension method does the job for me: public static bool

How can I compare public keys in .NET?

情到浓时终转凉″ 提交于 2019-12-04 20:37:07
I've got an X509Certificate2 containing a public key. I've got an RSACryptoServiceProvider (which came from calling SignedXml.CheckSignatureReturningKey ), also containing a public key. I want to find out if one came from the other. How can I compare the two? You can compare the PublicKey property of signing certificates in the SignedXml.KeyIfo with signing key output from SignedXml.CheckSignatureReturningKey . This C# extension method does the job for me: public static bool CheckSignatureReturningCertificate(this SignedXml signedXml, out X509Certificate2 signingCertificate) {

How to sign only specific part of XML

北战南征 提交于 2019-12-03 13:39:34
I am trying to do some XML Signature by signing only parts of the xml however after much searching I have not been able to find a solution. I am using java to sign an XML using Xpath2 transform and EXCLUSIVE canonicalization. If I have the following XML <?xml version="1.0" encoding="UTF-8"?> <msg xmlns="http://someaddress/ad/m1" xmlns:ns1="http://someotheraddres/ad/m2" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#"> <header> <id>wsfrwerwerwer</id> <name>addr</name> <somenode> <trace>ND</trace> </somenode> </header> <payload><ns0:addr xmlns:ns0="http://someaddres/ad/m3"><ns2:data xmlns:ns2=

Verify XMLDSIG chain in .NET?

心已入冬 提交于 2019-12-01 10:37:59
I'm using XMLDSIG to sign a configuration file . I'd like my CA to be able to issue keys that can be used to sign XML. I'd then like to verify that the XML was signed with a key issued by my CA. How do I get the signing certificate out of the SignedXml object? How do I follow the certificate chain back to a specific CA? Note that the public key for my CA will be stored in my executable, rather than the certificate store. Roger Lipscombe To attach arbitrary certificates to an XML-DSIG file, add an <X509Data> element . To do this in .NET, use: signedXml.KeyInfo.AddClause( new KeyInfoX509Data

JAXB Marshalling with xmldsig Signature

…衆ロ難τιáo~ 提交于 2019-11-30 07:25:24
Is it possible to create jaxb marshaller which automatically adds digital signature to xml content. For example if I have a class which is defined: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Test { @XmlElement private String info; public String getInfo() { return info; } public void setInfo(String info) { this.info = info; } } And my xml which is produced by marshaller looks like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><test><info>value</info></test> And I expect it to look like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Security>

JAXB Marshalling with xmldsig Signature

China☆狼群 提交于 2019-11-29 10:28:28
问题 Is it possible to create jaxb marshaller which automatically adds digital signature to xml content. For example if I have a class which is defined: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Test { @XmlElement private String info; public String getInfo() { return info; } public void setInfo(String info) { this.info = info; } } And my xml which is produced by marshaller looks like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><test><info>value</info></test>