eSocial xml error: Invalid event signature. Only one 'KeyInfo / X509Data' Element is required / allowed

1

I'm getting the error: Event signature invalid. Only one 'KeyInfo / X509Data' Element is required / allowed

Before that I received the error that I should change the signature transform method to:

<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">

Before I was:

<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />

link used as the basis for signing the xml: link

Note: After using the method to sign, I noticed that you do not create this part:

<KeyInfo>
  <X509Data> 
    <X509Certificate>...</X509Certificate>         
  </X509Data> 
</KeyInfo>

Can this be? If yes what could be missing to create this part in XML?

    
asked by anonymous 23.08.2017 / 21:01

1 answer

0

I was able to identify the problem. If someone has the same problem, follow the solution

The code was missing:

Dim KeyInfo As KeyInfo = New KeyInfo()
Dim keyInfoData As KeyInfoX509Data = New KeyInfoX509Data(cert)
KeyInfo.AddClause(keyInfoData)
SignedXml.KeyInfo = KeyInfo

To add the certificate information below the signature

    
23.08.2017 / 22:15