Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Objective-C Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Objective-C) Create XAdES Facturae 3.2 Signed Invoice

Demonstrates how to create a factura electrónica XAdES digital signature for Gobierno de España

Note: This example requires Chilkat v9.5.0.75 or greater.

Chilkat Objective-C Library Downloads

MAC OS X (Cocoa) Libs

iOS Libs

#import <CkoXml.h>
#import <CkoXmlDSigGen.h>
#import <CkoCert.h>
#import <CkoStringBuilder.h>

//  ----------------------------------------------------------------------
//  IMPORTANT: This generated example requires Chilkat v9.5.0.75 or later.
//  Contact support@chilkatsoft.com for a pre-release.
//  ----------------------------------------------------------------------

//  ---
//  The following source code can be generated from sample XML using the XML Signature Code Generator at chilkat.io
//  ---

//  Create the XML to be signed...
CkoXml *xmlToSign = [[CkoXml alloc] init];
xmlToSign.Tag = @"fe:Facturae";
[xmlToSign AddAttribute: @"xmlns:ds" value: @"http://www.w3.org/2000/09/xmldsig#"];
[xmlToSign AddAttribute: @"xmlns:fe" value: @"http://www.facturae.es/Facturae/2009/v3.2/Facturae"];
[xmlToSign UpdateChildContent: @"FileHeader|SchemaVersion" value: @"3.2"];
[xmlToSign UpdateChildContent: @"FileHeader|Modality" value: @"I"];
[xmlToSign UpdateChildContent: @"FileHeader|InvoiceIssuerType" value: @"EM"];
[xmlToSign UpdateChildContent: @"FileHeader|Batch|BatchIdentifier" value: @"0000000000B2Emit-"];
[xmlToSign UpdateChildContent: @"FileHeader|Batch|InvoicesCount" value: @"1"];
[xmlToSign UpdateChildContent: @"FileHeader|Batch|TotalInvoicesAmount|TotalAmount" value: @"63.13"];
[xmlToSign UpdateChildContent: @"FileHeader|Batch|TotalOutstandingAmount|TotalAmount" value: @"63.13"];
[xmlToSign UpdateChildContent: @"FileHeader|Batch|TotalExecutableAmount|TotalAmount" value: @"63.13"];
[xmlToSign UpdateChildContent: @"FileHeader|Batch|InvoiceCurrencyCode" value: @"EUR"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|TaxIdentification|PersonTypeCode" value: @"J"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|TaxIdentification|ResidenceTypeCode" value: @"R"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|TaxIdentification|TaxIdentificationNumber" value: @"A82735122"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|CorporateName" value: @"Company Comp SA"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|TradeName" value: @"Comp"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|RegistrationData|Book" value: @"1"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|RegistrationData|RegisterOfCompaniesLocation" value: @"12AP22"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|RegistrationData|Sheet" value: @"3"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|RegistrationData|Folio" value: @"15"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|RegistrationData|Section" value: @"2"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|RegistrationData|Volume" value: @"12"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|RegistrationData|AdditionalRegistrationData" value: @"Sin datos"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|AddressInSpain|Address" value: @"C/ Mayour 33 15 E"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|AddressInSpain|PostCode" value: @"28001"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|AddressInSpain|Town" value: @"Argamasilla de Alba"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|AddressInSpain|Province" value: @"Ciudad Real"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|AddressInSpain|CountryCode" value: @"ESP"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|Telephone" value: @"917776665"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|TeleFax" value: @"917776666"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|WebAddress" value: @"www.facturae.es"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|ElectronicMail" value: @"facturae@mityc.es"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|ContactPersons" value: @"Fernando"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|CnoCnae" value: @"28000"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|INETownCode" value: @"2134AAB"];
[xmlToSign UpdateChildContent: @"Parties|SellerParty|LegalEntity|ContactDetails|AdditionalContactDetails" value: @"Otros datos"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|TaxIdentification|PersonTypeCode" value: @"F"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|TaxIdentification|ResidenceTypeCode" value: @"E"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|TaxIdentification|TaxIdentificationNumber" value: @"0000000000B"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|CentreCode" value: @"1"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|RoleTypeCode" value: @"02"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|Name" value: @"Ruth"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|FirstSurname" value: @"Mauripo"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|OverseasAddress|Address" value: @"Armenia 1922"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|OverseasAddress|PostCodeAndTown" value: @"00000 Buenos Aires"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|OverseasAddress|Province" value: @"Capital Federal"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|OverseasAddress|CountryCode" value: @"ARG"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|AdministrativeCentres|AdministrativeCentre|CentreDescription" value: @"Centro principal de recepcion"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|Name" value: @"Juana"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|FirstSurname" value: @"Mauripo"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|OverseasAddress|Address" value: @"Juncal 1315"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|OverseasAddress|PostCodeAndTown" value: @"00000 Buenos Aires"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|OverseasAddress|Province" value: @"Capital Federal"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|OverseasAddress|CountryCode" value: @"ARG"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|ContactDetails|Telephone" value: @"00547775554"];
[xmlToSign UpdateChildContent: @"Parties|BuyerParty|Individual|ContactDetails|TeleFax" value: @"00547775555"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceHeader|InvoiceNumber" value: @"2"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceHeader|InvoiceSeriesCode" value: @"Emit-"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceHeader|InvoiceDocumentType" value: @"FC"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceHeader|InvoiceClass" value: @"OO"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|IssueDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|OperationDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|PlaceOfIssue|PostCode" value: @"00000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|PlaceOfIssue|PlaceOfIssueDescription" value: @"Regalos"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|InvoicingPeriod|StartDate" value: @"2010-03-09"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|InvoicingPeriod|EndDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|InvoiceCurrencyCode" value: @"EUR"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|TaxCurrencyCode" value: @"EUR"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceIssueData|LanguageName" value: @"es"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax|TaxTypeCode" value: @"01"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax|TaxRate" value: @"16.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax|TaxableBase|TotalAmount" value: @"26.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax|TaxAmount|TotalAmount" value: @"4.16"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax|EquivalenceSurcharge" value: @"1.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax|EquivalenceSurchargeAmount|TotalAmount" value: @"0.26"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax[1]|TaxTypeCode" value: @"01"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax[1]|TaxRate" value: @"0.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesOutputs|Tax[1]|TaxableBase|TotalAmount" value: @"0.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesWithheld|Tax|TaxTypeCode" value: @"05"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesWithheld|Tax|TaxRate" value: @"4.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesWithheld|Tax|TaxableBase|TotalAmount" value: @"26.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|TaxesWithheld|Tax|TaxAmount|TotalAmount" value: @"1.04"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalGrossAmount" value: @"59.75"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalGeneralDiscounts" value: @"0.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalGeneralSurcharges" value: @"0.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalGrossAmountBeforeTaxes" value: @"59.75"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalTaxOutputs" value: @"4.42"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalTaxesWithheld" value: @"1.04"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|InvoiceTotal" value: @"63.13"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalOutstandingAmount" value: @"63.13"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|InvoiceTotals|TotalExecutableAmount" value: @"63.13"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|IssuerContractReference" value: @"A9938281"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|IssuerContractDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|IssuerTransactionReference" value: @"A9938282"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|IssuerTransactionDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|ReceiverContractReference" value: @"BBBH-38271"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|ReceiverContractDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|ReceiverTransactionReference" value: @"BBBH-38272"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|ReceiverTransactionDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|FileReference" value: @"000298172"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|FileDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|SequenceNumber" value: @"1.0"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|DeliveryNotesReferences|DeliveryNote|DeliveryNoteNumber" value: @"132413842"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|DeliveryNotesReferences|DeliveryNote|DeliveryNoteDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|DeliveryNotesReferences|DeliveryNote[1]|DeliveryNoteNumber" value: @"987673211"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|DeliveryNotesReferences|DeliveryNote[1]|DeliveryNoteDate" value: @"2010-03-09"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|ItemDescription" value: @"Flores"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|Quantity" value: @"1.0"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|UnitOfMeasure" value: @"01"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|UnitPriceWithoutTax" value: @"25.000000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|TotalCost" value: @"25.000000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|DiscountsAndRebates|Discount|DiscountReason" value: @"Descuento"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|DiscountsAndRebates|Discount|DiscountRate" value: @"5.0000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|DiscountsAndRebates|Discount|DiscountAmount" value: @"1.250000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|Charges|Charge|ChargeReason" value: @"Cargo"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|Charges|Charge|ChargeAmount" value: @"10.000000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|GrossAmount" value: @"33.750000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|TaxesOutputs|Tax|TaxTypeCode" value: @"01"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|TaxesOutputs|Tax|TaxRate" value: @"0.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|TaxesOutputs|Tax|TaxableBase|TotalAmount" value: @"0.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|TaxesOutputs|Tax|TaxAmount|TotalAmount" value: @"0.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|AdditionalLineItemInformation" value: @"Contacto en Neuquen: Paulita"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|SpecialTaxableEvent|SpecialTaxableEventCode" value: @"01"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|SpecialTaxableEvent|SpecialTaxableEventReason" value: @"Concepto exento por el motivo aqu definido"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine|ArticleCode" value: @"142"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|IssuerContractDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|IssuerTransactionDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|ReceiverContractDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|ReceiverTransactionDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|FileDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|SequenceNumber" value: @"2.0"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|ItemDescription" value: @"Mate"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|Quantity" value: @"2.0"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|UnitOfMeasure" value: @"01"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|UnitPriceWithoutTax" value: @"13.000000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TotalCost" value: @"26.000000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|GrossAmount" value: @"26.000000"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesWithheld|Tax|TaxTypeCode" value: @"05"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesWithheld|Tax|TaxRate" value: @"4.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesWithheld|Tax|TaxableBase|TotalAmount" value: @"26.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesWithheld|Tax|TaxAmount|TotalAmount" value: @"1.04"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesOutputs|Tax|TaxTypeCode" value: @"01"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesOutputs|Tax|TaxRate" value: @"16.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesOutputs|Tax|TaxableBase|TotalAmount" value: @"26.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesOutputs|Tax|TaxAmount|TotalAmount" value: @"4.16"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesOutputs|Tax|EquivalenceSurcharge" value: @"1.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|TaxesOutputs|Tax|EquivalenceSurchargeAmount|TotalAmount" value: @"0.26"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|Items|InvoiceLine[1]|ArticleCode" value: @"122"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|InstallmentDueDate" value: @"2010-03-10"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|InstallmentAmount" value: @"25.00"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|PaymentMeans" value: @"19"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeCredited|IBAN" value: @"4322 3432 22 1341234212"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeCredited|BankCode" value: @"4322"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeCredited|BranchCode" value: @"3432"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeCredited|OverseasBranchAddress|Address" value: @"Juncal 1423 8 Z"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeCredited|OverseasBranchAddress|PostCodeAndTown" value: @"01115 Capital Federal"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeCredited|OverseasBranchAddress|Province" value: @"Buenos Aires"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeCredited|OverseasBranchAddress|CountryCode" value: @"ARG"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|PaymentReconciliationReference" value: @"12223"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeDebited|IBAN" value: @"1234 4312 22 33212341212314"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeDebited|BankCode" value: @"1234"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|AccountToBeDebited|BranchCode" value: @"4312"];
[xmlToSign UpdateChildContent: @"Invoices|Invoice|PaymentDetails|Installment|DebitReconciliationReference" value: @"12223"];

CkoXmlDSigGen *gen = [[CkoXmlDSigGen alloc] init];
BOOL success = YES;

gen.SigLocation = @"fe:Facturae";
gen.SigId = @"Signature869123";
[gen AddSignatureNamespace: @"etsi" nsUri: @"http://uri.etsi.org/01903/v1.3.2#"];
gen.SignedInfoId = @"Signature-SignedInfo241096";
gen.SignedInfoCanonAlg = @"C14N";
gen.SignedInfoDigestMethod = @"sha1";

//  Create an Object to be added to the Signature.
CkoXml *object1 = [[CkoXml alloc] init];
object1.Tag = @"etsi:QualifyingProperties";
[object1 AddAttribute: @"Target" value: @"#Signature869123"];
[object1 UpdateAttrAt: @"etsi:SignedProperties" autoCreate: YES attrName: @"Id" attrValue: @"Signature869123-SignedProperties787205"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SigningTime" value: @"TO BE GENERATED BY CHILKAT"];
[object1 UpdateAttrAt: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SigningCertificate|etsi:Cert|etsi:CertDigest|ds:DigestMethod" autoCreate: YES attrName: @"Algorithm" attrValue: @"http://www.w3.org/2000/09/xmldsig#sha1"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SigningCertificate|etsi:Cert|etsi:CertDigest|ds:DigestValue" value: @"TO BE GENERATED BY CHILKAT"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SigningCertificate|etsi:Cert|etsi:IssuerSerial|ds:X509IssuerName" value: @"TO BE GENERATED BY CHILKAT"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SigningCertificate|etsi:Cert|etsi:IssuerSerial|ds:X509SerialNumber" value: @"TO BE GENERATED BY CHILKAT"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SignaturePolicyIdentifier|etsi:SignaturePolicyId|etsi:SigPolicyId|etsi:Identifier" value: @"http://www.facturae.es/politica_de_firma_formato_facturae/politica_de_firma_formato_facturae_v3_1.pdf"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SignaturePolicyIdentifier|etsi:SignaturePolicyId|etsi:SigPolicyId|etsi:Description" value: @"Poltica de Firma FacturaE v3.1"];
[object1 UpdateAttrAt: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SignaturePolicyIdentifier|etsi:SignaturePolicyId|etsi:SigPolicyHash|ds:DigestMethod" autoCreate: YES attrName: @"Algorithm" attrValue: @"http://www.w3.org/2000/09/xmldsig#sha1"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SignaturePolicyIdentifier|etsi:SignaturePolicyId|etsi:SigPolicyHash|ds:DigestValue" value: @"Ohixl6upD6av8N7pEvDABhEL6hM="];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedSignatureProperties|etsi:SignerRole|etsi:ClaimedRoles|etsi:ClaimedRole" value: @"emisor"];
[object1 UpdateAttrAt: @"etsi:SignedProperties|etsi:SignedDataObjectProperties|etsi:DataObjectFormat" autoCreate: YES attrName: @"ObjectReference" attrValue: @"#Reference-ID-670821"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedDataObjectProperties|etsi:DataObjectFormat|etsi:Description" value: @"Factura electrnica"];
[object1 UpdateChildContent: @"etsi:SignedProperties|etsi:SignedDataObjectProperties|etsi:DataObjectFormat|etsi:MimeType" value: @"text/xml"];

[gen AddObject: @"Signature869123-Object629337" content: [object1 GetXml] mimeType: @"" encoding: @""];

[gen AddObjectRef: @"Signature869123-SignedProperties787205" digestMethod: @"sha1" canonMethod: @"" prefixList: @"" refType: @"http://uri.etsi.org/01903#SignedProperties"];
[gen SetRefIdAttr: @"Signature869123-SignedProperties787205" value: @"SignedPropertiesID459347"];

gen.KeyInfoId = @"Certificate1570061";
[gen AddSameDocRef: @"Certificate1570061" digestMethod: @"sha1" canonMethod: @"" prefixList: @"" refType: @""];

[gen AddSameDocRef: @"" digestMethod: @"sha1" canonMethod: @"" prefixList: @"" refType: @""];
[gen SetRefIdAttr: @"" value: @"Reference-ID-670821"];

//  Provide a certificate + private key. (PFX password is test123)
CkoCert *cert = [[CkoCert alloc] init];
success = [cert LoadPfxFile: @"qa_data/pfx/cert_test123.pfx" password: @"test123"];
if (success != YES) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}

[gen SetX509Cert: cert usePrivateKey: YES];
gen.KeyInfoType = @"X509Data+KeyValue";
gen.X509Type = @"Certificate";

//  Load XML to be signed...
CkoStringBuilder *sbXml = [[CkoStringBuilder alloc] init];
[xmlToSign GetXmlSb: sbXml];

gen.Behaviors = @"CompactSignedXml";

//  Sign the XML...
success = [gen CreateXmlDSigSb: sbXml];
if (success != YES) {
    NSLog(@"%@",gen.LastErrorText);
    return;
}

//  Save the signed XMl to a file.
success = [sbXml WriteFile: @"qa_output/signedXml.xml" charset: @"utf-8" emitBom: NO];

NSLog(@"%@",[sbXml GetAsString]);
 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.