EBICS Initialization

Kuler Master 266 Reputation points
2021-07-28T14:53:59.573+00:00

Hi there,

I need to exchange the keys with our bank so we can start using their EBICS system.
I generated 3 different keys where one is for signature, second one for authentication and the third one for encryption.

using (var provider = new RSACryptoServiceProvider(keySize))
{                
    publicKey = provider.ToXmlString(false);
}

Then I try to send the Modulus element from the exported XML for the signature key:

<?xml version="1.0" encoding="utf-8"?>
<ebicsUnsecuredRequest xmlns="urn:org:ebics:H005"
  xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="urn:org:ebics:H005 ebics_request_H005.xsd"
  Version="H005" Revision="1">
  <header authenticate="true">
    <static>
      <HostID>HOST-ID</HostID>
      <PartnerID>PARTNER-ID</PartnerID>
      <UserID>USER-ID</UserID>
      <OrderDetails>
        <AdminOrderType>INI</AdminOrderType>
        <OrderID>A001</OrderID>
        <OrderAttribute>DZNNN</OrderAttribute>
      </OrderDetails>
      <SecurityMedium>0200</SecurityMedium>
    </static>
    <mutable/>
  </header>
  <body>
    <DataTransfer>
      <OrderData>MODULUS-VALUE-HERE</OrderData>
    </DataTransfer>
  </body>
</ebicsUnsecuredRequest>

Then I get an error message saying that XML data is not well formatted/formed. No further explanation unfortunately.
I wonder if I should encode the key or manipulate the key string in another way. However, like this it won't work :(

Is there anyone familiar with EBICS system that could help me with this? Would be greatly appreciated.

Thanks!

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,492 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,946 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 54,401 Reputation points
    2021-07-28T15:59:28.927+00:00

    The schema is available online. It depends on what version your bank is using. Running your XML against the schema indicates the following:

    The 'urn:org:ebics:H005:PartnerID' element is invalid - The value 'PARTNER-ID' is invalid according to its datatype 'urn:org:ebics:H005:PartnerIDType' - The Pattern constraint failed.
    The 'urn:org:ebics:H005:UserID' element is invalid - The value 'USER-ID' is invalid according to its datatype 'urn:org:ebics:H005:UserIDType' - The Pattern constraint failed.
    The element 'OrderDetails' in namespace 'urn:org:ebics:H005' has invalid child element 'OrderID' in namespace 'urn:org:ebics:H005'.
    The 'urn:org:ebics:H005:OrderData' element is invalid - The value 'MODULUS-VALUE-HERE' is invalid according to its datatype 'Base64Binary' - The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

    Here's the test code (assuming you have your XML in a file and the XSD from the link given.

    static void Main(string[] args)
    {
        var sourceXml = @"C:\temp\test.xml";
    
        var doc = new XmlDocument();
        doc.Load(sourceXml);
    
        var schemas = Directory.EnumerateFiles(@"C:\temp", "*.xsd");
        foreach (var schema in schemas)
        {
            using (var stream = File.OpenRead(schema))
                doc.Schemas.Add(XmlSchema.Read(stream, null));
        };
    
        Console.WriteLine("Validating...");
        doc.Validate(( o, e ) => Console.WriteLine(e.Message));
        Console.WriteLine("Validated");
    }
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.