xml-signature

Getting “WS Security Header in the message is invalid.” when calling ACAGetTransmitterBulkRequestStatus

∥☆過路亽.° 提交于 2019-12-21 06:36:08
问题 I've been able to make successfull call to first ACA web service and I thought, that getting status would be a breeze. Bo-o-oy how I have been wrong! I've used same settings for the status service as I did for the submit one... and I got "WS Security header is invalid error!" What gives?!?! Signature generation code is the same as I been using for submission! I would appreciate if any one would be able shed some light what possibly is wrong here? I am aware, that following tags should be

How to produce XML signature with no whitespaces and line-breaks in Java?

余生颓废 提交于 2019-12-21 04:43:11
问题 I work with the brazilian "Nota Fiscal Eletronica" project, in which they define a standart way to sign XML documents. Recently, they started to require that there are absolutely no whitespaces between tags, including signature tags (*). We happen to use apache's XMLSignature and I can't seem to produce an unindented signature. If I remove the whitespaces after signing, the signature gets broken. I cannot change the canonicalizer / transformers set either, since they're predefined. I couldn't

SignedXml checksignature returns false

戏子无情 提交于 2019-12-21 03:57:17
问题 I've looked at other posts on here regarding this issue and none of them seem to address my situation. I've been trying to verify a SAML assertion for the last week and I have 2 clients that have sent me SAML but I cannot verify it. The main process is we get a base64 encoded assertion and I decode it. Load it into an XmlDocment with PreserveWhitespace = true. The verify method is public static bool Verify(X509Certificate2 cert, XmlElement xmlElement, SignedXml signedXml) { bool flag; try {

Manual verification of XML Signature

☆樱花仙子☆ 提交于 2019-12-20 12:41:03
问题 I can successfully do manual reference validation (canonicalize every referenced element --> SHA1 --> Base64 --> check if it's the same of DigestValue content) but I fail with the verification of the SignatureValue. Here's the SignedInfo to canonicalize and hash: <ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod> <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09

How can I convert the private key stored in HSM to SignedXml.SigningKey in C#

吃可爱长大的小学妹 提交于 2019-12-19 04:35:11
问题 I'm trying to implement some demo of XML signing with a certificate which stored in the HSM. I found some interesting example from this link: Sign XML Document with X509Certificate2 and modified it to using certificate and key inside the HSM with PKCS11Interop wrapper. But anyone could give me a suggestion or example to convert ObjectHandle privateKey from HSM to SignedXML.SigningKey private static void SignXmlWithCertificate(XmlDocument xmlDoc, X509Certificate2 cert, Session session, String

Xpath transformation not working in java

筅森魡賤 提交于 2019-12-17 16:31:37
问题 This is my xml document. I want to sign only the userID part using xml signature. I am using xpath transformation to select that particular element. <samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Version="2.0" IssueInstant="2012-05-22T13:40:52:390" ProtocolBinding="urn:oasis:na mes:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="localhos t:8080/consumer.jsp"> <UserID> xyz </UserID> <testing> text </testing> <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML

How to properly Sign XML in Delphi

老子叫甜甜 提交于 2019-12-13 06:49:22
问题 I'm trying to sign XML in Delphi with certificate, but all I'm getting are some unrecognized characters. I'm using this function var xmlData, signature: PByte; data: array[0..0] of PByte; msgCert: array[0..0] of PCCERT_CONTEXT; dwDataSizeArray: array[0..0] of DWORD; sigParams: CRYPT_SIGN_MESSAGE_PARA; cbSignedBlob: DWORD; begin if PCertContext = nil then Exit; GetMem(xmlData, Length(AXml)); try system.Move(Pointer(AXml)^, xmlData^, Length(AXml)); ZeroMemory(@sigParams, SizeOf(CRYPT_SIGN

How to validate signature with phpseclib, in a XML signature message?

点点圈 提交于 2019-12-13 05:42:50
问题 I tested the final XML signature file and it sends, "invalid signatures", why? Information: I have prepared this inf. to be signed with XML signature: <?xml version="1.0" encoding="UTF-8" standalone="no"?><SolicitudRegistro xmlns="http://www.cie.mx/SCG/Inilidad" IdMensaje="f2-8505d81914c"> <FechaEnvio>2013-02-26T21:08:36</FechaEnvio> <Registrante EndPoint="https://200.34.175.46:443/InteropOPE /MensajeidadService" Nombre="Instigua" NombreCorto="IMTA" URI="op.mx"> <DatosDeContacto AreaOficina=

How to sign only specific part of XML

无人久伴 提交于 2019-12-12 08:06:47
问题 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

Python elementtree find function reads Signature as empty (None)

你说的曾经没有我的故事 提交于 2019-12-12 04:35:59
问题 I'm trying to read Signature, SignatureValue and SignedInfo from signed XML in Python with ElementTree but it reads as None. Other xml attributes are read fine. How can I read Signature, SignatureValue and SignedInfo? Here's my code snippet: xml_file = open(settings.STATIC_ROOT + '/file/test.xml', 'rt').read() response_xml = xml_et.fromstring(xml_file.encode('utf-8')) print response_xml.find('Signature') # prints None print response_xml.find('SignatureValue') # prints None print response_xml