Malaysia MyInvois Error: DS301, Signature Not Found (Tandatangan tidak ditemui.)

Error returned from the Malaysia MyInvois server can be cryptic and obscure, making it difficult to know the cause of a problem.  This blog post is to document a particular error with the hope that it might be found via a web search by other having the same problem..

Malaysia MyInvois Error: DS301, Signature Not Found

This is the returned error:

  "validationResults": {
    "status": "Invalid",
    "validationSteps": [
      {
        "status": "Valid",
        "name": "Step03-Duplicated Submission Validator"
      },
      {
        "status": "Valid",
        "name": "Step04-Code Field Validator"
      },
      {
        "status": "Valid",
        "name": "Step05-Taxpayer Profile Validator"
      },
      {
        "status": "Valid",
        "name": "Step06-Document References Validator"
      },
      {
        "status": "Valid",
        "name": "Step07-Document Currency Validator"
      },
      {
        "status": "Invalid",
        "error": {
          "propertyName": null,
          "propertyPath": null,
          "errorCode": "Error08",
          "error": "Step08-Invalid Document Signature Validator",
          "errorMs": "Step08-Pengesah Tandatangan Dokumen Tidak Sah",
          "innerError": [
            {
              "propertyName": "Signature",
              "propertyPath": "Invoice.Signature",
              "errorCode": "DS301",
              "error": "Signature not found.",
              "errorMs": "Tandatangan tidak ditemui.",
              "innerError": null
            }
          ]
        },
        "name": "Step08-Document Signature Validator"
      }
    ]
  },

The Solution (cause of the error)

The error occurs if the following section is not included in the XML to be signed:

<cac:Signature>
    <cbc:ID>urn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>
    <cbc:SignatureMethod>urn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>
  </cac:Signature>