Skip to content

Conversation

@glarrain
Copy link
Contributor

glarrain added 30 commits April 16, 2019 17:32
"Formato XML del Archivo Electrónico de Cesión" of the
"Registro electrónico de cesión de créditos".

Source (2019-04-16):
http://www.sii.cl/factura_electronica/schema_cesion.zip

Some files were ignored:
- 'DTE_v10.xsd': there is a newer version in the repo.
- 'SiiTypes_v10.xsd': there is a newer version in the repo.
- 'xmldsignature_v10.xsd': identical to the version in the repo.

The included files are up to date with respect to those in
repository/project "LibreDTE" (39156263)
https://github.com/LibreDTE/libredte-lib/tree/39156263/schemas

MD5 checksums:
- 82d426fc3bd5f3a29e61a1d07ed4d6dd  schema_cesion.zip
- 8e80522d91bcf99077c12e15354eeae4  schema_cesion/AEC_v10.xsd
- 8db534d686bc84fc7960199dd5fdacd8  schema_cesion/Cesion_v10.xsd
- b2fd1907af733ae9401604c694837a85  schema_cesion/DTECedido_v10.xsd
- e72ee34d798224f31a5127edda712bbf  schema_cesion/DTE_v10.xsd
- 620cf4867d8ba9c16dba74ab05830963  schema_cesion/Recibos_v10.xsd
- b6a63aa427e3d528e46a7d94ccbdcb32  schema_cesion/SiiTypes_v10.xsd
- 8b83aaae477a57d829b075230237102c  schema_cesion/xmldsignature_v10.xsd
data.ref: add XML schemas for "Cesion" (RTC)
With permission from the "cesionario" of the "cesion" (ST Capital S.A.).

The DTE XML file was extracted from the AEC XML file.
…c-files

test_data: fix and add real SII DTE & AEC XML files
For commonly used/references XML-related classes.
Add helper properties.

Also:
- Improve docstrings and comments a little.
- Implement tests.
And add some test stubs.
- `vendedor_rut`
- `deudor_rut`
- `firma_documento_dt_naive`
- `signature_value_base64`
- `signature_x509_cert_base64`
- `emisor_giro`
- `emisor_email`
- `receptor_email`
Retrieved on 2019-04-23.

Details
-------

*.google.com
Identity: *.google.com
Verified by: Google Internet Authority G3
Expires: 18/06/19

Subject Name
C (Country):	US
ST (State):	California
L (Locality):	Mountain View
O (Organization):	Google LLC
CN (Common Name):	*.google.com

Issuer Name
C (Country):	US
O (Organization):	Google Trust Services
CN (Common Name):	Google Internet Authority G3

Issued Certificate
Version:	3
Serial Number:	5C 3F 5E 0A F8 7F E3 83 F5 11 3E 51 23 52 EE 26
Not Valid Before:	2019-03-26
Not Valid After:	2019-06-18

Certificate Fingerprints
SHA1:	F5 19 59 D6 6D 50 BB DF 5E EC C0 9D E7 21 10 F6 C6 03 45 B5
MD5:	5F C6 5C 5E 61 F0 66 74 77 B9 4E 6C FC B2 2F 2C

Public Key Info
Key Algorithm:	Elliptic Curve
Key Parameters:	06 08 2A 86 48 CE 3D 03 01 07
Key Size:	256
Key SHA1 Fingerprint:	6F 37 DE 91 C0 D8 E1 AD 64 8E 30 F7 EF 1C 00 22 15 E8 92 6D
Public Key:	04 03 69 59 22 D7 2D B2 66 E5 E4 73 73 51 09 9A F4 88 6F 3D 27 00 D4 FE 6F 5D 6B F9 78 52 50 20 1B 7D 08 52 FB 83 3F F7 56 09 81 51 3A 52 D6 49 AC B3 BB 18 6C 6F A7 5B 55 FC 32 FC E7 B3 5A 2C 45

Extended Key Usage
Allowed Purposes:	Server Authentication
Critical:	No

Key Usage
Usages:	Digital signature
Critical:	Yes
The file is the output of command:
    ./scripts/clean_dte_xml_file.py file \
        'tests/test_data/sii-dte/DTE--76354771-K--33--170.xml' \
        'tests/test_data/sii-dte/DTE--76354771-K--33--170--cleaned.xml'
Although it is quite old (2002), it is helpful to test some cases.

Source: from a sample DTE in
http://www.sii.cl/factura_electronica/factura_mercado/manual_certificacion.pdf
Extract PEM-encoded data of the X.509 certificate inside XML document
'test_data/sii-dte/DTE--76354771-K--33--170.xml'
> [..] a package which provides cryptographic recipes and primitives
> to Python developers. Our goal is for it to be your "cryptographic
> standard library".

https://cryptography.io
https://github.com/pyca/cryptography
glarrain added 19 commits April 25, 2019 13:37
(not the latest version because of a compatibility issue with
package 'signxml' v2.6.0)

> A Python wrapper around the OpenSSL library.

https://pyopenssl.org
https://github.com/pyca/pyopenssl
> XML Signature in Python.
> SignXML is an implementation of the W3C XML Signature standard
> in Python. This standard (also known as XMLDSig and RFC 3275) is
> used to provide payload security in SAML 2.0 and WS-Security,
> among other uses.

https://signxml.readthedocs.io
https://github.com/XML-Security/signxml
requirements: add and update packages
…-tree

libs.xml_utils: fix class alias `XmlElementTree`
The file is the output of command:
    ./scripts/clean_dte_xml_file.py file \
        'tests/test_data/sii-dte/DTE--76399752-9--33--25568.xml' \
        'tests/test_data/sii-dte/DTE--76399752-9--33--25568--cleaned.xml'
Extract PEM-encoded data of the X.509 certificate inside XML document
'test_data/sii-dte/DTE--76399752-9--33--25568.xml'
Extract XML signature value (base64-encoded binary data) from these
XML documents:
- 'test_data/sii-dte/DTE--76354771-K--33--170.xml'
- 'test_data/sii-dte/DTE--76399752-9--33--25568.xml'
Among others, it includes functions:
- `load_pem_x509_cert`
- `add_pem_cert_header_footer`
- `remove_pem_cert_header_footer`

Some tests have not been implemented yet.
Modify 2 fields added to `DteDataL2` in 89196d3 (PR #21).
That introduces some changes to function `parse_dte_xml`.

Also includes a major reorganization of tests for module `parse`,
improving separate coverage.
…elds

dte.data_models: modify new fields of `DteDataL2`
@glarrain glarrain self-assigned this Apr 25, 2019
@glarrain glarrain merged commit bf07bec into master Apr 25, 2019
@glarrain glarrain added the kind: release Release label May 8, 2019
@glarrain glarrain changed the title Release Release v0.5.0 May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants