C# UBL 2.1 signature
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I need to sign an UBL 2.1 Invoice using c#.
The proble is that, after signing i need the Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
to be embeded in
an UBLExtensions element, like so
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
I have tried to add these elements at a later time, but the signature is not considered valid.
I don't have any experience signing XML files, so any help would be much apreciated
EDIT
The initial XML file is
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
... Invoice Elements
</Invoice>
I need to produce something like
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
<ext:UBLExtensions>
<ext:UBLExtension xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2" xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
<ext:ExtensionContent>
<sig:UBLDocumentSignatures>
<sac:SignatureInformation>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
... signature contents produced by signed xml class
</Signature>
</sac:SignatureInformation>
</sig:UBLDocumentSignatures>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
... Invoice Elements
</Invoice>
If I add these elements at a later time, the signature is considered invalid.
Again, any help will be highly appreciated.
The link to the actual signed file is this one:
signed_xml
c# xml x509certificate signedxml
|
show 6 more comments
I need to sign an UBL 2.1 Invoice using c#.
The proble is that, after signing i need the Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
to be embeded in
an UBLExtensions element, like so
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
I have tried to add these elements at a later time, but the signature is not considered valid.
I don't have any experience signing XML files, so any help would be much apreciated
EDIT
The initial XML file is
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
... Invoice Elements
</Invoice>
I need to produce something like
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
<ext:UBLExtensions>
<ext:UBLExtension xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2" xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
<ext:ExtensionContent>
<sig:UBLDocumentSignatures>
<sac:SignatureInformation>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
... signature contents produced by signed xml class
</Signature>
</sac:SignatureInformation>
</sig:UBLDocumentSignatures>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
... Invoice Elements
</Invoice>
If I add these elements at a later time, the signature is considered invalid.
Again, any help will be highly appreciated.
The link to the actual signed file is this one:
signed_xml
c# xml x509certificate signedxml
Do you mean the signature is not meeting schema requirements? Take xml that is failing and paste in view as follows from VS menu : Project : Add new Item : Xml file. Errors will show as compiler errors in Error View. You should be able to click on schema(s) to see the actual schema requirement that is failing.
– jdweng
Jan 3 at 12:20
Thank you for your time but I have no schema validation problems. The problem lies within the signature itself.
– MSantos
Jan 3 at 12:31
Do you mean like in following SOAP : stackoverflow.com/questions/46722997/…
– jdweng
Jan 3 at 12:34
No, i just edited my question, hope it clarifies the subject. But thanks anyway.
– MSantos
Jan 3 at 13:25
I think it is failing the schema check for ExtensionContent. See schema at following URL : github.com/ept/oaccounts/blob/master/xsd/common/… Look at line 141. There is no definition. Line 138 indicates the min and max are 1. Must Have. It also indicates the names space is xsd while you have ext.
– jdweng
Jan 3 at 13:52
|
show 6 more comments
I need to sign an UBL 2.1 Invoice using c#.
The proble is that, after signing i need the Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
to be embeded in
an UBLExtensions element, like so
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
I have tried to add these elements at a later time, but the signature is not considered valid.
I don't have any experience signing XML files, so any help would be much apreciated
EDIT
The initial XML file is
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
... Invoice Elements
</Invoice>
I need to produce something like
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
<ext:UBLExtensions>
<ext:UBLExtension xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2" xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
<ext:ExtensionContent>
<sig:UBLDocumentSignatures>
<sac:SignatureInformation>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
... signature contents produced by signed xml class
</Signature>
</sac:SignatureInformation>
</sig:UBLDocumentSignatures>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
... Invoice Elements
</Invoice>
If I add these elements at a later time, the signature is considered invalid.
Again, any help will be highly appreciated.
The link to the actual signed file is this one:
signed_xml
c# xml x509certificate signedxml
I need to sign an UBL 2.1 Invoice using c#.
The proble is that, after signing i need the Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
to be embeded in
an UBLExtensions element, like so
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
I have tried to add these elements at a later time, but the signature is not considered valid.
I don't have any experience signing XML files, so any help would be much apreciated
EDIT
The initial XML file is
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
... Invoice Elements
</Invoice>
I need to produce something like
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
<ext:UBLExtensions>
<ext:UBLExtension xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2" xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
<ext:ExtensionContent>
<sig:UBLDocumentSignatures>
<sac:SignatureInformation>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
... signature contents produced by signed xml class
</Signature>
</sac:SignatureInformation>
</sig:UBLDocumentSignatures>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
... Invoice Elements
</Invoice>
If I add these elements at a later time, the signature is considered invalid.
Again, any help will be highly appreciated.
The link to the actual signed file is this one:
signed_xml
c# xml x509certificate signedxml
c# xml x509certificate signedxml
edited Jan 3 at 18:01
MSantos
asked Jan 3 at 12:09
MSantosMSantos
135
135
Do you mean the signature is not meeting schema requirements? Take xml that is failing and paste in view as follows from VS menu : Project : Add new Item : Xml file. Errors will show as compiler errors in Error View. You should be able to click on schema(s) to see the actual schema requirement that is failing.
– jdweng
Jan 3 at 12:20
Thank you for your time but I have no schema validation problems. The problem lies within the signature itself.
– MSantos
Jan 3 at 12:31
Do you mean like in following SOAP : stackoverflow.com/questions/46722997/…
– jdweng
Jan 3 at 12:34
No, i just edited my question, hope it clarifies the subject. But thanks anyway.
– MSantos
Jan 3 at 13:25
I think it is failing the schema check for ExtensionContent. See schema at following URL : github.com/ept/oaccounts/blob/master/xsd/common/… Look at line 141. There is no definition. Line 138 indicates the min and max are 1. Must Have. It also indicates the names space is xsd while you have ext.
– jdweng
Jan 3 at 13:52
|
show 6 more comments
Do you mean the signature is not meeting schema requirements? Take xml that is failing and paste in view as follows from VS menu : Project : Add new Item : Xml file. Errors will show as compiler errors in Error View. You should be able to click on schema(s) to see the actual schema requirement that is failing.
– jdweng
Jan 3 at 12:20
Thank you for your time but I have no schema validation problems. The problem lies within the signature itself.
– MSantos
Jan 3 at 12:31
Do you mean like in following SOAP : stackoverflow.com/questions/46722997/…
– jdweng
Jan 3 at 12:34
No, i just edited my question, hope it clarifies the subject. But thanks anyway.
– MSantos
Jan 3 at 13:25
I think it is failing the schema check for ExtensionContent. See schema at following URL : github.com/ept/oaccounts/blob/master/xsd/common/… Look at line 141. There is no definition. Line 138 indicates the min and max are 1. Must Have. It also indicates the names space is xsd while you have ext.
– jdweng
Jan 3 at 13:52
Do you mean the signature is not meeting schema requirements? Take xml that is failing and paste in view as follows from VS menu : Project : Add new Item : Xml file. Errors will show as compiler errors in Error View. You should be able to click on schema(s) to see the actual schema requirement that is failing.
– jdweng
Jan 3 at 12:20
Do you mean the signature is not meeting schema requirements? Take xml that is failing and paste in view as follows from VS menu : Project : Add new Item : Xml file. Errors will show as compiler errors in Error View. You should be able to click on schema(s) to see the actual schema requirement that is failing.
– jdweng
Jan 3 at 12:20
Thank you for your time but I have no schema validation problems. The problem lies within the signature itself.
– MSantos
Jan 3 at 12:31
Thank you for your time but I have no schema validation problems. The problem lies within the signature itself.
– MSantos
Jan 3 at 12:31
Do you mean like in following SOAP : stackoverflow.com/questions/46722997/…
– jdweng
Jan 3 at 12:34
Do you mean like in following SOAP : stackoverflow.com/questions/46722997/…
– jdweng
Jan 3 at 12:34
No, i just edited my question, hope it clarifies the subject. But thanks anyway.
– MSantos
Jan 3 at 13:25
No, i just edited my question, hope it clarifies the subject. But thanks anyway.
– MSantos
Jan 3 at 13:25
I think it is failing the schema check for ExtensionContent. See schema at following URL : github.com/ept/oaccounts/blob/master/xsd/common/… Look at line 141. There is no definition. Line 138 indicates the min and max are 1. Must Have. It also indicates the names space is xsd while you have ext.
– jdweng
Jan 3 at 13:52
I think it is failing the schema check for ExtensionContent. See schema at following URL : github.com/ept/oaccounts/blob/master/xsd/common/… Look at line 141. There is no definition. Line 138 indicates the min and max are 1. Must Have. It also indicates the names space is xsd while you have ext.
– jdweng
Jan 3 at 13:52
|
show 6 more comments
1 Answer
1
active
oldest
votes
The problem was that the extension elements must be placed on the document before the signing process. Shame on me!
Thak you for your time!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022024%2fc-sharp-ubl-2-1-signature%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem was that the extension elements must be placed on the document before the signing process. Shame on me!
Thak you for your time!
add a comment |
The problem was that the extension elements must be placed on the document before the signing process. Shame on me!
Thak you for your time!
add a comment |
The problem was that the extension elements must be placed on the document before the signing process. Shame on me!
Thak you for your time!
The problem was that the extension elements must be placed on the document before the signing process. Shame on me!
Thak you for your time!
answered Jan 22 at 18:10
MSantosMSantos
135
135
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022024%2fc-sharp-ubl-2-1-signature%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you mean the signature is not meeting schema requirements? Take xml that is failing and paste in view as follows from VS menu : Project : Add new Item : Xml file. Errors will show as compiler errors in Error View. You should be able to click on schema(s) to see the actual schema requirement that is failing.
– jdweng
Jan 3 at 12:20
Thank you for your time but I have no schema validation problems. The problem lies within the signature itself.
– MSantos
Jan 3 at 12:31
Do you mean like in following SOAP : stackoverflow.com/questions/46722997/…
– jdweng
Jan 3 at 12:34
No, i just edited my question, hope it clarifies the subject. But thanks anyway.
– MSantos
Jan 3 at 13:25
I think it is failing the schema check for ExtensionContent. See schema at following URL : github.com/ept/oaccounts/blob/master/xsd/common/… Look at line 141. There is no definition. Line 138 indicates the min and max are 1. Must Have. It also indicates the names space is xsd while you have ext.
– jdweng
Jan 3 at 13:52