• API Overview
  • EBICS API
  • FinTS API
  • XS2A API
  • SEPA API
Search Results for

    Class EbicsUtil

    Collection of static utility functions.

    Inheritance
    System.Object
    EbicsUtil
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Subsembly.EBICS
    Assembly: Subsembly.EBICS.Core.dll
    Syntax
    public static class EbicsUtil

    Fields

    DSigNamespaceURI

    Declaration
    public const string DSigNamespaceURI = "http://www.w3.org/2000/09/xmldsig#"
    Field Value
    Type Description
    System.String

    DSigSHA1URI

    Declaration
    public const string DSigSHA1URI = "http://www.w3.org/2000/09/xmldsig#sha1"
    Field Value
    Type Description
    System.String

    DSigSHA256URI

    Declaration
    public const string DSigSHA256URI = "http://www.w3.org/2001/04/xmlenc#sha256"
    Field Value
    Type Description
    System.String

    Properties

    ApiVersion

    Provides the version of the Subsembly EBICS API

    Declaration
    public static Version ApiVersion { get; }
    Property Value
    Type Description
    System.Version

    LatinEncoding

    Declaration
    public static Encoding LatinEncoding { get; }
    Property Value
    Type Description
    System.Text.Encoding

    UTF8Encoding

    Declaration
    public static Encoding UTF8Encoding { get; }
    Property Value
    Type Description
    System.Text.Encoding

    Methods

    AppendElement(XmlElement, String, String, String)

    Creates and appends a new child XML element.

    Declaration
    public static XmlElement AppendElement(XmlElement xmlParent, string sElementTag, string sElementNamespace, string sElementValue)
    Parameters
    Type Name Description
    System.Xml.XmlElement xmlParent

    The parent XML element where a new child XML element shall be appended to.

    System.String sElementTag

    The local name of the new XML element to be created.

    System.String sElementNamespace

    The namespace name of the namespace that the local name of the XML element is defined in.

    System.String sElementValue

    The string value of the XML element to create. This will become the InnerText of the new XML element. If this is null, then this method will do nothing (i.e. it will not append a XML element).

    Returns
    Type Description
    System.Xml.XmlElement

    BuildReturnCodeMessage(EbicsReturnCode, EbicsReturnCode)

    Builds a nice message from a technical and a business message.

    Declaration
    public static string BuildReturnCodeMessage(EbicsReturnCode aTechnicalReturnCode, EbicsReturnCode aBusinessReturnCode)
    Parameters
    Type Name Description
    EbicsReturnCode aTechnicalReturnCode

    The technical return code to present in the message. May be null if not present. The return code will only be included in the message if it is not EBICS_OK.

    EbicsReturnCode aBusinessReturnCode

    The business return code to present in the message. May be null if not present. The return code will only be included in the message if it is not EBICS_OK.

    Returns
    Type Description
    System.String

    A nice message string suitable to be presented in a message box. Or null if there is nothing to be reported to the user.

    Remarks

    Builds a nice, human consumable message string from the given return codes. If both parameters are null, or hold an EBICS_OK return code, then no message is generated and null is returned instead.

    BytesToXml(Byte[])

    Declaration
    public static XmlDocument BytesToXml(byte[] vb)
    Parameters
    Type Name Description
    System.Byte[] vb
    Returns
    Type Description
    System.Xml.XmlDocument

    CheckFingerprint(Boolean, EbicsPubKeyInfo, String)

    Declaration
    public static bool CheckFingerprint(bool fFromCertificate, EbicsPubKeyInfo aPubKey, string sFingerprint)
    Parameters
    Type Name Description
    System.Boolean fFromCertificate
    EbicsPubKeyInfo aPubKey
    System.String sFingerprint

    String of hex digits and optional whitespace. Hex digits may be lower or upper case. If this is an empty string, contained only whitespace, or is null, then false will be returned. If it contains any invalid characters, then false will be returned.

    Returns
    Type Description
    System.Boolean

    If the given sFingerprint is invalid, or does not match the public key, then false is returned. If the fingerprint matches the public key, then true is returned.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter aPubKey was null.

    DataToXml(EbicsDataBuffer)

    Loads an XML document from a raw data buffer.

    Declaration
    public static XmlDocument DataToXml(EbicsDataBuffer d)
    Parameters
    Type Name Description
    EbicsDataBuffer d
    Returns
    Type Description
    System.Xml.XmlDocument
    Exceptions
    Type Condition
    System.ArgumentNullException

    The given parameter was null.

    System.Xml.XmlException

    The raw data buffer does not contain a valid XML document.

    EvaluateOrderResult(EbicsOrder)

    Evaluates order result and returns message text for it.

    Declaration
    public static string EvaluateOrderResult(EbicsOrder aOrder)
    Parameters
    Type Name Description
    EbicsOrder aOrder

    The order that was executed. Must not be null.

    Returns
    Type Description
    System.String

    If the order failed, then an approrpiate, detailed error message text is returned. If the order succeeded then null is returned.

    FormatDate(DateTime)

    Format the given date in ISO 8601 date representation.

    Declaration
    public static string FormatDate(DateTime tDate)
    Parameters
    Type Name Description
    System.DateTime tDate
    Returns
    Type Description
    System.String

    If the given date is DateTime.MinValue, then null is returned. Otherwise an ISO date string according to the format "yyyy-MM-dd" is returned.

    FormatFingerprint(EbicsContact, EbicsPubKeyInfo)

    Creates a multi-line formatted fingerprint text for the printed Ini-Letter or UI.

    Declaration
    public static string FormatFingerprint(EbicsContact aContact, EbicsPubKeyInfo aPubKey)
    Parameters
    Type Name Description
    EbicsContact aContact

    The EbicsContact for which to create the formatted fingerprint.

    EbicsPubKeyInfo aPubKey
    Returns
    Type Description
    System.String

    FormatFingerprint(EbicsContact, EbicsPubKeyInfo, EbicsFingerprintPart)

    Creates a nicely formatted fingerprint for the printed Ini-Letter or UI.

    Declaration
    public static string FormatFingerprint(EbicsContact aContact, EbicsPubKeyInfo aPubKey, EbicsFingerprintPart nPart)
    Parameters
    Type Name Description
    EbicsContact aContact

    The EbicsContact for which to create the formatted fingerprint.

    EbicsPubKeyInfo aPubKey
    EbicsFingerprintPart nPart
    Returns
    Type Description
    System.String

    FormatHex(Byte[], Int32)

    Declaration
    public static string FormatHex(byte[] vb, int nColumns)
    Parameters
    Type Name Description
    System.Byte[] vb
    System.Int32 nColumns
    Returns
    Type Description
    System.String

    FormatHex(Byte[], Int32, Int32, Int32)

    Declaration
    public static string FormatHex(byte[] vb, int nOffset, int nLength, int nColumns)
    Parameters
    Type Name Description
    System.Byte[] vb
    System.Int32 nOffset
    System.Int32 nLength
    System.Int32 nColumns
    Returns
    Type Description
    System.String

    FormatXml(XmlDocument)

    Creates a nicely formatted string from the XML document.

    Declaration
    public static string FormatXml(XmlDocument xmlDocument)
    Parameters
    Type Name Description
    System.Xml.XmlDocument xmlDocument

    The XML document to be formatted. This must not be null.

    Returns
    Type Description
    System.String

    GetAllKnownHosts()

    Returns an array of all known Host-IDs.

    Declaration
    public static string[] GetAllKnownHosts()
    Returns
    Type Description
    System.String[]

    GetAttribute(XmlElement, String)

    Get an attribute from an XML element. This method does never return an empty string, but will return null if an attribute is not present.

    Declaration
    public static string GetAttribute(XmlElement xmlElement, string sAttributeName)
    Parameters
    Type Name Description
    System.Xml.XmlElement xmlElement
    System.String sAttributeName
    Returns
    Type Description
    System.String

    GetElement(XmlElement, String, String, Boolean)

    Gets the InnerText from a XML element.

    Declaration
    public static string GetElement(XmlElement xmlParent, string sElementTag, string sElementNamespace = null, bool fMandatory = false)
    Parameters
    Type Name Description
    System.Xml.XmlElement xmlParent

    The parent XML element that contains the XML element to be retrieved.

    System.String sElementTag

    The local name of the XML element to be retrieved.

    System.String sElementNamespace

    The namespace name of the namespace that the local name of the XML element is defined in.

    System.Boolean fMandatory
    Returns
    Type Description
    System.String

    If the requested XML element exists, then its InnerText is returned. If the requested XML element does not exist, then null is returned.

    GetKnownHostURL(String)

    Looks up the URL for a given Host ID.

    Declaration
    public static string GetKnownHostURL(string sHostID)
    Parameters
    Type Name Description
    System.String sHostID

    The Host ID for which to look up an URL. Must not be null or an empty string.

    Returns
    Type Description
    System.String

    If the Host ID is known, then the URL of that host is returned. If the Host ID is not known, then null is returned.

    Remarks

    This method is based on a very small hard coded list. Therefore, for most hosts it won't know the URL.

    GetOrderTypeDescription(String)

    Returns a descriptive text for a given EBICS order type.

    Declaration
    public static string GetOrderTypeDescription(string sOrderType)
    Parameters
    Type Name Description
    System.String sOrderType

    The EBICS order type consists of three upper case letters.

    Returns
    Type Description
    System.String

    If the requested order type is known, then a short, descriptive text is returned. If the order type is not known, then a replacement string including the sOrderType is returned.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter sOrderType was null.

    System.ArgumentException

    The parameter sOrderType was an empty string.

    IsAdminOrderType(String)

    Returns true if the given order type is a known admistrative order type.

    Declaration
    public static bool IsAdminOrderType(string sOrderType)
    Parameters
    Type Name Description
    System.String sOrderType
    Returns
    Type Description
    System.Boolean
    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter sOrderType was null.

    System.ArgumentException

    The given order type did not consist of exactly three upper case letters in the range from A-Z or digits.

    IsBIC(String)

    Check whether a string is a syntactically valid BIC.

    Declaration
    public static bool IsBIC(string sBIC)
    Parameters
    Type Name Description
    System.String sBIC
    Returns
    Type Description
    System.Boolean
    Remarks

    This method does not do any semantic validation of the, it only performs some simple syntactical checks.

    IsDigits(String)

    Checks whether a string solely consists of digits.

    Declaration
    public static bool IsDigits(string s)
    Parameters
    Type Name Description
    System.String s

    The string to be checked.

    Returns
    Type Description
    System.Boolean

    If the given string was null, then false is returned. If the given string was empty, then true is returned. If the string contains only digits, then true is returned, otherwise false is returned.

    IsDigitsOrUpperAscii(String)

    Checks whether a string solely consists of digits and upper ASCII characters.

    Declaration
    public static bool IsDigitsOrUpperAscii(string s)
    Parameters
    Type Name Description
    System.String s

    The string to be checked.

    Returns
    Type Description
    System.Boolean

    If the given string was null, then false is returned. If the given string was empty, then true is returned. If the string contains only upper ASCII characters in the range 'A' through 'Z' or digits in the range '0' through '9', then true is returned, otherwise false is returned.

    IsIBAN(String)

    Check whether a string is a syntactically valid IBAN.

    Declaration
    public static bool IsIBAN(string sIBAN)
    Parameters
    Type Name Description
    System.String sIBAN
    Returns
    Type Description
    System.Boolean
    Remarks

    This method does not compute and check the check digits of the IBAN. It only performs some simple syntactical checks.

    IsUpperAscii(String)

    Checks whether a string solely consists of upper ASCII characters.

    Declaration
    public static bool IsUpperAscii(string s)
    Parameters
    Type Name Description
    System.String s

    The string to be checked.

    Returns
    Type Description
    System.Boolean

    If the given string was null, then false is returned. If the given string was empty, then true is returned. If the string contains only upper ASCII characters in the range 'A' through 'Z', then true is returned, otherwise false is returned.

    IsValidHostID(String)

    Determines whether the given HostID is syntactically correct. It does not validate whether the HostID is a known HostID.

    Declaration
    public static bool IsValidHostID(string sHostID)
    Parameters
    Type Name Description
    System.String sHostID

    A HostID or null.

    Returns
    Type Description
    System.Boolean

    If the HostID looks like a valid HostID, then true is returned. If the HostID is invalid or null, then false is returned.

    IsValidHostURL(String)

    Declaration
    public static bool IsValidHostURL(string sHostURL)
    Parameters
    Type Name Description
    System.String sHostURL
    Returns
    Type Description
    System.Boolean

    IsValidID(String)

    Validates the ID of an EBICS party, i.e. a UserID, PartnerID or SystemID.

    Declaration
    public static bool IsValidID(string sID)
    Parameters
    Type Name Description
    System.String sID

    The ID to validate. If this is null, then false will be returned.

    Returns
    Type Description
    System.Boolean

    If the ID has a valid syntax, then true is returned. Otherwise false is returned.

    Remarks

    Older EBICS versions did only allow up to eight upper case characters and digits in IDs according to the pattern [A-Z0-9]{1,8}. Since EBICS 2.4 the allowed range was extended according to the pattern [a-zA-Z0-9,=]{1,35}. This method validates the ID according to the new pattern.

    IsValidIDChar(Char)

    A valid ID consists of up to 35 valid ID chars.

    Declaration
    public static bool IsValidIDChar(char ch)
    Parameters
    Type Name Description
    System.Char ch
    Returns
    Type Description
    System.Boolean
    Remarks

    Older EBICS versions did only allow up to eight upper case characters and digits in IDs according to the pattern [A-Z0-9]{1,8}. Since EBICS 2.4 the allowed range was extended according to the pattern [a-zA-Z0-9,=]{1,35}. This method validates the ID according to the new pattern.

    IsValidOrderID(String)

    Declaration
    public static bool IsValidOrderID(string sOrderID)
    Parameters
    Type Name Description
    System.String sOrderID
    Returns
    Type Description
    System.Boolean

    IsValidOrderType(String)

    Declaration
    public static bool IsValidOrderType(string sOrderType)
    Parameters
    Type Name Description
    System.String sOrderType
    Returns
    Type Description
    System.Boolean

    Returns true if, and only if, the parameter is non-null and a syntactically correct order type that consists of exactly three upper case letters in the range from A-Z or digits.

    NextSibling(XmlElement)

    Get next XML sibling element with the same name.

    Declaration
    public static XmlElement NextSibling(XmlElement xmlElement)
    Parameters
    Type Name Description
    System.Xml.XmlElement xmlElement

    The XML element from which to find the next sibling with the same name. This must not be null.

    Returns
    Type Description
    System.Xml.XmlElement

    If another sibling XML element is found, then it is returned. If there is no adjacent XML element sibling with the same name, then null is returned.

    Remarks

    This methods simplifies walking over a sequence of similar XML elements. While looking for the next XML element sibling it skips over all whitespace and comment nodes that may appear in between.

    ParseDate(String)

    Tries to parse a given ISO 8601 date representation.

    Declaration
    public static DateTime ParseDate(string sDate)
    Parameters
    Type Name Description
    System.String sDate

    The date string to be parsed. Only the date portion of this string is parsed, any time specification is ignored. If the parameter is null, then the value DateTime.MinValue is returned.

    Returns
    Type Description
    System.DateTime

    SetAttribute(XmlElement, String, String)

    Declaration
    public static void SetAttribute(XmlElement xmlElement, string sAttributeName, string sAttributeValue)
    Parameters
    Type Name Description
    System.Xml.XmlElement xmlElement
    System.String sAttributeName
    System.String sAttributeValue

    Squeeze(String)

    Removes all the whitespaces in the specified string and returns the cleaned string.

    Declaration
    public static string Squeeze(string s)
    Parameters
    Type Name Description
    System.String s
    Returns
    Type Description
    System.String

    If the parameter was null, then this method returns null. In any other case, it returnes the cleaned, maybe all empty, string.

    StreamToXml(Stream)

    Declaration
    public static XmlDocument StreamToXml(Stream aStream)
    Parameters
    Type Name Description
    System.IO.Stream aStream

    Stream to read XML document from. This stream will not be closed.

    Returns
    Type Description
    System.Xml.XmlDocument

    Trim(String)

    Trims whitespace from a string.

    Declaration
    public static string Trim(string s)
    Parameters
    Type Name Description
    System.String s

    String to be trimmed. May be null.

    Returns
    Type Description
    System.String

    If the parameter s was null, then null is returned, otherwise the trimmed string is returned. If the given string consists solely of whitespace, then an empty string will be returned.

    See Also
    Trim(String, Int32)

    Trim(String, Int32)

    Trims whitespace from a string.

    Declaration
    public static string Trim(string s, int nMaxLength)
    Parameters
    Type Name Description
    System.String s

    String to be trimmed. May be null.

    System.Int32 nMaxLength

    The max length of the trimmed string to be returned. If the string is longer than this max length, then it is truncated at the max length.

    Returns
    Type Description
    System.String

    XmlToBytes(XmlDocument)

    Declaration
    public static byte[] XmlToBytes(XmlDocument xmlDocument)
    Parameters
    Type Name Description
    System.Xml.XmlDocument xmlDocument
    Returns
    Type Description
    System.Byte[]

    XmlToData(XmlDocument)

    Serializes an XML document into a raw data buffer.

    Declaration
    public static EbicsDataBuffer XmlToData(XmlDocument xmlDocument)
    Parameters
    Type Name Description
    System.Xml.XmlDocument xmlDocument
    Returns
    Type Description
    EbicsDataBuffer
    Exceptions
    Type Condition
    System.ArgumentNullException

    The given parameter was null.

    XmlToStream(XmlDocument, Stream)

    Serializes an XML document into the given byte stream.

    Declaration
    public static void XmlToStream(XmlDocument xmlDocument, Stream aStream)
    Parameters
    Type Name Description
    System.Xml.XmlDocument xmlDocument
    System.IO.Stream aStream

    The stream to write the XML document to. This stream will not be closed!

    Remarks

    The document will be written using UTF-8 encoding and will not have a byte order mark.

    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH