/// <summary> /// Digs the <Signature> element out of the document. /// </summary> /// <exception cref="InvalidOperationException">if the document does not contain a signature.</exception> private static SignedXml RetrieveSignature(XmlElement el) { SignedXml signedXml = new SignedXMLWithIdResolvement(el); XmlNodeList nodeList = el.GetElementsByTagName(Signature.ELEMENT_NAME, Saml20Constants.XMLDSIG); if (nodeList.Count == 0) { throw new InvalidOperationException("Document does not contain a signature to verify."); } signedXml.LoadXml((XmlElement)nodeList[0]); return(signedXml); }
/// <summary> /// Digs the <Signature> element out of the document. /// </summary> /// <exception cref="InvalidOperationException">if the document does not contain a signature.</exception> private static SignedXml RetrieveSignature(XmlElement el) { SignedXml signedXml = new SignedXMLWithIdResolvement(el); XmlNodeList nodeList = el.GetElementsByTagName(Signature.ELEMENT_NAME, Saml20Constants.XMLDSIG); if (nodeList.Count == 0) { throw new InvalidOperationException("Document does not contain a signature to verify."); } signedXml.LoadXml((XmlElement)nodeList[0]); // verify that the inlined signature has a valid reference uri VerifyRererenceURI(signedXml, el.GetAttribute("ID")); return(signedXml); }
/// <summary> /// Digs the <Signature> element out of the document. /// </summary> /// <exception cref="InvalidOperationException">if the document does not contain a signature.</exception> private static SignedXml RetrieveSignature(XmlElement el) { SignedXml signedXml = new SignedXMLWithIdResolvement(el); XmlNodeList nodeList = el.GetElementsByTagName(Signature.ELEMENT_NAME, Saml20Constants.XMLDSIG); if (nodeList.Count == 0) { throw new InvalidOperationException("Document does not contain a signature to verify."); } signedXml.LoadXml((XmlElement)nodeList[0]); Reference reference = new Reference("#" + signedXml.SignedInfo.Id); reference.AddTransform(new XmlDsigEnvelopedSignatureTransform()); reference.AddTransform(new XmlDsigExcC14NTransform()); signedXml.AddReference(reference); return(signedXml); }
/// <summary> /// Digs the <Signature> element out of the document. /// </summary> /// <exception cref="InvalidOperationException">if the document does not contain a signature.</exception> private static SignedXml RetrieveSignature(XmlElement el) { SignedXml signedXml = new SignedXMLWithIdResolvement(el); XmlNodeList nodeList = el.GetElementsByTagName(Signature.ELEMENT_NAME, Saml20Constants.XMLDSIG); if (nodeList.Count == 0) throw new InvalidOperationException("Document does not contain a signature to verify."); signedXml.LoadXml((XmlElement)nodeList[0]); Reference reference = new Reference("#" + signedXml.SignedInfo.Id); reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ()); reference.AddTransform (new XmlDsigExcC14NTransform ()); signedXml.AddReference(reference); return signedXml; }
/// <summary> /// Digs the <Signature> element out of the document. /// </summary> /// <exception cref="InvalidOperationException">if the document does not contain a signature.</exception> private static SignedXml RetrieveSignature(XmlElement el) { SignedXml signedXml = new SignedXMLWithIdResolvement(el); XmlNodeList nodeList = el.GetElementsByTagName(Signature.ELEMENT_NAME, Saml20Constants.XMLDSIG); if (nodeList.Count == 0) throw new InvalidOperationException("Document does not contain a signature to verify."); signedXml.LoadXml((XmlElement)nodeList[0]); // verify that the inlined signature has a valid reference uri VerifyRererenceURI(signedXml, el.GetAttribute("ID")); return signedXml; }