public void ShowSignature(KnownSignatureStandard signatureStandard, XmlElement xmlElementToShow) { this.bufferedXmlElement = xmlElementToShow; this.signatureStandardLabel.Text = signatureStandard.ToString(); this.signatureXmlRenderTree.RenderXmlNode(xmlElementToShow); }
/// <summary> /// Add a XAdES object to the signature /// </summary> /// <param name="xadesObject">XAdES object to add to signature</param> public void AddXadesObject(XadesObject xadesObject) { Reference reference; DataObject dataObject; XmlElement bufferXmlElement; if (this.SignatureStandard != KnownSignatureStandard.Xades) { dataObject = new DataObject(); dataObject.Id = xadesObject.Id; dataObject.Data = xadesObject.GetXml().ChildNodes; this.AddObject(dataObject); //Add the XAdES object reference = new Reference(); signedPropertiesIdBuffer = xadesObject.QualifyingProperties.SignedProperties.Id; reference.Uri = "#" + signedPropertiesIdBuffer; reference.Type = SignedPropertiesType; this.AddReference(reference); //Add the XAdES object reference this.cachedXadesObjectDocument = new XmlDocument(); bufferXmlElement = xadesObject.GetXml(); // Add "ds" namespace prefix to all XmlDsig nodes in the XAdES object SetPrefix("ds", bufferXmlElement); this.cachedXadesObjectDocument.PreserveWhitespace = true; this.cachedXadesObjectDocument.LoadXml(bufferXmlElement.OuterXml); //Cache to XAdES object for later use this.signatureStandard = KnownSignatureStandard.Xades; } else { throw new CryptographicException("Can't add XAdES object, the signature already contains a XAdES object"); } }
private void SetSignatureStandard(XmlElement signatureElement) { if (this.GetXadesObjectElement(signatureElement) != null) { this.signatureStandard = KnownSignatureStandard.Xades; } else { this.signatureStandard = KnownSignatureStandard.XmlDsig; } }
/// <summary> /// Default constructor for the XadesSignedXml class /// </summary> public XadesSignedXml() : base() { XmlDSigPrefix = "ds"; XmlXadesPrefix = "xades"; this.cachedXadesObjectDocument = null; this.signatureStandard = KnownSignatureStandard.XmlDsig; }
/// <summary> /// Default constructor for the XadesSignedXml class /// </summary> public XadesSignedXml() : base() { this.cachedXadesObjectDocument = null; this.signatureStandard = KnownSignatureStandard.XmlDsig; }