Commit d1cdd43 1 parent f66c1c1 commit d1cdd43 Copy full SHA for d1cdd43
File tree 1 file changed +13
-0
lines changed
src/libraries/System.Security.Cryptography.Xml/tests
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1993,5 +1993,18 @@ public void CheckSignatureHandlesIncorrectOrTamperedReferenceWithMultipleEnvelop
1993
1993
1994
1994
Assert . False ( subject . CheckSignature ( ) ) ;
1995
1995
}
1996
+
1997
+ [ Fact ]
1998
+ [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/95390" ) ]
1999
+ public void CheckSignatureHandlesEnvelopedSignatureWithRootXpointerReference ( )
2000
+ {
2001
+ const string EnvelopedSignatureWithRootXpointerReference = """<?xml version="1.0" encoding="UTF-8"?><hello><world>Hi</world><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" /><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /><Reference URI="#xpointer(/)"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /><DigestValue>SVaCE5w9iLXTVYTKP1t/yjjmPXvWovMYpgljGgpgz2Y=</DigestValue></Reference></SignedInfo><SignatureValue>dqcBmS1ZvDJNhmCEgobpAb+A2XaiuB69dfGIhisZvqoxaWqAqv/0w49jp38+usJ5t3wcq3aMC631QE8iln+lHWrarojDMDWLa00isv3oE3q9UgOIV9e6MUSoRTTvQkmlK/LSYV9T/SKx6h03vLLcIkUMXaTkC/n2kthlJTGkLbU=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>t6qV1iTlkCPoaIeOTvnDczQv5pytUxMoyNXws5vaMQYxfJMKos47dvmiLtfWUDLYXFX3Yf/JMC14plJw2JA5jLrlHLnZj/vCjRtXckmWW/wGYewXUqrgR1CytStUeQKj9mNsi76erukua10UhzIrWG+H6YQ/qS4AMMJZU6jBvO0=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo></Signature></hello>""" ;
2002
+ XmlDocument xmlDoc = new ( ) ;
2003
+ xmlDoc . LoadXml ( EnvelopedSignatureWithRootXpointerReference ) ;
2004
+ SignedXml signedXml = new ( xmlDoc ) ;
2005
+ signedXml . LoadXml ( xmlDoc . GetElementsByTagName ( "Signature" , SignedXml . XmlDsigNamespaceUrl ) [ 0 ] as XmlElement ) ;
2006
+
2007
+ Assert . True ( signedXml . CheckSignature ( ) ) ;
2008
+ }
1996
2009
}
1997
2010
}
You can’t perform that action at this time.
0 commit comments