Compare commits
@@ -34,7 +34,6 @@ mydatabase.db
|
||||
# ── Logs de ejecución ──
|
||||
*.log
|
||||
*.err
|
||||
PROYECTO/bin/*.TXT
|
||||
|
||||
# ── Spool de reportes (salida temporal de impresión) ──
|
||||
PROYECTO/spool/
|
||||
@@ -53,17 +52,11 @@ desktop.ini
|
||||
# -- Paquetes GAR: se generan en el build (gsmake -t mbs mbsERP.4pw), no van al repo --
|
||||
*.gar
|
||||
|
||||
# -- bin/IMAGENES: solo las imagenes que usan los programas/reportes --
|
||||
# (lo demas son fotos, temporales y archivos subidos en ejecucion, p.ej. comprobantes)
|
||||
PROYECTO/bin/IMAGENES/**
|
||||
!PROYECTO/bin/IMAGENES/Logo.png
|
||||
!PROYECTO/bin/IMAGENES/Logo_DCM.png
|
||||
!PROYECTO/bin/IMAGENES/genero_logo.png
|
||||
!PROYECTO/bin/IMAGENES/LOGO.JPG
|
||||
!PROYECTO/bin/IMAGENES/logo1.png
|
||||
!PROYECTO/bin/IMAGENES/EMPLEADOS/
|
||||
PROYECTO/bin/IMAGENES/EMPLEADOS/*
|
||||
!PROYECTO/bin/IMAGENES/EMPLEADOS/.gitkeep
|
||||
# -- PROYECTO/bin: no se versiona (compilados, imagenes, ejecutables, datos de ejecucion) --
|
||||
# salvo los disenos de reporte .4rp, que son fuentes registradas en mbsERP.4pw.
|
||||
PROYECTO/bin/**
|
||||
!PROYECTO/bin/**/
|
||||
!PROYECTO/bin/**/*.4rp
|
||||
|
||||
# -- Llaves y certificados: NUNCA en el repo (se entregan aparte a quien los necesite) --
|
||||
*.jks
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<ManagedForm fileVersion="31400" gstVersion="3140a" name="ManagedForm" uid="{8f013df5-71e9-4123-ace5-57cb0d559141}">
|
||||
<AGSettings>
|
||||
<DynamicProperties version="2"/>
|
||||
</AGSettings>
|
||||
<Record name="scr_costos" uid="{1072830e-e04e-4a63-8f41-4aa8efa5ffaa}">
|
||||
<RecordField colName="tipo" fieldIdRef="11" name="tipo" sqlTabName="formonly" uid="{d9350682-2ead-47c0-8563-a7d127b1ec5d}"/>
|
||||
<RecordField fieldIdRef="5" name="codigo" uid="{7225c2f2-2ca5-4952-9439-39d6105683b2}"/>
|
||||
<RecordField colName="emp_no" fieldIdRef="8" name="emp_no" sqlTabName="formonly" sqlType="DECIMAL" uid="{ada70def-e69a-4c50-bd69-1fb91fd596cf}"/>
|
||||
<RecordField colName="h_directa" fieldIdRef="12" name="h_directa" sqlTabName="formonly" uid="{f0d26a13-bbd5-4de4-a3ad-9e26feb8ccb0}"/>
|
||||
<RecordField colName="h_indirecta" fieldIdRef="13" name="h_indirecta" sqlTabName="formonly" uid="{d3a40df7-5349-4812-82bc-a96aa2c4027b}"/>
|
||||
<RecordField colName="e_directa" fieldIdRef="14" name="e_directa" sqlTabName="formonly" uid="{d24a8ff5-f9b6-4fbb-a667-451a948c3f7b}"/>
|
||||
<RecordField colName="e_indirecta" fieldIdRef="15" name="e_indirecta" sqlTabName="formonly" uid="{9a0f1103-7db4-43c3-8147-f715eab9a3c1}"/>
|
||||
<RecordField colName="cod_prod" fieldIdRef="9" name="cod_prod" sqlTabName="formonly" uid="{e1b64282-cd3b-4615-bcb8-fde9313110e2}"/>
|
||||
<RecordField fieldIdRef="20" name="lado1" uid="{10db271d-bbce-4ae7-9e10-144888550c81}"/>
|
||||
<RecordField fieldIdRef="21" name="lado2" uid="{f134fcc5-822c-4f75-8b71-70263f00284c}"/>
|
||||
<RecordField fieldIdRef="22" name="lado3" uid="{98f897e4-b702-4356-bf11-25e1b93bb2ab}"/>
|
||||
<RecordField colName="cantidad" fieldIdRef="17" name="cantidad" sqlTabName="formonly" uid="{166ac25b-ad15-45f8-8b8e-7862ac3bccfe}"/>
|
||||
<RecordField fieldIdRef="23" name="medida1" uid="{c1b4ea3b-4927-423f-8dfd-a3dc80f64090}"/>
|
||||
<RecordField colName="codigo_bloque" fieldIdRef="2" name="codigo_bloque" sqlTabName="formonly" uid="{d03b323d-b9bb-4eea-9514-c14bcccd7a56}"/>
|
||||
<RecordField colName="turno" fieldIdRef="0" name="turno" sqlTabName="formonly" uid="{cea5543d-5e89-46ba-a306-d6d732238f3a}"/>
|
||||
<RecordField fieldIdRef="24" name="depto_receptor" uid="{33d0c1ec-7dc1-4ec0-b489-b23701305b3c}"/>
|
||||
<RecordField fieldIdRef="28" name="ref" uid="{e955cc32-7b71-4cec-90cd-379631ca8437}"/>
|
||||
<RecordField fieldIdRef="50" name="num_oc" uid="{b2c3d4e5-0050-4a00-9050-0d0c0b0a0950}"/>
|
||||
</Record>
|
||||
<Record name="record1" uid="{af6b78f0-189c-4e68-8607-46f11a433423}">
|
||||
<RecordField colName="num_doc" fieldIdRef="4" name="num_doc" sqlTabName="formonly" uid="{2bec5bf1-0623-4163-9235-ba4b878a0590}"/>
|
||||
<RecordField colName="fecha" fieldIdRef="7" name="fecha" sqlTabName="formonly" sqlType="DATE" uid="{77a2edd0-719f-44f1-83dc-e532b159653f}"/>
|
||||
<RecordField colName="factor" fieldIdRef="6" name="factor" sqlTabName="formonly" uid="{6dee7883-621c-45f7-8519-0cf206a8f484}"/>
|
||||
<RecordField colName="departamento" fieldIdRef="3" name="departamento" sqlTabName="formonly" uid="{b4139611-41fc-494f-9bba-b6dee92f1e87}"/>
|
||||
<RecordField colName="descripcion" fieldIdRef="18" name="descripcion" sqlTabName="formonly" uid="{f5f4d146-6d13-4504-b957-e3f116446c65}"/>
|
||||
<RecordField colName="medida" fieldIdRef="16" name="medida" sqlTabName="formonly" uid="{f4fcca96-d1c9-43fa-a343-4b1ed7441d3a}"/>
|
||||
<RecordField colName="nombre" fieldIdRef="19" name="nombre" sqlTabName="formonly" uid="{0b987b65-36cf-4e02-91a5-46831177aa0a}"/>
|
||||
<RecordField fieldIdRef="27" name="cod_mov" uid="{611b980b-7ec3-480b-82f2-c4509213bf31}"/>
|
||||
</Record>
|
||||
<Record name="s_docs" uid="{a1b2c3d4-0001-4a00-9001-0d0c0b0a0901}">
|
||||
<RecordField fieldIdRef="40" name="d_num_doc" uid="{a1b2c3d4-0002-4a00-9002-0d0c0b0a0902}"/>
|
||||
<RecordField fieldIdRef="41" name="d_fecha" uid="{a1b2c3d4-0003-4a00-9003-0d0c0b0a0903}"/>
|
||||
<RecordField fieldIdRef="42" name="d_departamento" uid="{a1b2c3d4-0004-4a00-9004-0d0c0b0a0904}"/>
|
||||
<RecordField fieldIdRef="43" name="d_movimiento" uid="{a1b2c3d4-0005-4a00-9005-0d0c0b0a0905}"/>
|
||||
<RecordField fieldIdRef="44" name="d_estado" uid="{a1b2c3d4-0006-4a00-9006-0d0c0b0a0906}"/>
|
||||
<RecordField fieldIdRef="45" name="d_bloques" uid="{a1b2c3d4-0007-4a00-9007-0d0c0b0a0907}"/>
|
||||
</Record>
|
||||
<Form gridHeight="20" gridWidth="258" name="prfmmt003" style="basic" text="CREACION DOCUMENTO PRODUCCION">
|
||||
<ToolBar name="toolbar1">
|
||||
<ToolBarItem comment="Nuevo Documento" image="new" name="nuevo" text="Produccion"/>
|
||||
<ToolBarItem comment="Criterio de busqueda" image="find" name="buscar" text="Buscar Documento"/>
|
||||
<ToolBarItem comment="Anula Registro en Screen" image="cancel" name="anular" text="Anular Registros"/>
|
||||
<ToolBarItem comment="Lista de documentos (mas recientes primero)" image="detail" name="documentos" text="Documentos"/>
|
||||
<ToolBarItem comment="Recorrido/trazabilidad del bloque" image="fa-sitemap" name="traza" text="Trazabilidad"/>
|
||||
<ToolBarSeparator name="toolbarseparator1"/>
|
||||
<ToolBarItem image="quit" name="salir" text="Salir"/>
|
||||
</ToolBar>
|
||||
<Folder gridHeight="20" gridWidth="258" name="folder1" posX="0" posY="0">
|
||||
<Page action="documentos" name="pg_docs" text="Documentos">
|
||||
<Grid gridHeight="18" gridWidth="257" name="grid_docs" posX="0" posY="0">
|
||||
<Table gridHeight="17" gridWidth="255" name="table_docs" posX="1" posY="0" totalRows="16" unitWidth="characters" width="150">
|
||||
<Edit fieldId="40" gridHeight="1" gridWidth="12" name="d_num_doc" noEntry="true" posX="0" posY="0" scroll="true" tabIndex="-1" title="NUM. DOC" widget="Edit"/>
|
||||
<Edit fieldId="41" gridHeight="1" gridWidth="14" name="d_fecha" noEntry="true" posX="12" posY="0" scroll="true" tabIndex="-1" title="FECHA" widget="Edit"/>
|
||||
<Edit fieldId="42" gridHeight="1" gridWidth="42" name="d_departamento" noEntry="true" posX="26" posY="0" scroll="true" tabIndex="-1" title="DEPARTAMENTO" widget="Edit"/>
|
||||
<Edit fieldId="43" gridHeight="1" gridWidth="36" name="d_movimiento" noEntry="true" posX="68" posY="0" scroll="true" tabIndex="-1" title="MOVIMIENTO" widget="Edit"/>
|
||||
<Edit fieldId="44" gridHeight="1" gridWidth="12" name="d_estado" noEntry="true" posX="104" posY="0" scroll="true" tabIndex="-1" title="ESTADO" widget="Edit"/>
|
||||
<Edit fieldId="45" gridHeight="1" gridWidth="34" name="d_bloques" noEntry="true" posX="116" posY="0" scroll="true" tabIndex="-1" title="BLOQUES" widget="Edit"/>
|
||||
</Table>
|
||||
</Grid>
|
||||
</Page>
|
||||
<Page name="pg_prod" text="Produccion">
|
||||
<Grid gridHeight="18" gridWidth="258" name="grid1" posX="0" posY="0">
|
||||
<Group gridHeight="6" gridWidth="62" name="group1" posX="1" posY="0" text="General">
|
||||
<Label gridHeight="1" gridWidth="10" name="label1" posX="3" posY="1" text="Secuencia"/>
|
||||
<Edit colName="num_doc" fieldId="4" gridHeight="1" gridWidth="5" name="num_doc" noEntry="false" posX="14" posY="1" sqlTabName="formonly" tabIndex="1" widget="Edit"/>
|
||||
<Label gridHeight="1" gridWidth="6" name="label2" posX="21" posY="1" text="Fecha"/>
|
||||
<DateEdit colName="fecha" fieldId="7" format="DD/MM/YYYY" gridHeight="1" gridWidth="9" name="fecha" posX="28" posY="1" required="true" sqlTabName="formonly" sqlType="DATE" tabIndex="2" widget="DateEdit"/>
|
||||
<Label gridHeight="1" gridWidth="6" name="label3" posX="3" posY="2" text="Factor"/>
|
||||
<Edit colName="factor" comment="Digite factor que desa calcular las horas normales" fieldId="6" gridHeight="1" gridWidth="5" name="factor" posX="14" posY="2" sqlTabName="formonly" tabIndex="3" widget="Edit"/>
|
||||
<Label gridHeight="1" gridWidth="8" name="label4" posX="3" posY="3" text="Departa."/>
|
||||
<ComboBox colName="departamento" fieldId="3" gridHeight="1" gridWidth="32" items="" name="departamento" posX="14" posY="3" required="true" sqlTabName="formonly" tabIndex="4" widget="ComboBox"/>
|
||||
<Label gridHeight="1" gridWidth="10" name="label6" posX="3" posY="4" text="Cod. Movimiento"/>
|
||||
<ComboBox fieldId="27" gridHeight="1" gridWidth="35" items="" name="cod_mov" posX="14" posY="4" tabIndex="-1" title="combobox1" widget="ComboBox"/>
|
||||
</Group>
|
||||
<Group gridHeight="8" gridWidth="257" name="group2" posX="1" posY="6" text="Detalle">
|
||||
<Table gridHeight="6" gridWidth="254" name="table1" posX="2" posY="1" totalRows="5" unitWidth="characters" width="76">
|
||||
<ComboBox colName="tipo" comment="Digite Codigo de la Maquina" fieldId="11" gridHeight="1" gridWidth="30" items="" name="tipo" posX="0" posY="0" scroll="true" sqlTabName="formonly" tabIndex="5" title="OPERACION" widget="ComboBox"/>
|
||||
<ComboBox fieldId="5" gridHeight="1" gridWidth="48" items="" name="codigo" posX="30" posY="0" scroll="true" tabIndex="-1" title="Equipo" unhidable="true" unmovable="true" unsortable="true" widget="ComboBox"/>
|
||||
<ButtonEdit action="empleado" autoNext="true" colName="emp_no" fieldId="8" gridHeight="1" gridWidth="10" name="emp_no" posX="78" posY="0" sqlTabName="formonly" sqlType="DECIMAL" tabIndex="6" title="EMPLEADO" widget="ButtonEdit"/>
|
||||
<Edit autoNext="true" colName="h_directa" fieldId="12" gridHeight="1" gridWidth="6" name="h_directa" posX="88" posY="0" sqlTabName="formonly" tabIndex="7" title="N.DIRECTA" widget="Edit"/>
|
||||
<Edit autoNext="true" colName="h_indirecta" fieldId="13" gridHeight="1" gridWidth="6" name="h_indirecta" posX="94" posY="0" sqlTabName="formonly" tabIndex="8" title="N.IND." widget="Edit"/>
|
||||
<Edit autoNext="true" colName="e_directa" fieldId="14" gridHeight="1" gridWidth="6" name="e_directa" posX="100" posY="0" sqlTabName="formonly" tabIndex="9" title="E. DIRECTAS" widget="Edit"/>
|
||||
<Edit autoNext="true" colName="e_indirecta" fieldId="15" gridHeight="1" gridWidth="5" name="e_indirecta" posX="106" posY="0" sqlTabName="formonly" tabIndex="10" title="E.INDIRECTAS" widget="Edit"/>
|
||||
<ButtonEdit action="semielaborado" colName="cod_prod" fieldId="9" gridHeight="1" gridWidth="10" name="cod_prod" posX="111" posY="0" sqlTabName="formonly" tabIndex="11" title="SEMI-ELABORADO" widget="ButtonEdit"/>
|
||||
<Edit fieldId="20" gridHeight="1" gridWidth="8" name="lado1" posX="121" posY="0" tabIndex="-1" title="Ancho" widget="Edit"/>
|
||||
<Edit fieldId="21" gridHeight="1" gridWidth="8" name="lado2" posX="129" posY="0" tabIndex="-1" title="Largo" widget="Edit"/>
|
||||
<Edit fieldId="22" gridHeight="1" gridWidth="8" name="lado3" posX="137" posY="0" tabIndex="-1" title="Espesor" widget="Edit"/>
|
||||
<Edit colName="cantidad" comment="Digite Cantidad Producida" fieldId="17" gridHeight="1" gridWidth="12" name="cantidad" posX="145" posY="0" sqlTabName="formonly" tabIndex="12" title="CANTIDAD" widget="Edit"/>
|
||||
<Edit fieldId="23" gridHeight="1" gridWidth="8" name="medida1" noEntry="true" posX="157" posY="0" tabIndex="-1" title="Medida" widget="Edit"/>
|
||||
<Edit case="upper" colName="codigo_bloque" fieldId="2" gridHeight="1" gridWidth="20" name="codigo_bloque" posX="165" posY="0" scroll="true" sqlTabName="formonly" tabIndex="13" title="BLOQUE" widget="Edit"/>
|
||||
<ComboBox colName="turno" fieldId="0" gridHeight="1" gridWidth="20" items="" name="turno" posX="185" posY="0" sqlTabName="formonly" tabIndex="14" title="TURNO" widget="ComboBox"/>
|
||||
<ComboBox fieldId="24" gridHeight="1" gridWidth="13" items="" name="depto_receptor" notNull="false" posX="205" posY="0" required="false" tabIndex="-1" title="DEPTO. RECEPTOR" widget="ComboBox"/>
|
||||
<ButtonEdit action="ordenped" fieldId="50" gridHeight="1" gridWidth="12" name="num_oc" posX="218" posY="0" scroll="true" tabIndex="18" title="ORDEN PED." widget="ButtonEdit"/>
|
||||
<Phantom fieldId="28" name="ref" widget="Phantom"/>
|
||||
</Table>
|
||||
</Group>
|
||||
<Group gridHeight="4" gridWidth="56" name="group3" posX="1" posY="14" text="INFORMACION">
|
||||
<Label gridHeight="1" gridWidth="7" name="label5" posX="1" posY="1" text="Produce"/>
|
||||
<Edit colName="descripcion" fieldId="18" gridHeight="1" gridWidth="31" name="descripcion" noEntry="true" posX="12" posY="1" sqlTabName="formonly" tabIndex="15" widget="Edit"/>
|
||||
<Edit colName="medida" fieldId="16" gridHeight="1" gridWidth="3" name="medida" noEntry="true" posX="44" posY="1" sqlTabName="formonly" tabIndex="16" widget="Edit"/>
|
||||
<Label gridHeight="1" gridWidth="8" name="label9" posX="1" posY="2" text="Empleado"/>
|
||||
<Edit colName="nombre" fieldId="19" gridHeight="1" gridWidth="31" name="nombre" noEntry="true" posX="12" posY="2" sqlTabName="formonly" tabIndex="17" widget="Edit"/>
|
||||
</Group>
|
||||
</Grid>
|
||||
</Page>
|
||||
</Folder>
|
||||
</Form>
|
||||
<DiagramLayout>
|
||||
<![CDATA[AAAAAgAAAEwAewAxADAANwAyADgAMwAwAGUALQBlADAANABlAC0ANABhADYAMwAtADgAZgA0ADEALQA0AGEAYQA4AGUAZgBhADUAZgBmAGEAYQB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAEwAewBhADEAYgAyAGMAMwBkADQALQAwADAAMAAxAC0ANABhADAAMAAtADkAMAAwADEALQAwAGQAMABjADAAYgAwAGEAMAA5ADAAMQB9QDAAAAQAAABAMAAABAAAAAAAAAAAAAAAAQAAAEwAewBhAGYANgBiADcAOABmADAALQAxADgAOQBjAC0ANABlADYAOAAtADgANgAwADcALQA0ADYAZgAxADEAYQA0ADMAMwA0ADIAMwB9QHMAAEhgAHpAPVVV1VVWYD9QYk3S8an8AQ==]]>
|
||||
</DiagramLayout>
|
||||
</ManagedForm>
|
||||
@@ -32,7 +32,8 @@ FUNCTION imprime (datos_c, arr_costos)
|
||||
codigo_bloque LIKE cttb00003.codigo_bloque,
|
||||
turno SMALLINT,
|
||||
depto_receptor SMALLINT,
|
||||
ref INT
|
||||
ref INT,
|
||||
num_oc INT
|
||||
END RECORD
|
||||
|
||||
DEFINE nombre, descripcion, movimiento, departamento, turno, maquina, depto_receptor STRING
|
||||
@@ -125,7 +126,8 @@ REPORT p_diaria(datos_c, arr_costos, nombre, descripcion, movimiento, departamen
|
||||
codigo_bloque LIKE cttb00003.codigo_bloque,
|
||||
turno SMALLINT,
|
||||
depto_receptor SMALLINT,
|
||||
ref INT
|
||||
ref INT,
|
||||
num_oc INT
|
||||
END RECORD
|
||||
|
||||
DEFINE nombre, descripcion, movimiento, departamento, descrip_turno,
|
||||
|
||||
@@ -114,8 +114,8 @@ FUNCTION prprmt003()
|
||||
|
||||
CLEAR SCREEN
|
||||
|
||||
OPEN FORM prfmmt003 FROM "prfmmt003"
|
||||
DISPLAY FORM prfmmt003
|
||||
OPEN FORM prfmmt003pr FROM "prfmmt003pr"
|
||||
DISPLAY FORM prfmmt003pr
|
||||
DISPLAY "Registro de Produccion Diaria" AT 4,25
|
||||
DISPLAY "prprmt003" AT 4,3
|
||||
# CALL pantalla1()
|
||||
|
||||
@@ -809,27 +809,27 @@ analisiscotizaciones^mes^0^10^3^
|
||||
analisiscotizaciones^cotizacion_no^258^4^4^
|
||||
analisiscotizaciones^num_oc^2^4^5^
|
||||
analisiscotizaciones^estado^201^50^6^
|
||||
analisiscotizaciones^unidadescotizadas^5^9733^7^
|
||||
analisiscotizaciones^valorcotizado^5^9740^8^
|
||||
analisiscotizaciones^unidadescotizadas^5^8197^7^
|
||||
analisiscotizaciones^valorcotizado^5^8204^8^
|
||||
analisiscotizaciones^sub_total^261^3074^9^
|
||||
analisiscotizaciones^unidadesdespachadas^261^9733^10^
|
||||
analisiscotizaciones^valordespachado^261^9738^11^
|
||||
analisiscotizaciones^unidadesdespachadas^261^8197^10^
|
||||
analisiscotizaciones^valordespachado^261^8202^11^
|
||||
analisiscotizaciones^equipoventas^201^100^12^
|
||||
analisiscotizaciones^tasa^5^3075^13^
|
||||
analisiscotizaciones^vendedor^201^31^14^
|
||||
analisiscotizaciones^emailsupervisor^201^100^15^
|
||||
analisiscotizaciones^depachosautorizados^5^9733^16^
|
||||
analisiscotizaciones^depachosautorizados^5^8197^16^
|
||||
analisiscotizaciones_cdelacruz^ano^1^2^1^
|
||||
analisiscotizaciones_cdelacruz^numeromes^1^2^2^
|
||||
analisiscotizaciones_cdelacruz^mes^0^10^3^
|
||||
analisiscotizaciones_cdelacruz^cotizacion_no^258^4^4^
|
||||
analisiscotizaciones_cdelacruz^num_oc^2^4^5^
|
||||
analisiscotizaciones_cdelacruz^estado^201^50^6^
|
||||
analisiscotizaciones_cdelacruz^unidadescotizadas^5^9733^7^
|
||||
analisiscotizaciones_cdelacruz^valorcotizado^5^9740^8^
|
||||
analisiscotizaciones_cdelacruz^unidadescotizadas^5^8197^7^
|
||||
analisiscotizaciones_cdelacruz^valorcotizado^5^8204^8^
|
||||
analisiscotizaciones_cdelacruz^sub_total^261^3074^9^
|
||||
analisiscotizaciones_cdelacruz^unidadesdespachadas^261^9733^10^
|
||||
analisiscotizaciones_cdelacruz^valordespachado^261^9738^11^
|
||||
analisiscotizaciones_cdelacruz^unidadesdespachadas^261^8197^10^
|
||||
analisiscotizaciones_cdelacruz^valordespachado^261^8202^11^
|
||||
analisiscotizaciones_cdelacruz^equipoventas^201^100^12^
|
||||
analisiscotizaciones_cdelacruz^tasa^5^3075^13^
|
||||
analisiscotizaciones_cdelacruz^vendedor^201^31^14^
|
||||
@@ -840,11 +840,11 @@ analisiscotizaciones_jefrancisco^mes^0^10^3^
|
||||
analisiscotizaciones_jefrancisco^cotizacion_no^258^4^4^
|
||||
analisiscotizaciones_jefrancisco^num_oc^2^4^5^
|
||||
analisiscotizaciones_jefrancisco^estado^201^50^6^
|
||||
analisiscotizaciones_jefrancisco^unidadescotizadas^5^9733^7^
|
||||
analisiscotizaciones_jefrancisco^valorcotizado^5^9740^8^
|
||||
analisiscotizaciones_jefrancisco^unidadescotizadas^5^8197^7^
|
||||
analisiscotizaciones_jefrancisco^valorcotizado^5^8204^8^
|
||||
analisiscotizaciones_jefrancisco^sub_total^261^3074^9^
|
||||
analisiscotizaciones_jefrancisco^unidadesdespachadas^261^9733^10^
|
||||
analisiscotizaciones_jefrancisco^valordespachado^261^9738^11^
|
||||
analisiscotizaciones_jefrancisco^unidadesdespachadas^261^8197^10^
|
||||
analisiscotizaciones_jefrancisco^valordespachado^261^8202^11^
|
||||
analisiscotizaciones_jefrancisco^equipoventas^201^100^12^
|
||||
analisiscotizaciones_jefrancisco^tasa^5^3075^13^
|
||||
analisiscotizaciones_jefrancisco^vendedor^201^31^14^
|
||||
@@ -855,11 +855,11 @@ analisiscotizaciones_jisa^mes^0^10^3^
|
||||
analisiscotizaciones_jisa^cotizacion_no^258^4^4^
|
||||
analisiscotizaciones_jisa^num_oc^2^4^5^
|
||||
analisiscotizaciones_jisa^estado^201^50^6^
|
||||
analisiscotizaciones_jisa^unidadescotizadas^5^9733^7^
|
||||
analisiscotizaciones_jisa^valorcotizado^5^9740^8^
|
||||
analisiscotizaciones_jisa^unidadescotizadas^5^8197^7^
|
||||
analisiscotizaciones_jisa^valorcotizado^5^8204^8^
|
||||
analisiscotizaciones_jisa^sub_total^261^3074^9^
|
||||
analisiscotizaciones_jisa^unidadesdespachadas^261^9733^10^
|
||||
analisiscotizaciones_jisa^valordespachado^261^9738^11^
|
||||
analisiscotizaciones_jisa^unidadesdespachadas^261^8197^10^
|
||||
analisiscotizaciones_jisa^valordespachado^261^8202^11^
|
||||
analisiscotizaciones_jisa^equipoventas^201^100^12^
|
||||
analisiscotizaciones_jisa^tasa^5^3075^13^
|
||||
analisiscotizaciones_jisa^vendedor^201^31^14^
|
||||
@@ -870,11 +870,11 @@ analisiscotizaciones_mhurtado^mes^0^10^3^
|
||||
analisiscotizaciones_mhurtado^cotizacion_no^258^4^4^
|
||||
analisiscotizaciones_mhurtado^num_oc^2^4^5^
|
||||
analisiscotizaciones_mhurtado^estado^201^50^6^
|
||||
analisiscotizaciones_mhurtado^unidadescotizadas^5^9733^7^
|
||||
analisiscotizaciones_mhurtado^valorcotizado^5^9740^8^
|
||||
analisiscotizaciones_mhurtado^unidadescotizadas^5^8197^7^
|
||||
analisiscotizaciones_mhurtado^valorcotizado^5^8204^8^
|
||||
analisiscotizaciones_mhurtado^sub_total^261^3074^9^
|
||||
analisiscotizaciones_mhurtado^unidadesdespachadas^261^9733^10^
|
||||
analisiscotizaciones_mhurtado^valordespachado^261^9738^11^
|
||||
analisiscotizaciones_mhurtado^unidadesdespachadas^261^8197^10^
|
||||
analisiscotizaciones_mhurtado^valordespachado^261^8202^11^
|
||||
analisiscotizaciones_mhurtado^equipoventas^201^100^12^
|
||||
analisiscotizaciones_mhurtado^tasa^5^3075^13^
|
||||
analisiscotizaciones_mhurtado^vendedor^201^31^14^
|
||||
@@ -885,11 +885,11 @@ analisiscotizaciones_mpuig^mes^0^10^3^
|
||||
analisiscotizaciones_mpuig^cotizacion_no^258^4^4^
|
||||
analisiscotizaciones_mpuig^num_oc^2^4^5^
|
||||
analisiscotizaciones_mpuig^estado^201^50^6^
|
||||
analisiscotizaciones_mpuig^unidadescotizadas^5^9733^7^
|
||||
analisiscotizaciones_mpuig^valorcotizado^5^9740^8^
|
||||
analisiscotizaciones_mpuig^unidadescotizadas^5^8197^7^
|
||||
analisiscotizaciones_mpuig^valorcotizado^5^8204^8^
|
||||
analisiscotizaciones_mpuig^sub_total^261^3074^9^
|
||||
analisiscotizaciones_mpuig^unidadesdespachadas^261^9733^10^
|
||||
analisiscotizaciones_mpuig^valordespachado^261^9738^11^
|
||||
analisiscotizaciones_mpuig^unidadesdespachadas^261^8197^10^
|
||||
analisiscotizaciones_mpuig^valordespachado^261^8202^11^
|
||||
analisiscotizaciones_mpuig^equipoventas^201^100^12^
|
||||
analisiscotizaciones_mpuig^tasa^5^3075^13^
|
||||
analisiscotizaciones_mpuig^vendedor^201^31^14^
|
||||
@@ -900,11 +900,11 @@ analisiscotizaciones_mvargas^mes^0^10^3^
|
||||
analisiscotizaciones_mvargas^cotizacion_no^258^4^4^
|
||||
analisiscotizaciones_mvargas^num_oc^2^4^5^
|
||||
analisiscotizaciones_mvargas^estado^201^50^6^
|
||||
analisiscotizaciones_mvargas^unidadescotizadas^5^9733^7^
|
||||
analisiscotizaciones_mvargas^valorcotizado^5^9740^8^
|
||||
analisiscotizaciones_mvargas^unidadescotizadas^5^8197^7^
|
||||
analisiscotizaciones_mvargas^valorcotizado^5^8204^8^
|
||||
analisiscotizaciones_mvargas^sub_total^261^3074^9^
|
||||
analisiscotizaciones_mvargas^unidadesdespachadas^261^9733^10^
|
||||
analisiscotizaciones_mvargas^valordespachado^261^9738^11^
|
||||
analisiscotizaciones_mvargas^unidadesdespachadas^261^8197^10^
|
||||
analisiscotizaciones_mvargas^valordespachado^261^8202^11^
|
||||
analisiscotizaciones_mvargas^equipoventas^201^100^12^
|
||||
analisiscotizaciones_mvargas^tasa^5^3075^13^
|
||||
analisiscotizaciones_mvargas^vendedor^201^31^14^
|
||||
@@ -5458,9 +5458,9 @@ product_collection^descripcion^201^255^2^
|
||||
productosdelta^codigomarmotech^201^45^1^
|
||||
productosdelta^descrip_esp^457^180^2^
|
||||
productosdelta^nomenclatura^201^50^3^
|
||||
productosdelta^cantidadvendida^261^9733^4^
|
||||
productosdelta^cantidadvendida^261^8197^4^
|
||||
productosdelta^ultimaentrada^7^4^5^
|
||||
productosdelta^existencia^5^9733^6^
|
||||
productosdelta^existencia^5^8197^6^
|
||||
productosprecioscostosstdcostolq^ano^1^2^1^
|
||||
productosprecioscostosstdcostolq^clase^258^4^2^
|
||||
productosprecioscostosstdcostolq^grupo^258^4^3^
|
||||
@@ -5476,7 +5476,7 @@ productosprecioscostosstdcostolq^material^5^3076^12^
|
||||
productosprecioscostosstdcostolq^labor^5^3076^13^
|
||||
productosprecioscostosstdcostolq^gastos^5^3076^14^
|
||||
productosprecioscostosstdcostolq^fecha_lq^7^4^15^
|
||||
productosprecioscostosstdcostolq^costoliquidacion^5^9734^16^
|
||||
productosprecioscostosstdcostolq^costoliquidacion^5^8198^16^
|
||||
productosprecioscostosstdcostolq^numero_mes^1^2^17^
|
||||
productosprecioscostosstdcostolq^ventas^0^1^18^
|
||||
productosprecioscostosstdcostolq^proveedor^201^41^19^
|
||||
@@ -6117,10 +6117,10 @@ rotacioniventario^codclase^2^4^10^
|
||||
rotacioniventario^codgrupo^2^4^11^
|
||||
rotacioniventario^codtipo^2^4^12^
|
||||
rotacioniventario^codmedida^2^4^13^
|
||||
rotacioniventario^costoventas^5^9737^14^
|
||||
rotacioniventario^existencia^5^9734^15^
|
||||
rotacioniventario^costoinventario^5^9737^16^
|
||||
rotacioniventario^cantidadvendida^5^9734^17^
|
||||
rotacioniventario^costoventas^5^8201^14^
|
||||
rotacioniventario^existencia^5^8198^15^
|
||||
rotacioniventario^costoinventario^5^8201^16^
|
||||
rotacioniventario^cantidadvendida^5^8198^17^
|
||||
rotacioniventario^categoria^201^100^18^
|
||||
seg0000^id_number^1^2^1^
|
||||
seg0000^usuario^256^40^2^
|
||||
@@ -8654,8 +8654,8 @@ ventas_clientes^ciudad^0^30^5^
|
||||
ventas_clientes^cliente^256^100^6^
|
||||
ventas_clientes^tipo_cliente^257^2^7^
|
||||
ventas_clientes^sec_cliente^258^4^8^
|
||||
ventas_clientes^venta^5^9730^9^
|
||||
ventas_clientes^costo^5^9737^10^
|
||||
ventas_clientes^venta^5^8194^9^
|
||||
ventas_clientes^costo^5^8201^10^
|
||||
ventas_clientes^nombre_provincia^0^30^11^
|
||||
ventas_clientes^descrip^0^30^12^
|
||||
ventas_clientes^calle^0^100^13^
|
||||
@@ -8671,9 +8671,9 @@ ventas_facturas^fecha^7^4^8^
|
||||
ventas_facturas^documento^258^4^9^
|
||||
ventas_facturas^moneda^201^40^10^
|
||||
ventas_facturas^ano^1^2^11^
|
||||
ventas_facturas^monto_bruto^5^9736^12^
|
||||
ventas_facturas^descuento^5^9734^13^
|
||||
ventas_facturas^neto^5^9734^14^
|
||||
ventas_facturas^monto_bruto^5^8200^12^
|
||||
ventas_facturas^descuento^5^8198^13^
|
||||
ventas_facturas^neto^5^8198^14^
|
||||
ventas_facturas^clase^0^30^15^
|
||||
ventas_facturas^tipo^201^30^16^
|
||||
ventas_facturas^grupo^0^30^17^
|
||||
@@ -9844,8 +9844,8 @@ vwcobros^ficha^257^2^1^
|
||||
vwcobros^primernombre^0^15^2^
|
||||
vwcobros^primerapellido^0^15^3^
|
||||
vwcobros^tipocobro^201^40^4^
|
||||
vwcobros^valor^5^9730^5^
|
||||
vwcobros^valorrd^5^9732^6^
|
||||
vwcobros^valor^5^8194^5^
|
||||
vwcobros^valorrd^5^8196^6^
|
||||
vwcobros^ano^1^2^7^
|
||||
vwcobros^numero_mes^1^2^8^
|
||||
vwcobros^nombremes^0^10^9^
|
||||
@@ -9900,7 +9900,7 @@ vwcodigosnuevos^cod_n^257^2^16^
|
||||
vwcodigosnuevos^cod_grupo^257^2^17^
|
||||
vwcodigosnuevos^cod_tipo^257^2^18^
|
||||
vwcodigosnuevos^cod_sec^257^2^19^
|
||||
vwcodigosnuevos^existencia^5^9733^20^
|
||||
vwcodigosnuevos^existencia^5^8197^20^
|
||||
vwcomisiones^tipoventas^0^30^1^
|
||||
vwcomisiones^tipo_cliente^1^2^2^
|
||||
vwcomisiones^sec_cliente^2^4^3^
|
||||
@@ -9956,8 +9956,8 @@ vwcompras^documetorecepcion^2^4^19^
|
||||
vwcompras^fecharecepcion^10^4365^20^
|
||||
vwcompras^departamento^0^30^21^
|
||||
vwcompras^grupo^201^30^22^
|
||||
vwcompras^existencia^261^9733^23^
|
||||
vwcompras^consumo^261^9733^24^
|
||||
vwcompras^existencia^261^8197^23^
|
||||
vwcompras^consumo^261^8197^24^
|
||||
vwcompras^costoliquidacion^5^3076^25^
|
||||
vwcompras^descripcionmoneda^0^30^26^
|
||||
vwcompras^simbolomoneda^0^4^27^
|
||||
@@ -10295,7 +10295,7 @@ vwipprodtermusuario^cantidad2^261^3077^18^
|
||||
vwipprodtermusuario^producto^0^30^19^
|
||||
vwipprodtermusuario^bodega^201^30^20^
|
||||
vwipprodtermusuario^costo_std^5^4614^21^
|
||||
vwipprodtermusuario^cantidadorden^261^9733^22^
|
||||
vwipprodtermusuario^cantidadorden^261^8197^22^
|
||||
vwiptiposmov^codigo^257^2^1^
|
||||
vwiptiposmov^descripcion^256^40^2^
|
||||
vwiptiposmov^origen^201^8^3^
|
||||
@@ -10343,7 +10343,7 @@ vwmatprima^mes^0^10^20^
|
||||
vwmatprima^depto_a^1^2^21^
|
||||
vwmatprima^nom_dpto^0^30^22^
|
||||
vwmatprima^origen^457^8^23^
|
||||
vwmatprima^existencia^5^9730^24^
|
||||
vwmatprima^existencia^5^8194^24^
|
||||
vwmatprima_scosto^cod_n^257^2^1^
|
||||
vwmatprima_scosto^cod_grupo^257^2^2^
|
||||
vwmatprima_scosto^cod_tipo^257^2^3^
|
||||
@@ -10365,7 +10365,7 @@ vwmatprima_scosto^mes^0^10^18^
|
||||
vwmatprima_scosto^depto_a^1^2^19^
|
||||
vwmatprima_scosto^nom_dpto^0^30^20^
|
||||
vwmatprima_scosto^origen^457^8^21^
|
||||
vwmatprima_scosto^existencia^5^9730^22^
|
||||
vwmatprima_scosto^existencia^5^8194^22^
|
||||
vwmatprimausuario^cod_n^257^2^1^
|
||||
vwmatprimausuario^cod_grupo^257^2^2^
|
||||
vwmatprimausuario^cod_tipo^257^2^3^
|
||||
@@ -10389,7 +10389,7 @@ vwmatprimausuario^mes^0^10^20^
|
||||
vwmatprimausuario^depto_a^1^2^21^
|
||||
vwmatprimausuario^nom_dpto^0^30^22^
|
||||
vwmatprimausuario^origen^457^8^23^
|
||||
vwmatprimausuario^existencia^5^9730^24^
|
||||
vwmatprimausuario^existencia^5^8194^24^
|
||||
vwordenescocinas^cod_n^1^2^1^
|
||||
vwordenescocinas^num_oc^258^4^2^
|
||||
vwordenescocinas^fecha_oc^263^4^3^
|
||||
@@ -10429,12 +10429,12 @@ vwordenesdespachadasc^producto^457^180^10^
|
||||
vwordenesdespachadasc^cantidad^5^3077^11^
|
||||
vwordenesdespachadasc^porc_desc^5^3586^12^
|
||||
vwordenesdespachadasc^precio^5^3074^13^
|
||||
vwordenesdespachadasc^valorbruto^5^9738^14^
|
||||
vwordenesdespachadasc^descuento^5^9734^15^
|
||||
vwordenesdespachadasc^valorneto^5^9734^16^
|
||||
vwordenesdespachadasc^valorbruto^5^8202^14^
|
||||
vwordenesdespachadasc^descuento^5^8198^15^
|
||||
vwordenesdespachadasc^valorneto^5^8198^16^
|
||||
vwordenesdespachadasc^porc_comision^5^3076^17^
|
||||
vwordenesdespachadasc^ano^1^2^18^
|
||||
vwordenesdespachadasc^comision^5^9734^19^
|
||||
vwordenesdespachadasc^comision^5^8198^19^
|
||||
vwprecios^descripcion^201^40^1^
|
||||
vwprecios^cod_n^257^2^2^
|
||||
vwprecios^cod_grupo^257^2^3^
|
||||
@@ -10480,9 +10480,9 @@ vwprodterm_scosto^departamento^2^4^33^
|
||||
vwprodterm_scosto^num_oc^2^4^34^
|
||||
vwprodterm_scosto^precio^5^2562^35^
|
||||
vwprodterm_scosto^descuento^5^2562^36^
|
||||
vwprodterm_scosto^valorbrutord^5^9226^37^
|
||||
vwprodterm_scosto^expr1^5^9734^38^
|
||||
vwprodterm_scosto^netord^5^9734^39^
|
||||
vwprodterm_scosto^valorbrutord^5^8202^37^
|
||||
vwprodterm_scosto^expr1^5^8198^38^
|
||||
vwprodterm_scosto^netord^5^8198^39^
|
||||
vwprodterm_scosto^tasa^5^3075^40^
|
||||
vwproduccion^ano^1^2^1^
|
||||
vwproduccion^dia^0^20^2^
|
||||
@@ -10570,11 +10570,11 @@ vwproducciont^cod_tipo^2^4^13^
|
||||
vwproducciont^cod_sec^2^4^14^
|
||||
vwproducciont^descripcionp^457^180^15^
|
||||
vwproducciont^unidadmed^0^4^16^
|
||||
vwproducciont^unidades^5^9733^17^
|
||||
vwproducciont^cantidad^5^9733^18^
|
||||
vwproducciont^unidades^5^8197^17^
|
||||
vwproducciont^cantidad^5^8197^18^
|
||||
vwproducciont^ano^1^2^19^
|
||||
vwproducciont^mes^201^14^20^
|
||||
vwproducciont^metrosadicionales^5^9738^21^
|
||||
vwproducciont^metrosadicionales^5^8202^21^
|
||||
vwproducciont^bodega^1^2^22^
|
||||
vwproductos^descrip_esp^256^80^1^
|
||||
vwproductos^cod_sec^257^2^2^
|
||||
@@ -10589,7 +10589,7 @@ vwproductos^tipo^201^30^10^
|
||||
vwproductos^grupo^0^30^11^
|
||||
vwproductos^origen^0^20^12^
|
||||
vwproductos^expr1^0^30^13^
|
||||
vwproductosprecioscostos^existencia^5^9733^1^
|
||||
vwproductosprecioscostos^existencia^5^8197^1^
|
||||
vwproductosprecioscostos^almacen^201^30^2^
|
||||
vwproductosprecioscostos^descripcionproducto^457^180^3^
|
||||
vwproductosprecioscostos^unidadmedida^0^4^4^
|
||||
@@ -10679,23 +10679,23 @@ vwptventasgral^pventas^1^2^48^
|
||||
vwptventasgral^grupo^0^100^49^
|
||||
vwreportesfactura_cdelacruz^mes^0^10^1^
|
||||
vwreportesfactura_cdelacruz^moneda^201^40^2^
|
||||
vwreportesfactura_cdelacruz^valor_bruto^5^9734^3^
|
||||
vwreportesfactura_cdelacruz^devolucion^5^9734^4^
|
||||
vwreportesfactura_cdelacruz^valor_neto^5^9734^5^
|
||||
vwreportesfactura_cdelacruz^valor_bruto^5^8198^3^
|
||||
vwreportesfactura_cdelacruz^devolucion^5^8198^4^
|
||||
vwreportesfactura_cdelacruz^valor_neto^5^8198^5^
|
||||
vwreportesfactura_cdelacruz^numero_mes^1^2^6^
|
||||
vwreportesfactura_cdelacruz^idventas^201^1^7^
|
||||
vwreportesfactura_jisa^mes^0^10^1^
|
||||
vwreportesfactura_jisa^moneda^201^40^2^
|
||||
vwreportesfactura_jisa^valor_bruto^5^9734^3^
|
||||
vwreportesfactura_jisa^devolucion^5^9734^4^
|
||||
vwreportesfactura_jisa^valor_neto^5^9734^5^
|
||||
vwreportesfactura_jisa^valor_bruto^5^8198^3^
|
||||
vwreportesfactura_jisa^devolucion^5^8198^4^
|
||||
vwreportesfactura_jisa^valor_neto^5^8198^5^
|
||||
vwreportesfactura_jisa^numero_mes^1^2^6^
|
||||
vwreportesfactura_jisa^idventas^201^1^7^
|
||||
vwreportesfactura_mpuig^mes^0^10^1^
|
||||
vwreportesfactura_mpuig^moneda^201^40^2^
|
||||
vwreportesfactura_mpuig^valor_bruto^5^9734^3^
|
||||
vwreportesfactura_mpuig^devolucion^5^9734^4^
|
||||
vwreportesfactura_mpuig^valor_neto^5^9734^5^
|
||||
vwreportesfactura_mpuig^valor_bruto^5^8198^3^
|
||||
vwreportesfactura_mpuig^devolucion^5^8198^4^
|
||||
vwreportesfactura_mpuig^valor_neto^5^8198^5^
|
||||
vwreportesfactura_mpuig^numero_mes^1^2^6^
|
||||
vwreportesfactura_mpuig^idventas^201^1^7^
|
||||
vwrepuestos^tipoinventario^457^10^1^
|
||||
@@ -10740,7 +10740,7 @@ vwrequisicionesautorizadas^numeroorden^258^4^7^
|
||||
vwrequisicionesautorizadas^tipoventa^201^40^8^
|
||||
vwrequisicionesautorizadas^cliente^201^110^9^
|
||||
vwrequisicionesautorizadas^valor_cotizacion^261^3074^10^
|
||||
vwrequisicionesautorizadas^valorrequisicion^5^9730^11^
|
||||
vwrequisicionesautorizadas^valorrequisicion^5^8194^11^
|
||||
vwrequisicionesautorizadas^codigovendedor^257^2^12^
|
||||
vwrequisicionesautorizadas^tipocliente^257^2^13^
|
||||
vwrequisicionesautorizadas^codigocliente^257^2^14^
|
||||
@@ -10766,7 +10766,7 @@ vwretrabajo^cod_sec^2^4^12^
|
||||
vwretrabajo^cliente^0^100^13^
|
||||
vwretrabajo^vendedor^457^31^14^
|
||||
vwretrabajo^cantidaddevuelta^5^3077^15^
|
||||
vwretrabajo^valorbruto^5^9738^16^
|
||||
vwretrabajo^valorbruto^5^8202^16^
|
||||
vwretrabajo^mes^0^10^17^
|
||||
vwretrabajo^numero_mes^1^2^18^
|
||||
vwretrabajo^numerodocumentoalmacen^2^4^19^
|
||||
@@ -10852,7 +10852,7 @@ vwvaloresordenes^ano^1^2^2^
|
||||
vwvaloresordenes^numeromes^1^2^3^
|
||||
vwvaloresordenes^mes^0^10^4^
|
||||
vwvaloresordenes^moneda^201^40^5^
|
||||
vwvaloresordenes^valor^5^9737^6^
|
||||
vwvaloresordenes^valor^5^8201^6^
|
||||
vwvaloresordenes^tasa^5^3075^7^
|
||||
vwventas^origen1^1^2^1^
|
||||
vwventas^descventas^201^40^2^
|
||||
@@ -10861,8 +10861,8 @@ vwventas^producto^0^30^4^
|
||||
vwventas^descripcion^201^30^5^
|
||||
vwventas^valorbruto^5^6407^6^
|
||||
vwventas^porc_itbis^261^2310^7^
|
||||
vwventas^descuento^261^9735^8^
|
||||
vwventas^subtotal^261^9734^9^
|
||||
vwventas^descuento^261^8199^8^
|
||||
vwventas^subtotal^261^8198^9^
|
||||
vwventas^factura^2^4^10^
|
||||
vwventas^cond_pago^1^2^11^
|
||||
vwventas^fecha_factura^7^4^12^
|
||||
|
||||
|
Before Width: | Height: | Size: 304 KiB |
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DeclaracionJurada xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<DetalleGeneral>Los CONTRIBUYENTES, RESPONSABLES Y TERCEROS MANDATARIOS aceptan y acuerdan estar legalmente obligados a cumplir con las condiciones establecidas por la legislacion o cualquier normativa vigente, asi como por la DIRECCION GENERAL DE IMPUESTOS INTERNOS (DGII), para la emision y uso de los Comprobantes Fiscales Electronicos (e-CF). Estas condiciones constituyen un contrato vinculante entre el CONTRIBUYENTE, RESPONSABLE Y TERCERO MANDATARIO, asi como tambien entre estos y la DGII. Si usted es RESPONSABLE O TERCERO MANDATARIO declara estar debidamente autorizado para representar al CONTRIBUYENTE, respecto del cual se verifica el hecho generador de la obligacion tributaria. Adicionalmente, acepta que los CONTRIBUYENTES, RESPONSABLES Y TERCEROS MANDATARIOS son responsables solidarios del uso de los e - CF y de las informaciones contenidas en los mismos, asi como de cualquier consecuencia legal o comercial derivada, directa o indirectamente de dicho uso. En ese orden, es deber de estos conocer y manejar el modelo de facturacion electronica definido por la DGII y las condiciones necesarias para que un e -CF sea valido. Asimismo, los CONTRIBUYENTES, RESPONSABLES Y TERCEROS MANDATARIOS estan obligados a utilizar un certificado de firma digital para poder emitir e-CF, los cuales deben estar debidamente acreditados por una entidad certificadora autorizada por el Instituto Dominicano de las Telecomunicaciones(INDOTEL) y la normativa vigente.</DetalleGeneral>
|
||||
</DeclaracionJurada>
|
||||
@@ -1,4 +0,0 @@
|
||||
Date: 12/11/2024 Time: 10:34:41
|
||||
Program error at 'cgprmt022.4gl', line number 18.
|
||||
SQL statement error number -6319 (-1).
|
||||
Internal error in the database library. Set FGLSQLDEBUG to get more details.
|
||||
@@ -1,66 +0,0 @@
|
||||
|
||||
|
||||
P MARMOTECH S. A.
|
||||
CALLE CENTRAL, MADRE VIEJA NORTE, SAN CRISTOBAL
|
||||
Tels : (809)528-0650 Fax : (809)-528-0640
|
||||
RNC : 101-52126-2 Pag. 1
|
||||
|
||||
PESENORES :
|
||||
NESTOR MONTERO COD.#21-0000066
|
||||
HAINA, 809-517-4745
|
||||
SAN CRISTOBAL RNC #09300230456 FACTURA 83746
|
||||
.
|
||||
NCF: A010010010100050864
|
||||
FACTURAS QUE GENERAN CREDITOS Y/O SUSTENTAN COSTOS Y GASTOS
|
||||
|
||||
=======================================================================================================================================
|
||||
SALIDA ORDEN FECHA CONDICION VENDEDOR COTIZACION FECHA FACTURA
|
||||
068130 109104 15/01/2018 CONTADO (4061) 117809 10/02/2018
|
||||
=======================================================================================================================================
|
||||
CODIGO CANTIDAD UNIDADES DESCRIPCION PRECIO DESC. TOTAL
|
||||
=======================================================================================================================================
|
||||
0006-0090-0001-0002 6.528 M2 7 PLANCHA CHAMPAGNE BROWN PULIDO 2 CM 1,454.080 .00 9,492.23
|
||||
|
||||
VALOR BRUTO 9,492.23
|
||||
SUB-TOTAL RD$ 9,492.23
|
||||
18.00% ITBIS 1,708.60
|
||||
--------------
|
||||
VALOR NETO RD$ 11,200.83
|
||||
==============
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
M
|
||||
OBSERVACIONES:
|
||||
|
||||
|
||||
|
||||
NOMBRE TRANSPORTISTA: CEDULA: 000000000 SERIE: 000
|
||||
PLACA DEL VEHICULO:
|
||||
|
||||
|
||||
|
||||
------------------------------- -------------------------------
|
||||
FACTURADO POR REVISADO POR
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<Form database_name="formonly" fourSTFile="" gstVersion="15a01" height="12" name="Form1" posX="0" posY="0" text="Configuration" width="59">
|
||||
<Grid fontPitch="default" height="11" hidden="--------" lstrcomment="false" name="gr2" posX="2" posY="0" width="54">
|
||||
<Label color="black" colorCondition="black" commentgroup="" flag_text_changed="TRUE" fontPitch="default" format="" geometry="" height="1" hidden="--------" justify="right" lstrcomment="false" lstrtext="false" miscellaneous="" name="lb1" posX="1" posY="0" sample="" sizePolicy="initial" style="" text="Reporte" width="9"/>
|
||||
<FormField colName="r_action" data_type="--------" fieldType="FORM_ONLY" name="" repeatDetails="" sqlTabName="formonly">
|
||||
<RadioGroup color="black" colorCondition="black" commentgroup="" constraints="" data_type="--------" defaultValue="preview" fontPitch="default" formfieldname="formfield2" geometry="" height="2" hidden="--------" items="" lstrcomment="false" miscellaneous="" name="r_action" noEntry="--------" notNull="--------" orientation="vertical" posX="16" posY="7" repeatDetails="" required="--------" sizePolicy="initial" sortItem="" style="" tabIndex="2" width="10">
|
||||
<Item lstrtext="" name="preview" text="Preview"/>
|
||||
<Item lstrtext="false" name="save" text="Save On Disk"/>
|
||||
</RadioGroup>
|
||||
</FormField>
|
||||
<Label color="black" colorCondition="black" commentgroup="" flag_text_changed="TRUE" fontPitch="default" format="" geometry="" height="1" hidden="--------" justify="right" lstrcomment="false" lstrtext="false" miscellaneous="" name="lb3" posX="1" posY="7" sample="" sizePolicy="initial" style="" text="Accion" width="9"/>
|
||||
<Label color="black" colorCondition="black" commentgroup="" flag_text_changed="TRUE" fontPitch="default" format="" geometry="" height="1" hidden="--------" justify="right" lstrcomment="false" lstrtext="false" miscellaneous="" name="lb2" posX="1" posY="2" sample="" sizePolicy="initial" style="" text="Salida Reporte" width="9"/>
|
||||
<FormField colName="r_output" data_type="--------" fieldType="FORM_ONLY" name="" repeatDetails="" sqlTabName="formonly">
|
||||
<RadioGroup color="black" colorCondition="black" commentgroup="" constraints="" data_type="--------" defaultValue="PDF" fontPitch="default" formfieldname="formfield1" geometry="" height="3" hidden="--------" items="" lstrcomment="false" miscellaneous="" name="r_output" noEntry="--------" notNull="--------" orientation="vertical" posX="16" posY="2" repeatDetails="" required="--------" sizePolicy="initial" style="" tabIndex="1" width="5">
|
||||
<Item lstrtext="false" name="Image" text="Image"/>
|
||||
<Item lstrtext="" name="PDF" text="PDF"/>
|
||||
<Item lstrtext="false" name="SCREEN" text="SVG"/>
|
||||
</RadioGroup>
|
||||
</FormField>
|
||||
<HLine geometry1="" height="1" name="hl2" posX="1" posY="1" repeatDetails="" width="50"/>
|
||||
<HLine geometry1="" height="1" name="hl2_1" posX="1" posY="5" repeat="true" repeatDetails="" width="50"/>
|
||||
<FormField colName="r_filename" data_type="--------" fieldType="FORM_ONLY" hrecindex="-1" name="" repeatDetails="" sqlTabName="formonly">
|
||||
<ComboBox case="NONE" color="black" colorCondition="black" commentgroup="" constraints="" data_type="--------" defaultValue="ListDemo" fontPitch="default" formfieldname="formfield0" geometry1="" height="1" hidden="--------" initializer="" items="" lstrcomment="false" miscellaneous="" name="r_filename" noEntry="--------" notNull="--------" posX="16" posY="0" queryEditable="--------" required="--------" sample="" scroll="--------" sizePolicy="fixed" sortItem="" style="" tabIndex="3" width="34">
|
||||
<Item lstrtext="false" name="veprrp049" text="Cotizacion"/>
|
||||
</ComboBox>
|
||||
</FormField>
|
||||
</Grid>
|
||||
</Form>
|
||||
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
@@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="ANSI_X3.4-1968"?>
|
||||
<StyleList>
|
||||
<Style name="Window">
|
||||
<StyleAttribute name="windowType" value="normal" />
|
||||
</Style>
|
||||
<Style name="Window.main">
|
||||
<StyleAttribute name="windowType" value="normal" />
|
||||
<StyleAttribute name="startMenuPosition" value="menu" />
|
||||
</Style>
|
||||
<Style name="Window.main-mbs">
|
||||
<StyleAttribute name="position" value="center" />
|
||||
<StyleAttribute name="windowType" value="normal" />
|
||||
<StyleAttribute name="actionPanelPosition" value="none" />
|
||||
<StyleAttribute name="ringMenuPosition" value="none" />
|
||||
<StyleAttribute name="statusBarType" value="none" />
|
||||
</Style>
|
||||
<Style name="Window.dialog">
|
||||
<StyleAttribute name="windowType" value="modal" />
|
||||
<StyleAttribute name="sizable" value="no" />
|
||||
<StyleAttribute name="position" value="center" />
|
||||
<StyleAttribute name="actionPanelPosition" value="bottom" />
|
||||
<StyleAttribute name="ringMenuPosition" value="bottom" />
|
||||
<StyleAttribute name="toolBarPosition" value="none" />
|
||||
<StyleAttribute name="statusBarType" value="none" />
|
||||
<StyleAttribute name="errorMessagePosition" value="popup" />
|
||||
</Style>
|
||||
<Style name="Window.dialog2">
|
||||
<StyleAttribute name="windowType" value="modal" />
|
||||
<StyleAttribute name="sizable" value="no" />
|
||||
<StyleAttribute name="position" value="center" />
|
||||
<StyleAttribute name="actionPanelPosition" value="none" />
|
||||
<StyleAttribute name="ringMenuPosition" value="none" />
|
||||
<StyleAttribute name="toolBarPosition" value="none" />
|
||||
<StyleAttribute name="statusBarType" value="none" />
|
||||
<StyleAttribute name="errorMessagePosition" value="popup" />
|
||||
</Style>
|
||||
<Style name="Window.dialog3">
|
||||
<StyleAttribute name="windowType" value="modal" />
|
||||
<StyleAttribute name="sizable" value="yes" />
|
||||
<StyleAttribute name="toolBarPosition" value="none" />
|
||||
<StyleAttribute name="actionPanelPosition" value="none" />
|
||||
<StyleAttribute name="ringMenuPosition" value="none" />
|
||||
<StyleAttribute name="statusBarType" value="none" />
|
||||
<StyleAttribute name="errorMessagePosition" value="popup" />
|
||||
</Style>
|
||||
<Style name="Window.dialog4">
|
||||
<StyleAttribute name="windowType" value="modal" />
|
||||
<StyleAttribute name="sizable" value="yes" />
|
||||
<StyleAttribute name="actionPanelPosition" value="bottom" />
|
||||
<StyleAttribute name="ringMenuPosition" value="none" />
|
||||
<StyleAttribute name="statusBarType" value="none" />
|
||||
<StyleAttribute name="errorMessagePosition" value="popup" />
|
||||
</Style>
|
||||
<Style name="Window.naked">
|
||||
<StyleAttribute name="windowType" value="modal" />
|
||||
<StyleAttribute name="border" value="tool" />
|
||||
<StyleAttribute name="actionPanelPosition" value="none" />
|
||||
<StyleAttribute name="ringMenuPosition" value="none" />
|
||||
<StyleAttribute name="toolBarPosition" value="none" />
|
||||
<StyleAttribute name="statusBarType" value="none" />
|
||||
</Style>
|
||||
<Style name="Window.viewer">
|
||||
<StyleAttribute name="windowType" value="modal" />
|
||||
<StyleAttribute name="windowSystemMenu" value="yes" />
|
||||
<StyleAttribute name="windowOptionMinimize" value="no" />
|
||||
<StyleAttribute name="windowOptionMaximize" value="no" />
|
||||
<StyleAttribute name="sizable" value="yes" />
|
||||
<StyleAttribute name="actionPanelPosition" value="none" />
|
||||
<StyleAttribute name="ringMenuPosition" value="none" />
|
||||
<StyleAttribute name="toolBarPosition" value="none" />
|
||||
<StyleAttribute name="statusBarType" value="none" />
|
||||
</Style>
|
||||
<Style name="Label:title">
|
||||
<StyleAttribute name="fontSize" value="xx-large" />
|
||||
<StyleAttribute name="fontFamily" value="sans-serif" />
|
||||
<StyleAttribute name="textDecoration" value="underline" />
|
||||
</Style>
|
||||
<Style name="Table:focus">
|
||||
<StyleAttribute name="highlightColor" value="#7E0C6E" />
|
||||
</Style>
|
||||
<Style name="Table.detail:even">
|
||||
<StyleAttribute name="backgroundColor" value="#DECFDB" />
|
||||
</Style>
|
||||
<Style name="Image.title">
|
||||
<StyleAttribute name="border" value="no" />
|
||||
</Style>
|
||||
</StyleList>
|
||||
@@ -1,93 +0,0 @@
|
||||
<StyleList>
|
||||
<Style name="Window" >
|
||||
<StyleAttribute value="normal" name="windowType" />
|
||||
</Style>
|
||||
<Style name="Window.main" >
|
||||
<StyleAttribute value="normal" name="windowType" />
|
||||
<StyleAttribute value="menu" name="startMenuPosition" />
|
||||
</Style>
|
||||
<Style name="Window.main-mbs" >
|
||||
<StyleAttribute value="center" name="position" />
|
||||
<StyleAttribute value="normal" name="windowType" />
|
||||
<StyleAttribute value="none" name="actionPanelPosition" />
|
||||
<StyleAttribute value="none" name="ringMenuPosition" />
|
||||
<StyleAttribute value="none" name="statusBarType" />
|
||||
</Style>
|
||||
<Style name="Window.dialog" >
|
||||
<StyleAttribute value="modal" name="windowType" />
|
||||
<StyleAttribute value="no" name="sizable" />
|
||||
<StyleAttribute value="center" name="position" />
|
||||
<StyleAttribute value="bottom" name="actionPanelPosition" />
|
||||
<StyleAttribute value="bottom" name="ringMenuPosition" />
|
||||
<StyleAttribute value="none" name="toolBarPosition" />
|
||||
<StyleAttribute value="none" name="statusBarType" />
|
||||
<StyleAttribute value="popup" name="errorMessagePosition" />
|
||||
</Style>
|
||||
<Style name="Window.dialog2" >
|
||||
<StyleAttribute value="modal" name="windowType" />
|
||||
<StyleAttribute value="no" name="sizable" />
|
||||
<StyleAttribute value="center" name="position" />
|
||||
<StyleAttribute value="none" name="actionPanelPosition" />
|
||||
<StyleAttribute value="none" name="ringMenuPosition" />
|
||||
<StyleAttribute value="none" name="toolBarPosition" />
|
||||
<StyleAttribute value="none" name="statusBarType" />
|
||||
<StyleAttribute value="popup" name="errorMessagePosition" />
|
||||
</Style>
|
||||
<Style name="Window.dialog3" >
|
||||
<StyleAttribute value="modal" name="windowType" />
|
||||
<StyleAttribute value="yes" name="sizable" />
|
||||
<StyleAttribute value="none" name="toolBarPosition" />
|
||||
<StyleAttribute value="none" name="actionPanelPosition" />
|
||||
<StyleAttribute value="none" name="ringMenuPosition" />
|
||||
<StyleAttribute value="none" name="statusBarType" />
|
||||
<StyleAttribute value="popup" name="errorMessagePosition" />
|
||||
</Style>
|
||||
<Style name="Window.dialog4" >
|
||||
<StyleAttribute value="modal" name="windowType" />
|
||||
<StyleAttribute value="yes" name="sizable" />
|
||||
<StyleAttribute value="bottom" name="actionPanelPosition" />
|
||||
<StyleAttribute value="none" name="ringMenuPosition" />
|
||||
<StyleAttribute value="none" name="statusBarType" />
|
||||
<StyleAttribute value="popup" name="errorMessagePosition" />
|
||||
</Style>
|
||||
<Style name="Window.naked" >
|
||||
<StyleAttribute value="modal" name="windowType" />
|
||||
<StyleAttribute value="tool" name="border" />
|
||||
<StyleAttribute value="none" name="actionPanelPosition" />
|
||||
<StyleAttribute value="none" name="ringMenuPosition" />
|
||||
<StyleAttribute value="none" name="toolBarPosition" />
|
||||
<StyleAttribute value="none" name="statusBarType" />
|
||||
</Style>
|
||||
<Style name="Window.viewer" >
|
||||
<StyleAttribute value="modal" name="windowType" />
|
||||
<StyleAttribute value="yes" name="windowSystemMenu" />
|
||||
<StyleAttribute value="no" name="windowOptionMinimize" />
|
||||
<StyleAttribute value="no" name="windowOptionMaximize" />
|
||||
<StyleAttribute value="yes" name="sizable" />
|
||||
<StyleAttribute value="none" name="actionPanelPosition" />
|
||||
<StyleAttribute value="none" name="ringMenuPosition" />
|
||||
<StyleAttribute value="none" name="toolBarPosition" />
|
||||
<StyleAttribute value="none" name="statusBarType" />
|
||||
</Style>
|
||||
<Style name="edit:title" >
|
||||
<StyleAttribute value="large" name="fontSize" />
|
||||
<StyleAttribute value="sans-serif" name="fontFamily" />
|
||||
<StyleAttribute value="bold" name="textDecoration" />
|
||||
</Style>
|
||||
<Style name="Label:title" >
|
||||
<StyleAttribute value="sans-serif" name="fontFamily" />
|
||||
<StyleAttribute value="large" name="fontSize" />
|
||||
<StyleAttribute value="normal" name="fontStyle" />
|
||||
<StyleAttribute value="bold" name="fontWeight" />
|
||||
</Style>
|
||||
<Style name="Table:focus" >
|
||||
<StyleAttribute value="#7E0C6E" name="highlightColor" />
|
||||
</Style>
|
||||
<Style name="Table.detail:even" >
|
||||
<StyleAttribute value="#DECFDB" name="backgroundColor" />
|
||||
</Style>
|
||||
<Style name="Image.title" >
|
||||
<StyleAttribute value="no" name="border" />
|
||||
</Style>
|
||||
</StyleList>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
Date: 20/10/2020 Time: 11:50:09
|
||||
Program error at 'noprrp015.4gl', line number 17.
|
||||
SQL statement error number -930 (-18456).
|
||||
[Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user ''.
|
||||
Date: 20/10/2020 Time: 11:50:31
|
||||
Program error at 'noprrp015.4gl', line number 71.
|
||||
FORMS statement error number -6302.
|
||||
Can not read from GUI: Connection closed by peer.
|
||||
Date: 20/10/2020 Time: 11:51:04
|
||||
Program error at 'noprrp015.4gl', line number 106.
|
||||
SQL statement error number -6372 (-164).
|
||||
[Microsoft][SQL Server Native Client 11.0][SQL Server]Each GROUP BY expression must contain at least one column that is not an outer reference.
|
||||
Date: 20/10/2020 Time: 11:51:45
|
||||
Program error at 'noprrp015.4gl', line number 106.
|
||||
SQL statement error number -6372 (-164).
|
||||
[Microsoft][SQL Server Native Client 11.0][SQL Server]Each GROUP BY expression must contain at least one column that is not an outer reference.
|
||||
Date: 20/10/2020 Time: 11:52:24
|
||||
Program error at 'noprrp015.4gl', line number 150.
|
||||
SQL statement error number -6372 (-207).
|
||||
[Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'a'.
|
||||
Date: 20/10/2020 Time: 11:53:01
|
||||
Program error at 'noprrp015.4gl', line number 201.
|
||||
FORMS statement error number -1322.
|
||||
A report output file cannot be opened: C:\archivo: Permission denied.
|
||||
Date: 19/05/2021 Time: 15:01:12
|
||||
Program error at 'noprrp015.4gl', line number 17.
|
||||
SQL statement error number -6372 (1).
|
||||
[Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
|
||||
@@ -1,4 +0,0 @@
|
||||
Date: 01/03/2013 Time: 09:54:50
|
||||
Program error at 'noprmt026.4gl', line number 74.
|
||||
SQL statement error number -1205 (-1).
|
||||
Invalid month in date.
|
||||
@@ -1,12 +0,0 @@
|
||||
Date: 08/06/2013 Time: 11:50:15
|
||||
Program error at 'noprrp035.4gl', line number 171.
|
||||
SQL statement error number -6372 (-206).
|
||||
[Microsoft][SQL Server Native Client 10.0][SQL Server]Operand type clash: date is incompatible with int
|
||||
Date: 08/06/2013 Time: 11:51:32
|
||||
Program error at 'noprrp035.4gl', line number 171.
|
||||
SQL statement error number -6372 (-206).
|
||||
[Microsoft][SQL Server Native Client 10.0][SQL Server]Operand type clash: date is incompatible with int
|
||||
Date: 08/06/2013 Time: 11:55:05
|
||||
Program error at 'noprrp035.4gl', line number 172.
|
||||
SQL statement error number -6372 (-206).
|
||||
[Microsoft][SQL Server Native Client 10.0][SQL Server]Operand type clash: date is incompatible with int
|
||||
@@ -1,4 +0,0 @@
|
||||
Date: 05/06/2014 Time: 11:51:54
|
||||
Program error at 'noprrp035.4gl', line number 208.
|
||||
SQL statement error number -6372 (-241).
|
||||
[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Conversion failed when converting date and/or time from character string.
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
|
||||
Este Modulo es excelente para manejar las ordenes de pedidos,
|
||||
asi como tambien el seguimiento a los clientes.
|
||||
|
||||
Utilice la opcion ORDEN DE PEDIDOS para que vea su versatilidad
|
||||
@@ -1,112 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1252"?>
|
||||
<?FGLReportToRTLInputStyleSheet reportName="r_registros"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug1.xml"?>
|
||||
<?ScopeExtenderStyleSheet systemId="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp" styleURL="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp" ignoreUnmatchedInput="true" variableValueNamesAreInLowerCase="true"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug2.xml"?>
|
||||
<?RTLStyleSheet ignoreUnmatchedInput="true" autoCreate4GLVariables="true" variableValueNamesAreInLowerCase="true" styleURL="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" outputDeviceName="SVG" isPreview="1"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug3.xml"?>
|
||||
<?BoxDecoratorStyleSheet systemId="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp"?>
|
||||
<?HlPxmlToPxmlStyleSheet notUsed="true"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug4.xml"?>
|
||||
<?PxmlLayouter pageWidth="3.00inch" pageHeight="3.00inch" topMargin="0.10inch" leftMargin="0.10inch" rightMargin="0.10inch" bottomMargin="0.10inch" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" markOverfullBoxesInDocument="true"?>
|
||||
<?SVGWriterStyleSheet antialiasFonts="true" antialiasShapes="true" embedFonts="true" qt422workarounds="true" charsetToEmbed="ISO-8859-15"?>
|
||||
<?PrettyPrinterStyleSheet tee="false" writeToHost="localhost" encoding="UTF-8" writeMagic="true" writeToPort="6400" writeCompressed="false"?>
|
||||
<Report name="veprmt022.r_registros" headerLength="0" trailerLength="0" pageLength="66" topMargin="3" bottomMargin="3" leftMargin="5" rightMargin="132" xmlns="http://www.4js.com/2004/REPORT">
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<FirstPageHeader/>
|
||||
<Group>
|
||||
<BeforeGroup/>
|
||||
<Group>
|
||||
<OnEveryRow>
|
||||
<Print>
|
||||
<Item name="x.factura" type="INTEGER" value=" 0" isoValue="0"/>
|
||||
<Item name="x.fecha_factura" type="CHAR(10)" value=" "/>
|
||||
<Item name="x.fecha_nomina" type="CHAR(10)" value=" "/>
|
||||
<Item name="x.codigo_id" type="INTEGER" value=" 1203" isoValue="1203"/>
|
||||
<Item name="x.nombre_cliente" type="VARCHAR(60)" value="1203-VENTURA ANTONIO VIZCAINO PERDOMO "/>
|
||||
<Item name="x.bruto" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
<Item name="x.descuento" type="DECIMAL(12,2)" value=" 0.00" isoValue="0.00"/>
|
||||
<Item name="x.itbis" type="DECIMAL(12,2)" value=" 0.00" isoValue="0.00"/>
|
||||
<Item name="x.sub_total" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
<Item name="x.neto" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
<Item name="x.estado" type="CHAR(20)" value=" "/>
|
||||
<Item name="x.condicion" type="VARCHAR(30)" value=" "/>
|
||||
<Item name="nombre_cia" type="VARCHAR(60)" value="CAFETERIA MARMOTECH "/>
|
||||
<Item name="hora" type="CHAR(16)" value="2015-06-25 14:58"/>
|
||||
<Item name="xfecha1" type="CHAR(10)" value="09/06/2015"/>
|
||||
<Item name="xfecha2" type="CHAR(10)" value="25/06/2015"/>
|
||||
</Print>
|
||||
</OnEveryRow>
|
||||
</Group>
|
||||
<AfterGroup>
|
||||
<Print>
|
||||
<Item name="total_condicion" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
</Print>
|
||||
</AfterGroup>
|
||||
</Group>
|
||||
<OnLastRow>
|
||||
<Print>
|
||||
<Item name="total_venta" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
</Print>
|
||||
</OnLastRow>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<Skip/>
|
||||
<PageTrailer/>
|
||||
</Report>
|
||||
@@ -1,104 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1252"?>
|
||||
<?ScopeExtenderStyleSheet systemId="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp" styleURL="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp" ignoreUnmatchedInput="true" variableValueNamesAreInLowerCase="true"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug2.xml"?>
|
||||
<?RTLStyleSheet ignoreUnmatchedInput="true" autoCreate4GLVariables="true" variableValueNamesAreInLowerCase="true" styleURL="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" outputDeviceName="SVG" isPreview="1"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug3.xml"?>
|
||||
<?BoxDecoratorStyleSheet systemId="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp"?>
|
||||
<?HlPxmlToPxmlStyleSheet notUsed="true"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug4.xml"?>
|
||||
<?PxmlLayouter pageWidth="3.00inch" pageHeight="3.00inch" topMargin="0.10inch" leftMargin="0.10inch" rightMargin="0.10inch" bottomMargin="0.10inch" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" markOverfullBoxesInDocument="true"?>
|
||||
<?SVGWriterStyleSheet antialiasFonts="true" antialiasShapes="true" embedFonts="true" qt422workarounds="true" charsetToEmbed="ISO-8859-15"?>
|
||||
<?PrettyPrinterStyleSheet tee="false" writeToHost="localhost" encoding="UTF-8" writeMagic="true" writeToPort="6400" writeCompressed="false"?>
|
||||
<xxx0:Report name="veprmt022.r_registros" headerLength="0" trailerLength="0" pageLength="66" topMargin="3" bottomMargin="3" leftMargin="5" rightMargin="132" xmlns:rtli="http://www.4js.com/2004/RTL-INPUT" xmlns:xxx0="http://www.4js.com/2004/REPORT">
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:FirstPageHeader/>
|
||||
<xxx0:Group>
|
||||
<xxx0:BeforeGroup/>
|
||||
<xxx0:Group>
|
||||
<xxx0:OnEveryRow>
|
||||
<rtli:variable-value name="x.factura" type="INTEGER" value=" 0" isoValue="0"/>
|
||||
<rtli:variable-value name="x.fecha_factura" type="CHAR(10)" value=" "/>
|
||||
<rtli:variable-value name="x.fecha_nomina" type="CHAR(10)" value=" "/>
|
||||
<rtli:variable-value name="x.codigo_id" type="INTEGER" value=" 1203" isoValue="1203"/>
|
||||
<rtli:variable-value name="x.nombre_cliente" type="VARCHAR(60)" value="1203-VENTURA ANTONIO VIZCAINO PERDOMO "/>
|
||||
<rtli:variable-value name="x.bruto" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
<rtli:variable-value name="x.descuento" type="DECIMAL(12,2)" value=" 0.00" isoValue="0.00"/>
|
||||
<rtli:variable-value name="x.itbis" type="DECIMAL(12,2)" value=" 0.00" isoValue="0.00"/>
|
||||
<rtli:variable-value name="x.sub_total" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
<rtli:variable-value name="x.neto" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
<rtli:variable-value name="x.estado" type="CHAR(20)" value=" "/>
|
||||
<rtli:variable-value name="x.condicion" type="VARCHAR(30)" value=" "/>
|
||||
<rtli:variable-value name="nombre_cia" type="VARCHAR(60)" value="CAFETERIA MARMOTECH "/>
|
||||
<rtli:variable-value name="hora" type="CHAR(16)" value="2015-06-25 14:58"/>
|
||||
<rtli:variable-value name="xfecha1" type="CHAR(10)" value="09/06/2015"/>
|
||||
<rtli:variable-value name="xfecha2" type="CHAR(10)" value="25/06/2015"/>
|
||||
</xxx0:OnEveryRow>
|
||||
</xxx0:Group>
|
||||
<xxx0:AfterGroup>
|
||||
<rtli:variable-value name="total_condicion" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
</xxx0:AfterGroup>
|
||||
</xxx0:Group>
|
||||
<xxx0:OnLastRow>
|
||||
<rtli:variable-value name="total_venta" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
</xxx0:OnLastRow>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:PageTrailer/>
|
||||
</xxx0:Report>
|
||||
@@ -1,94 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1252"?>
|
||||
<?RTLStyleSheet ignoreUnmatchedInput="true" autoCreate4GLVariables="true" variableValueNamesAreInLowerCase="true" styleURL="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" outputDeviceName="SVG" isPreview="1"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug3.xml"?>
|
||||
<?BoxDecoratorStyleSheet systemId="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp"?>
|
||||
<?HlPxmlToPxmlStyleSheet notUsed="true"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug4.xml"?>
|
||||
<?PxmlLayouter pageWidth="3.00inch" pageHeight="3.00inch" topMargin="0.10inch" leftMargin="0.10inch" rightMargin="0.10inch" bottomMargin="0.10inch" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" markOverfullBoxesInDocument="true"?>
|
||||
<?SVGWriterStyleSheet antialiasFonts="true" antialiasShapes="true" embedFonts="true" qt422workarounds="true" charsetToEmbed="ISO-8859-15"?>
|
||||
<?PrettyPrinterStyleSheet tee="false" writeToHost="localhost" encoding="UTF-8" writeMagic="true" writeToPort="6400" writeCompressed="false"?>
|
||||
<xxx0:Report name="veprmt022.r_registros" headerLength="0" trailerLength="0" pageLength="66" topMargin="3" bottomMargin="3" leftMargin="5" rightMargin="132" xmlns:rtli="http://www.4js.com/2004/RTL-INPUT" xmlns:xxx0="http://www.4js.com/2004/REPORT">
|
||||
<rtli:variable-value name="xfecha1" value="09/06/2015" type="CHAR(10)"/>
|
||||
<rtli:variable-value name="nombre_cia" value="CAFETERIA MARMOTECH " type="VARCHAR(60)"/>
|
||||
<rtli:variable-value name="hora" value="2015-06-25 14:58" type="CHAR(16)"/>
|
||||
<rtli:variable-value name="xfecha2" value="25/06/2015" type="CHAR(10)"/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:FirstPageHeader/>
|
||||
<xxx0:Group>
|
||||
<xxx0:BeforeGroup/>
|
||||
<xxx0:Group>
|
||||
<xxx0:OnEveryRow>
|
||||
<rtli:variable-value name="x.factura" type="INTEGER" value=" 0" isoValue="0"/>
|
||||
<rtli:variable-value name="x.fecha_factura" type="CHAR(10)" value=" "/>
|
||||
<rtli:variable-value name="x.nombre_cliente" type="VARCHAR(60)" value="1203-VENTURA ANTONIO VIZCAINO PERDOMO "/>
|
||||
<rtli:variable-value name="x.neto" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
</xxx0:OnEveryRow>
|
||||
</xxx0:Group>
|
||||
<xxx0:AfterGroup>
|
||||
<rtli:variable-value name="total_condicion" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
</xxx0:AfterGroup>
|
||||
</xxx0:Group>
|
||||
<xxx0:OnLastRow>
|
||||
<rtli:variable-value name="total_venta" type="DECIMAL(12,2)" value=" 497.00" isoValue="497.00"/>
|
||||
</xxx0:OnLastRow>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:Skip/>
|
||||
<xxx0:PageTrailer/>
|
||||
</xxx0:Report>
|
||||
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1252"?>
|
||||
<?BoxDecoratorStyleSheet systemId="file:/C:/Users/jsoto/Documents/GENERO/BDL240/MARMOTECH/PROYECTO/bin/PUNTOVENTAS/veprrp001.4rp"?>
|
||||
<?HlPxmlToPxmlStyleSheet notUsed="true"?>
|
||||
<?PrettyPrinterStyleSheet tee="true" writeToFile="debug4.xml"?>
|
||||
<?PxmlLayouter pageWidth="3.00inch" pageHeight="3.00inch" topMargin="0.10inch" leftMargin="0.10inch" rightMargin="0.10inch" bottomMargin="0.10inch" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" markOverfullBoxesInDocument="true"?>
|
||||
<?SVGWriterStyleSheet antialiasFonts="true" antialiasShapes="true" embedFonts="true" qt422workarounds="true" charsetToEmbed="ISO-8859-15"?>
|
||||
<?PrettyPrinterStyleSheet tee="false" writeToHost="localhost" encoding="UTF-8" writeMagic="true" writeToPort="6400" writeCompressed="false"?>
|
||||
<xxx0:PXML xmlns:xxx0="http://www.4js.com/2004/PXML">
|
||||
<xxx0:MINIPAGE fontSize="8" length="min" name="Page Root" width="max">
|
||||
<xxx0:MINIPAGE layoutDirection="leftToRight" length="min" name="encPrincipal" width="min">
|
||||
<xxx0:WORDWRAPBOX floatingBehavior="enclosed" name="nombre_cia Value" text="CAFETERIA MARMOTECH " width="width("M")*18"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="hora Value" text="2015-06-25 14:58"/>
|
||||
</xxx0:MINIPAGE>
|
||||
<xxx0:MINIPAGE fontBold="true" fontSize="7" layoutDirection="leftToRight" length="min" name="rangofechas" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="Finicial" text="FECHA INICIAL:" textAlignment="right" width="2cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="xfecha1 Value" text="09/06/2015"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="FFinal" text="FECHA FINAL:" textAlignment="right" width="2cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="xfecha2 Value" text="25/06/2015"/>
|
||||
</xxx0:MINIPAGE>
|
||||
<xxx0:MINIPAGE borderStyle="solid" borderWidth="1" fontSize="7" layoutDirection="leftToRight" length="min" name="encabezados" roundedCorners="true" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox" text="FECHA" width="1.5cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox1" text="FACTURA" width="1.5cm"/>
|
||||
<xxx0:WORDBOX alignment="baseline" floatingBehavior="enclosed" name="WordBox5" text="NOMBRE" textAlignment="left" width="2cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox2" text="VALOR" textAlignment="right" width="1.9cm"/>
|
||||
</xxx0:MINIPAGE>
|
||||
<xxx0:LAYOUTNODE floatingBehavior="enclosed" fontSize="7" layoutDirection="leftToRight" length="min" name="detalle" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="x.fecha_factura Value" text=" " width="1cm"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="----------#" name="x.factura Value" textAlignment="right" value="0" width=".9cm"/>
|
||||
<xxx0:WORDWRAPBOX alignment="baseline" floatingBehavior="enclosed" name="x.nombre_cliente Value" text="1203-VENTURA ANTONIO VIZCAINO PERDOMO " width="width("M")*20"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="---,---,---,--&.&&" name="x.neto Value" textAlignment="right" value="497" width="1cm"/>
|
||||
</xxx0:LAYOUTNODE>
|
||||
<xxx0:MINIPAGE fontSize="8" layoutDirection="leftToRight" length="min" name="totalCondicion" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox3" text="T. CONDI" width="3cm"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="---,---,---,--&.&&" name="total_condicion Value" textAlignment="right" value="497" width="2cm"/>
|
||||
</xxx0:MINIPAGE>
|
||||
<xxx0:MINIPAGE fontSize="8" layoutDirection="leftToRight" length="min" name="totalGeneral" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox4" text="T. GENERAL" width="3cm"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="---,---,---,--&.&&" name="total_venta Value" textAlignment="right" value="497" width="2cm"/>
|
||||
</xxx0:MINIPAGE>
|
||||
</xxx0:MINIPAGE>
|
||||
</xxx0:PXML>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1252"?>
|
||||
<?PxmlLayouter pageWidth="3.00inch" pageHeight="3.00inch" topMargin="0.10inch" leftMargin="0.10inch" rightMargin="0.10inch" bottomMargin="0.10inch" FGLDIR="C:/Program Files/FourJs/Genero Studio/fgl" FGLPROFILE="C:/Program Files/FourJs/Genero Studio/fgl/etc/fglprofile" FGLEXECUTABLENAME="veprmt022" FOURRPNAME="veprrp001" markOverfullBoxesInDocument="true"?>
|
||||
<?SVGWriterStyleSheet antialiasFonts="true" antialiasShapes="true" embedFonts="true" qt422workarounds="true" charsetToEmbed="ISO-8859-15"?>
|
||||
<?PrettyPrinterStyleSheet tee="false" writeToHost="localhost" encoding="UTF-8" writeMagic="true" writeToPort="6400" writeCompressed="false"?>
|
||||
<xxx0:PXML xmlns:xxx0="http://www.4js.com/2004/PXML">
|
||||
<xxx0:MINIPAGE fontSize="8" length="min" name="Page Root" width="max">
|
||||
<xxx0:MINIPAGE layoutDirection="leftToRight" length="min" name="encPrincipal" width="min">
|
||||
<xxx0:WORDWRAPBOX floatingBehavior="enclosed" name="nombre_cia Value" text="CAFETERIA MARMOTECH " width="width("M")*18"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="hora Value" text="2015-06-25 14:58"/>
|
||||
</xxx0:MINIPAGE>
|
||||
<xxx0:MINIPAGE fontBold="true" fontSize="7" layoutDirection="leftToRight" length="min" name="rangofechas" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="Finicial" text="FECHA INICIAL:" textAlignment="right" width="2cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="xfecha1 Value" text="09/06/2015"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="FFinal" text="FECHA FINAL:" textAlignment="right" width="2cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="xfecha2 Value" text="25/06/2015"/>
|
||||
</xxx0:MINIPAGE>
|
||||
<xxx0:BORDERBOX borderStyle="solid" borderWidth="1" roundedCorners="true">
|
||||
<xxx0:MINIPAGE fontSize="7" layoutDirection="leftToRight" length="min" name="encabezados" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox" text="FECHA" width="1.5cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox1" text="FACTURA" width="1.5cm"/>
|
||||
<xxx0:WORDBOX alignment="baseline" floatingBehavior="enclosed" name="WordBox5" text="NOMBRE" textAlignment="left" width="2cm"/>
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox2" text="VALOR" textAlignment="right" width="1.9cm"/>
|
||||
</xxx0:MINIPAGE>
|
||||
</xxx0:BORDERBOX>
|
||||
<xxx0:LAYOUTNODE floatingBehavior="enclosed" fontSize="7" layoutDirection="leftToRight" length="min" name="detalle" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="x.fecha_factura Value" text=" " width="1cm"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="----------#" name="x.factura Value" textAlignment="right" value="0" width=".9cm"/>
|
||||
<xxx0:WORDWRAPBOX alignment="baseline" floatingBehavior="enclosed" name="x.nombre_cliente Value" text="1203-VENTURA ANTONIO VIZCAINO PERDOMO " width="width("M")*20"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="---,---,---,--&.&&" name="x.neto Value" textAlignment="right" value="497" width="1cm"/>
|
||||
</xxx0:LAYOUTNODE>
|
||||
<xxx0:MINIPAGE fontSize="8" layoutDirection="leftToRight" length="min" name="totalCondicion" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox3" text="T. CONDI" width="3cm"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="---,---,---,--&.&&" name="total_condicion Value" textAlignment="right" value="497" width="2cm"/>
|
||||
</xxx0:MINIPAGE>
|
||||
<xxx0:MINIPAGE fontSize="8" layoutDirection="leftToRight" length="min" name="totalGeneral" width="min">
|
||||
<xxx0:WORDBOX floatingBehavior="enclosed" name="WordBox4" text="T. GENERAL" width="3cm"/>
|
||||
<xxx0:DECIMALFORMATBOX anchorX="1" floatingBehavior="enclosed" format="---,---,---,--&.&&" name="total_venta Value" textAlignment="right" value="497" width="2cm"/>
|
||||
</xxx0:MINIPAGE>
|
||||
</xxx0:MINIPAGE>
|
||||
</xxx0:PXML>
|
||||
|
Before Width: | Height: | Size: 128 KiB |
@@ -1,66 +0,0 @@
|
||||
|
||||
|
||||
|
||||
3355 2300 0 113JUAN SOTO CONCEPCION 31/12/1899C/ PRIMERA, RES. SOL RECIENTE 1 31/12/1899 0 00104581939 0 175000.00 01/04/200831/12/1899 0 0 <byte value> 0 31/12/1899 0 0 031/12/1899 0 31/12/1899 M A R M O T E C H, S. A. (C) TECNOLOGIA GERENTE DE TECNOLOGIA EMPLEADOS ACTIVOS 1
|
||||
3980 2300 0 16MIGUEL PINALES DEL ROSARIO 31/12/1899C/ PRIMERA 31/12/1899 0 40225031695 0 25000.00 09/06/201431/12/1899 0 0 <byte value> 0 31/12/1899 0 0 031/12/1899 0 31/12/1899 M A R M O T E C H, S. A. (C) TECNOLOGIA ASISTENTE TECNOLOGIA EMPLEADOS ACTIVOS 2
|
||||
4791 2300 0 16ALEXANDER PAULINO ROSARIO 31/12/1899C/ MANZANA N 28 31/12/1899 0 40226444517 0 20000.00 25/03/201931/12/1899 0 0 <byte value> 0 31/12/1899 0 0 031/12/1899 0 31/12/1899 M A R M O T E C H, S. A. (C) TECNOLOGIA ASISTENTE TECNOLOGIA EMPLEADOS ACTIVOS 3
|
||||
3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 137 KiB |
@@ -1,226 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css" /> -->
|
||||
<title>Custom Bootstrap 4 card</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,500&subset=latin-ext" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||
</head>
|
||||
|
||||
<style>
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.card {
|
||||
position: relative;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
word-wrap: break-word;
|
||||
background-color: #fff;
|
||||
background-clip: border-box;
|
||||
border: 1px solid black;
|
||||
border-radius: .25rem;
|
||||
}
|
||||
|
||||
.container {
|
||||
font-size: 14px;
|
||||
color: #666666;
|
||||
font-family: "Open Sans";
|
||||
}
|
||||
|
||||
.card-custom {
|
||||
overflow: hidden;
|
||||
min-height: 500px;
|
||||
|
||||
/* box-shadow: 0 0 15px rgba(10, 10, 10, 0.3); */
|
||||
}
|
||||
|
||||
.card-custom-img {
|
||||
height: 278px;
|
||||
background-color: #792227;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
border-color: inherit;
|
||||
margin-top: 222px;
|
||||
}
|
||||
|
||||
/* First border-left-width setting is a fallback */
|
||||
/* .card-custom-img::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
top: 161px;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-top-width: 40px;
|
||||
border-right-width: 0;
|
||||
border-bottom-width: 0;
|
||||
border-left-width: 545px;
|
||||
border-left-width: calc(575px - 5vw);
|
||||
border-top-color: transparent;
|
||||
border-right-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-left-color: inherit;
|
||||
} */
|
||||
|
||||
.img-fluid {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
img {
|
||||
vertical-align: middle;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
.card-custom-avatar img {
|
||||
border-radius: 50%;
|
||||
border: 5px solid #792227;
|
||||
position: absolute;
|
||||
top: 234px;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 158px;
|
||||
height: 154px;
|
||||
}
|
||||
|
||||
.card-custom-avatar2 .img2 {
|
||||
position: absolute;
|
||||
top: 65px;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 255px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
.card-custom-avatar2 .direccion {
|
||||
position: absolute;
|
||||
top: 94px;
|
||||
left: 53%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 69%;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.card-custom-avatar2 .telefono {
|
||||
position: absolute;
|
||||
top: 110px;
|
||||
left: 52%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 30%;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.card-footer{
|
||||
color: white;
|
||||
position: absolute;
|
||||
height: 195px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
/* background-color: aquamarine; */
|
||||
}
|
||||
|
||||
.nombre {
|
||||
position: absolute;
|
||||
font-size: 23px;
|
||||
left: 50%;
|
||||
transform: translate(-50% , -50%);
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.cargo {
|
||||
font-size: 15px;
|
||||
position: absolute;
|
||||
top: 15%;
|
||||
left: 50%;
|
||||
transform: translate(-50% , -50%);
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
|
||||
.m-auto {
|
||||
margin: auto!important;
|
||||
}
|
||||
|
||||
.pt-5 {
|
||||
padding-top: 3rem!important;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
margin-right: -15px;
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
.pb-3 {
|
||||
padding-bottom: 1rem!important;
|
||||
}
|
||||
|
||||
.col-md-6 {
|
||||
width: 310px;
|
||||
}
|
||||
|
||||
.bg-white {
|
||||
background-color: #fff!important;
|
||||
}
|
||||
.m-auto {
|
||||
margin: auto!important;
|
||||
}
|
||||
.pt-5 {
|
||||
padding-top: 3rem!important;
|
||||
}
|
||||
.row {
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
margin-right: -15px;
|
||||
margin-left: -15px;
|
||||
}
|
||||
*, ::after, ::before {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row pt-5 m-auto">
|
||||
<div class="col-md-6 col-lg-4 pb-3">
|
||||
<!-- Copy the content below until next comment -->
|
||||
<div class="card card-custom bg-white border-white border-0">
|
||||
<div class="card-custom-avatar2">
|
||||
<img class="img-fluid img2" src="Logo_DCM.png" alt="Avatar" />
|
||||
<p class="card-text direccion">Av. Ing Roberto Pastoriza 164. Sto.Dgo.</p>
|
||||
<p class="card-text telefono">(809)-227-2223)</p>
|
||||
</div>
|
||||
|
||||
<div class="card-custom-avatar">
|
||||
<img class="img-fluid" src="lana.PNG" alt="Avatar" />
|
||||
</div>
|
||||
<div class="card-custom-img"></div>
|
||||
<div class="card-footer">
|
||||
<p class="nombre">Lana Rhoades</p>
|
||||
<p class="cargo">Gerente de RR.HH</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Copy until here -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 171 KiB |
@@ -1,28 +0,0 @@
|
||||
Date: 03/02/2026 Time: 10:46:04
|
||||
Program error at 'ccprmt017.4gl', line number 28.
|
||||
SQL statement error number -930 (-18456).
|
||||
[Microsoft][SQL Server Native Client 11.0][SQL Server]Error de inicio de sesión del usuario ''.
|
||||
Date: 03/02/2026 Time: 10:46:25
|
||||
Program error at 'ccprmt017.4gl', line number 60.
|
||||
FORMS statement error number -1110.
|
||||
Form file (cpfmt017) not found.
|
||||
Date: 03/02/2026 Time: 10:46:49
|
||||
Program error at 'ccprmt017.4gl', line number 60.
|
||||
FORMS statement error number -1110.
|
||||
Form file (ccfmt017) not found.
|
||||
Date: 03/02/2026 Time: 10:47:04
|
||||
Program error at 'ccprmt017.4gl', line number 62.
|
||||
FORMS statement error number -1102.
|
||||
Field (comisiones) not found in form.
|
||||
Date: 03/02/2026 Time: 10:48:00
|
||||
Program error at 'ccprmt017.4gl', line number 79.
|
||||
SQL statement error number -206 (-208).
|
||||
[Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object name 'ctb9'.
|
||||
Date: 03/02/2026 Time: 10:55:18
|
||||
Program error at 'ccprmt017.4gl', line number 73.
|
||||
SQL statement error number -6372 (-4104).
|
||||
[Microsoft][SQL Server Native Client 11.0][SQL Server]The multi-part identifier "a.id" could not be bound.
|
||||
Date: 03/02/2026 Time: 10:56:56
|
||||
Program error at 'ccprmt017.4gl', line number 65.
|
||||
SQL statement error number -284 (-1).
|
||||
A subquery has returned not exactly one row.
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<report:Report xmlns:rtl="http://www.4js.com/2004/RTL" xmlns:report="http://www.4js.com/2007/REPORT" xmlns="http://www.4js.com/2004/PXML" gstVersion="60003" version="7.00">
|
||||
<report:Settings RWPageWidth="a4width" RWPageLength="a4length" RWLeftMargin="1.3cm" RWTopMargin="1.3cm" RWRightMargin="1.3cm" RWBottomMargin="1.3cm">
|
||||
<report:FormatList>
|
||||
<report:Format-SVG/>
|
||||
<report:Format-PDF/>
|
||||
<report:Format-image/>
|
||||
</report:FormatList>
|
||||
</report:Settings>
|
||||
<report:Data RWFglReportName="ventas"/>
|
||||
<report:Conflicts/>
|
||||
<rtl:stylesheet>
|
||||
<PXML>
|
||||
<rtl:match name="Report" nameConstraint="Report" minOccurs="1" maxOccurs="1">
|
||||
<MINIPAGE name="page root" width="max" length="max" alignment="near" fontName="Arial" fontSize="8">
|
||||
<LAYOUTNODE name="header" width="min" length="min" alignment="center" port="firstPageHeader">
|
||||
<WORDBOX name="Title" width="500" length="24" alignment="near" fontSize="15" fontBold="true" textAlignment="center" text="Clientes sin Ventas"/>
|
||||
<LAYOUTNODE name="espacio titulo" width="500" length="6"/>
|
||||
</LAYOUTNODE>
|
||||
<rtl:match name="Group sec_vend" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="info" width="min" length="max" layoutDirection="leftToRight" fontBold="true">
|
||||
<rtl:input-variable name="empresa" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="empresa Value" width="170" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{empresa}}"/>
|
||||
<rtl:input-variable name="titulo" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="titulo Value" width="330" length="12" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="{{titulo}}"/>
|
||||
</MINIPAGE>
|
||||
<LAYOUTNODE name="espacio info" width="500" length="6"/>
|
||||
<MINIPAGE name="vendedor header" width="min" length="max" layoutDirection="leftToRight" bgColor="#cccccc" fontBold="true">
|
||||
<rtl:input-variable name="vendedor" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="vendedor Value" width="500" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{vendedor}}"/>
|
||||
</MINIPAGE>
|
||||
<MINIPAGE name="encabezado" width="min" length="max" bgColor="#eeeeee" fontBold="true" layoutDirection="leftToRight">
|
||||
<WORDBOX name="h1" width="170" length="12" alignment="baseline" text="Cliente"/>
|
||||
<WORDBOX name="h2" width="55" length="12" alignment="baseline" textAlignment="right" text="Factura"/>
|
||||
<WORDBOX name="h3" width="70" length="12" alignment="baseline" textAlignment="right" text="Fecha"/>
|
||||
<WORDBOX name="h4" width="75" length="12" alignment="baseline" textAlignment="right" text="Valor"/>
|
||||
<WORDBOX name="h5" width="45" length="12" alignment="baseline" textAlignment="right" text="No.dias"/>
|
||||
<WORDBOX name="h6" width="85" length="12" alignment="baseline" textAlignment="right" text="Balance"/>
|
||||
</MINIPAGE>
|
||||
<rtl:match name="OnEveryRow" nameConstraint="OnEveryRow" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="fila" width="min" length="max" layoutDirection="leftToRight">
|
||||
<rtl:input-variable name="cli" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="cli Value" width="170" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{cli}}"/>
|
||||
<rtl:input-variable name="x.factura" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="factura Value" width="55" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="------&" value="{{x.factura}}"/>
|
||||
<rtl:input-variable name="fec" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="fec Value" width="70" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" text="{{fec}}"/>
|
||||
<rtl:input-variable name="x.valor" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="valor Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="-,---,--&.&&" value="{{x.valor}}"/>
|
||||
<rtl:input-variable name="dias_c" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="dias Value" width="45" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="---,--&" value="{{dias_c}}"/>
|
||||
<rtl:input-variable name="x.balance" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="balance Value" width="85" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="---,---,--&.&&" value="{{x.balance}}"/>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
<LAYOUTNODE name="espacio vendedor" width="500" length="14"/>
|
||||
</rtl:match>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
</PXML>
|
||||
</rtl:stylesheet>
|
||||
</report:Report>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<report:Report xmlns:rtl="http://www.4js.com/2004/RTL" xmlns:report="http://www.4js.com/2007/REPORT" xmlns="http://www.4js.com/2004/PXML" gstVersion="60003" version="7.00">
|
||||
<report:Settings RWPageWidth="a4length" RWPageLength="a4width" RWLeftMargin="1.3cm" RWTopMargin="1.3cm" RWRightMargin="1.3cm" RWBottomMargin="1.3cm">
|
||||
<report:FormatList>
|
||||
<report:Format-SVG/>
|
||||
<report:Format-PDF/>
|
||||
<report:Format-image/>
|
||||
</report:FormatList>
|
||||
</report:Settings>
|
||||
<report:Data RWFglReportName="estado3"/>
|
||||
<report:Conflicts/>
|
||||
<rtl:stylesheet>
|
||||
<PXML>
|
||||
<rtl:match name="Report" nameConstraint="Report" minOccurs="1" maxOccurs="1">
|
||||
<MINIPAGE name="page root" width="max" length="max" alignment="near" fontName="Arial" fontSize="8">
|
||||
<LAYOUTNODE name="header" width="min" length="min" alignment="center" port="firstPageHeader">
|
||||
<WORDBOX name="Title" width="720" length="24" alignment="near" fontSize="15" fontBold="true" textAlignment="center" text="Saldos por Antiguedad"/>
|
||||
<LAYOUTNODE name="espacio titulo" width="720" length="6"/>
|
||||
</LAYOUTNODE>
|
||||
<rtl:match name="Group grupo" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="info" width="min" length="max" layoutDirection="leftToRight" fontBold="true">
|
||||
<rtl:input-variable name="x.empresa" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="empresa Value" width="300" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{x.empresa}}"/>
|
||||
<rtl:input-variable name="x.titulo" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="titulo Value" width="420" length="12" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="{{x.titulo}}"/>
|
||||
</MINIPAGE>
|
||||
<LAYOUTNODE name="espacio info" width="720" length="6"/>
|
||||
<MINIPAGE name="encabezado" width="min" length="max" bgColor="#cccccc" fontBold="true" layoutDirection="leftToRight">
|
||||
<WORDBOX name="h1" width="190" length="12" alignment="baseline" text="Cliente"/>
|
||||
<WORDBOX name="h2" width="75" length="12" alignment="baseline" textAlignment="right" text="Corriente"/>
|
||||
<WORDBOX name="h3" width="75" length="12" alignment="baseline" textAlignment="right" text="De 1 a 30"/>
|
||||
<WORDBOX name="h4" width="75" length="12" alignment="baseline" textAlignment="right" text="De 31 a 60"/>
|
||||
<WORDBOX name="h5" width="75" length="12" alignment="baseline" textAlignment="right" text="De 61 a 90"/>
|
||||
<WORDBOX name="h6" width="75" length="12" alignment="baseline" textAlignment="right" text="Mas de 90"/>
|
||||
<WORDBOX name="h7" width="85" length="12" alignment="baseline" textAlignment="right" text="Total"/>
|
||||
<WORDBOX name="h8" width="45" length="12" alignment="baseline" textAlignment="right" text="%"/>
|
||||
</MINIPAGE>
|
||||
<rtl:match name="OnEveryRow" nameConstraint="OnEveryRow" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="fila" width="min" length="max" layoutDirection="leftToRight">
|
||||
<rtl:input-variable name="x.cliente" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="cliente Value" width="190" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{x.cliente}}"/>
|
||||
<rtl:input-variable name="x.c1" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="c1 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{x.c1}}"/>
|
||||
<rtl:input-variable name="x.c2" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="c2 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{x.c2}}"/>
|
||||
<rtl:input-variable name="x.c3" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="c3 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{x.c3}}"/>
|
||||
<rtl:input-variable name="x.c4" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="c4 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{x.c4}}"/>
|
||||
<rtl:input-variable name="x.c5" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="c5 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{x.c5}}"/>
|
||||
<rtl:input-variable name="x.total" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="total Value" width="85" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,---,--&.&&" value="{{x.total}}"/>
|
||||
<rtl:input-variable name="x.pct" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="pct Value" width="45" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="---&.&&" value="{{x.pct}}"/>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
<LAYOUTNODE name="espacio totales" width="720" length="8"/>
|
||||
<MINIPAGE name="totales" width="min" length="max" layoutDirection="leftToRight" bgColor="#eeeeee" fontBold="true">
|
||||
<WORDBOX name="tl" width="190" length="12" alignment="baseline" textAlignment="right" text="Totales -->"/>
|
||||
<rtl:input-variable name="t30" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="t30 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{t30}}"/>
|
||||
<rtl:input-variable name="t45" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="t45 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{t45}}"/>
|
||||
<rtl:input-variable name="t60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="t60 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{t60}}"/>
|
||||
<rtl:input-variable name="tm60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tm60 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{tm60}}"/>
|
||||
<rtl:input-variable name="tm120" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tm120 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{tm120}}"/>
|
||||
<rtl:input-variable name="tsaldo" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tsaldo Value" width="85" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,---,--&.&&" value="{{tsaldo}}"/>
|
||||
</MINIPAGE>
|
||||
<MINIPAGE name="cxc" width="min" length="max" layoutDirection="leftToRight" fontBold="true">
|
||||
<WORDBOX name="cl" width="190" length="12" alignment="baseline" textAlignment="right" text="Total CXC -->"/>
|
||||
<rtl:input-variable name="ct30" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ct30 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{ct30}}"/>
|
||||
<rtl:input-variable name="ct45" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ct45 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{ct45}}"/>
|
||||
<rtl:input-variable name="ct60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ct60 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{ct60}}"/>
|
||||
<rtl:input-variable name="ctm60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ctm60 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{ctm60}}"/>
|
||||
<rtl:input-variable name="ctm120" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ctm120 Value" width="75" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{ctm120}}"/>
|
||||
<rtl:input-variable name="ctsaldo" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ctsaldo Value" width="85" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,---,--&.&&" value="{{ctsaldo}}"/>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
</PXML>
|
||||
</rtl:stylesheet>
|
||||
</report:Report>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<report:Report xmlns:rtl="http://www.4js.com/2004/RTL" xmlns:report="http://www.4js.com/2007/REPORT" xmlns="http://www.4js.com/2004/PXML" gstVersion="60003" version="7.00">
|
||||
<report:Settings RWPageWidth="a4width" RWPageLength="a4length" RWLeftMargin="1.3cm" RWTopMargin="1.3cm" RWRightMargin="1.3cm" RWBottomMargin="1.3cm">
|
||||
<report:FormatList>
|
||||
<report:Format-SVG/>
|
||||
<report:Format-PDF/>
|
||||
<report:Format-image/>
|
||||
</report:FormatList>
|
||||
</report:Settings>
|
||||
<report:Data RWFglReportName="estado18"/>
|
||||
<report:Conflicts/>
|
||||
<rtl:stylesheet>
|
||||
<PXML>
|
||||
<rtl:match name="Report" nameConstraint="Report" minOccurs="1" maxOccurs="1">
|
||||
<MINIPAGE name="page root" width="max" length="max" alignment="near" fontName="Arial" fontSize="8">
|
||||
<LAYOUTNODE name="header" width="min" length="min" alignment="center" port="firstPageHeader">
|
||||
<WORDBOX name="Title" width="500" length="24" alignment="near" fontSize="15" fontBold="true" textAlignment="center" text="Estado de Cuentas Pendientes de Cobro"/>
|
||||
<LAYOUTNODE name="espacio titulo" width="500" length="8"/>
|
||||
</LAYOUTNODE>
|
||||
<rtl:match name="Group codigo" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="cliente header" width="min" length="max" layoutDirection="leftToRight" bgColor="#cccccc" fontBold="true">
|
||||
<rtl:input-variable name="x.cliente" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="cliente Value" width="290" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{x.cliente}}"/>
|
||||
<rtl:input-variable name="x.limite" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="limite Value" width="210" length="12" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="{{x.limite}}"/>
|
||||
</MINIPAGE>
|
||||
<MINIPAGE name="direccion header" width="min" length="max" layoutDirection="leftToRight" bgColor="#eeeeee">
|
||||
<rtl:input-variable name="x.direccion" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="direccion Value" width="230" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{x.direccion}}"/>
|
||||
<rtl:input-variable name="x.zona" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="zona Value" width="190" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{x.zona}}"/>
|
||||
<rtl:input-variable name="x.corte" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="corte Value" width="80" length="12" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="{{x.corte}}"/>
|
||||
</MINIPAGE>
|
||||
<MINIPAGE name="encabezado" width="min" length="max" bgColor="#eeeeee" fontBold="true" layoutDirection="leftToRight">
|
||||
<WORDBOX name="h1" width="130" length="12" alignment="baseline" text="Documento"/>
|
||||
<WORDBOX name="h2" width="80" length="12" alignment="baseline" text="Fecha"/>
|
||||
<WORDBOX name="h3" width="100" length="12" alignment="baseline" textAlignment="right" text="Valor"/>
|
||||
<WORDBOX name="h4" width="100" length="12" alignment="baseline" textAlignment="right" text="Balance"/>
|
||||
<WORDBOX name="h5" width="60" length="12" alignment="baseline" textAlignment="right" text="Dias"/>
|
||||
</MINIPAGE>
|
||||
<rtl:match name="OnEveryRow" nameConstraint="OnEveryRow" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="fila" width="min" length="max" layoutDirection="leftToRight">
|
||||
<rtl:input-variable name="x.documento" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="documento Value" width="130" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{x.documento}}"/>
|
||||
<rtl:input-variable name="x.fecha" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="fecha Value" width="80" length="12" alignment="baseline" floatingBehavior="enclosed" text="{{x.fecha}}"/>
|
||||
<rtl:input-variable name="x.valor" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="valor Value" width="100" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,---,--&.&&" value="{{x.valor}}"/>
|
||||
<rtl:input-variable name="x.balance" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="balance Value" width="100" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,---,--&.&&" value="{{x.balance}}"/>
|
||||
<rtl:input-variable name="x.dias" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="dias Value" width="60" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="----&" value="{{x.dias}}"/>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
<MINIPAGE name="antiguedad header" width="min" length="max" layoutDirection="leftToRight" bgColor="#eeeeee" fontBold="true">
|
||||
<WORDBOX name="a1" width="80" length="12" alignment="baseline" textAlignment="right" text="No vencido"/>
|
||||
<WORDBOX name="a2" width="80" length="12" alignment="baseline" textAlignment="right" text="1 a 30"/>
|
||||
<WORDBOX name="a3" width="80" length="12" alignment="baseline" textAlignment="right" text="31 a 45"/>
|
||||
<WORDBOX name="a4" width="80" length="12" alignment="baseline" textAlignment="right" text="46 a 60"/>
|
||||
<WORDBOX name="a5" width="80" length="12" alignment="baseline" textAlignment="right" text="Mas de 60"/>
|
||||
<WORDBOX name="a6" width="90" length="12" alignment="baseline" textAlignment="right" text="Total"/>
|
||||
</MINIPAGE>
|
||||
<MINIPAGE name="antiguedad valores" width="min" length="max" layoutDirection="leftToRight" fontBold="true">
|
||||
<rtl:input-variable name="nov" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="nov Value" width="80" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{nov}}"/>
|
||||
<rtl:input-variable name="d1" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="d1 Value" width="80" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{d1}}"/>
|
||||
<rtl:input-variable name="d2" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="d2 Value" width="80" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{d2}}"/>
|
||||
<rtl:input-variable name="d3" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="d3 Value" width="80" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{d3}}"/>
|
||||
<rtl:input-variable name="d4" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="d4 Value" width="80" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,--&.&&" value="{{d4}}"/>
|
||||
<rtl:input-variable name="total" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="total Value" width="90" length="12" alignment="baseline" textAlignment="right" floatingBehavior="enclosed" format="--,---,---,--&.&&" value="{{total}}"/>
|
||||
</MINIPAGE>
|
||||
<LAYOUTNODE name="espacio cliente" width="500" length="14"/>
|
||||
</rtl:match>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
</PXML>
|
||||
</rtl:stylesheet>
|
||||
</report:Report>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<report:Report xmlns:rtl="http://www.4js.com/2004/RTL" xmlns:report="http://www.4js.com/2007/REPORT" xmlns="http://www.4js.com/2004/PXML" version="3.01">
|
||||
<report:Report xmlns:rtl="http://www.4js.com/2004/RTL" xmlns:report="http://www.4js.com/2007/REPORT" xmlns="http://www.4js.com/2004/PXML" gstVersion="31405" version="6.00">
|
||||
<report:Settings RWPageWidth="letterwidth" RWPageLength="letterlength" RWLeftMargin="0.5inch" RWTopMargin="0.5inch" RWRightMargin="0.5inch" RWBottomMargin="0.5inch">
|
||||
<report:FormatList>
|
||||
<report:Format-SVG/>
|
||||
@@ -7,132 +7,73 @@
|
||||
<report:Format-image/>
|
||||
</report:FormatList>
|
||||
</report:Settings>
|
||||
<report:Data RWDataLocation="../ccdir/ccprrp054.rdd" RWFglReportName="reporte54"/>
|
||||
<report:Data RWDataLocation="../ccdir/ccprrp049.rdd" RWFglReportName="r_email"/>
|
||||
<report:Conflicts/>
|
||||
<rtl:stylesheet>
|
||||
<PXML>
|
||||
<rtl:match nameConstraint="Report">
|
||||
<MINIPAGE name="Page Root" width="max" length="max" alignment="near">
|
||||
<LAYOUTNODE name="Cabecera" width="min" length="min" alignment="near" fontSize="8" fontBold="true" floatingBehavior="enclosed">
|
||||
<LAYOUTNODE name="Titulo" width="min" length="max" fontBold="true" layoutDirection="leftToRight" floatingBehavior="enclosed" borderWidth="0.2" borderStyle="solid">
|
||||
<WORDBOX name="WordBox" width="50" floatingBehavior="enclosed" text="CCPRRP054"/>
|
||||
<rtl:input-variable name="pcompanias.nombre" type="FGLString" expectedLocation="expectedAhead"/>
|
||||
<WORDWRAPBOX name="pcompanias.nombre Value" width="440.1" floatingBehavior="enclosed" text="{{pcompanias.nombre}}" textAlignment="center"/>
|
||||
<MINIPAGE name="MiniPage" width="min" length="0.5inch" layoutDirection="leftToRight">
|
||||
<WORDBOX name="WordBox3" floatingBehavior="enclosed" text="pagina: "/>
|
||||
<PAGENOBOX name="PageNoBox" width="10.5" alignment="baseline" floatingBehavior="enclosed"/>
|
||||
</MINIPAGE>
|
||||
</LAYOUTNODE>
|
||||
<MINIPAGE name="Enc.Secundario" width="min" length="min" alignment="near" layoutDirection="leftToRight" borderWidth="0.2" borderStyle="solid">
|
||||
<WORDBOX name="WordBox2" width="6.5inch" alignment="center" fontBold="true" floatingBehavior="enclosed" textAlignment="center" text="Sistema de Cuentas por Cobrar"/>
|
||||
<rtl:input-variable name="x.fecha_factura" type="FGLString" expectedLocation="expectedAhead"/>
|
||||
<WORDBOX name="x.fecha_factura Value" width="0.98inch" floatingBehavior="enclosed" text="{{x.fecha_factura}}"/>
|
||||
</MINIPAGE>
|
||||
<MINIPAGE name="Enc.Secundario-b" width="min" length="min" layoutDirection="leftToRight">
|
||||
<WORDBOX name="Total Registros:" width="0.8inch" floatingBehavior="enclosed" text="Total Registros:"/>
|
||||
<rtl:input-variable name="i" type="FGLNumeric" expectedLocation="expectedAhead"/>
|
||||
<DECIMALFORMATBOX name="i Value" width="16.5" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="----------#" value="{{i}}"/>
|
||||
<rtl:input-variable name="tit_secundario" type="FGLString" expectedLocation="expectedAhead"/>
|
||||
<WORDWRAPBOX name="tit_secundario Value" width="5.45inch" floatingBehavior="enclosed" text="{{tit_secundario}}" textAlignment="center"/>
|
||||
<rtl:input-variable name="hora" type="FGLString" expectedLocation="expectedAhead"/>
|
||||
<WORDBOX name="hora Value" width="1inch" floatingBehavior="enclosed" text="{{hora}}"/>
|
||||
</MINIPAGE>
|
||||
<MINIPAGE name="MiniPage1" width="7.5" length="7.5" layoutDirection="leftToRight"/>
|
||||
<rtl:match name="Report" nameConstraint="Report">
|
||||
<MINIPAGE name="Page Root" width="max" length="min" alignment="near">
|
||||
<LAYOUTNODE name="Encabezado" width="min" length="min" floatingBehavior="enclosed">
|
||||
<rtl:input-variable name="p_companias.nombre" type="FGLString" expectedLocation="expectedAhead"/>
|
||||
<WORDWRAPBOX name="p_companias.nombre Value" width="width("M")*20" floatingBehavior="enclosed" text="{{p_companias.nombre}}"/>
|
||||
<rtl:input-variable name="fecha1" type="FGLString" expectedLocation="expectedAhead"/>
|
||||
<rtl:input-variable name="fecha2" type="FGLString" expectedLocation="expectedAhead"/>
|
||||
<WORDBOX name="WordBox8" width="3inch" floatingBehavior="enclosed" text="{{"Desde "+fecha1.value+" HASTA "+fecha2.value}}"/>
|
||||
<WORDBOX name="WordBox7" floatingBehavior="enclosed" text="COBROS"/>
|
||||
</LAYOUTNODE>
|
||||
<MINIPAGE name="Enc.Titulo" width="9.8354" length="539" fontSize="8" fontBold="true" layoutDirection="leftToRight" borderWidth="0.2" borderStyle="solid">
|
||||
<WORDBOX name="WordBox9" width="1.7inch" alignment="baseline" floatingBehavior="enclosed" text="Cliente"/>
|
||||
<WORDBOX name="WordBox9_1" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" text="Factura"/>
|
||||
<WORDBOX name="WordBox9_1_1" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" text="F. Vence"/>
|
||||
<WORDBOX name="WordBox9_1_1_1" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="Corriente"/>
|
||||
<WORDBOX name="WordBox9_2" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="De 1 a 30"/>
|
||||
<WORDBOX name="WordBox9_2_1" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="De 31 a 60"/>
|
||||
<WORDBOX name="WordBox9_2_1_1" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="De 61 a 90"/>
|
||||
<WORDBOX name="WordBox9_2_1_1_1" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="Mas de 90"/>
|
||||
<WORDBOX name="WordBox9_2_1_1_1_1" width="0.72inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="Total"/>
|
||||
</MINIPAGE>
|
||||
<rtl:match nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="MiniPage2" width="min" length="min" fontSize="7" layoutDirection="leftToRight">
|
||||
<rtl:input-variable name="x.sec_vend" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="x.sec_vend Value" anchorX="1" fontSize="7" floatingBehavior="enclosed" textAlignment="right" format="-----#" value="{{x.sec_vend}}"/>
|
||||
<rtl:input-variable name="vendedor" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDBOX name="vendedor Value" floatingBehavior="enclosed" text="{{vendedor}}"/>
|
||||
</MINIPAGE>
|
||||
<rtl:match nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="MiniPage3" width="min" length="min" fontSize="7" layoutDirection="leftToRight">
|
||||
<rtl:input-variable name="cod_cliente" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="cod_cliente Value" width="0.5inch" floatingBehavior="enclosed" text="{{cod_cliente}}"/>
|
||||
<rtl:input-variable name="x.nombre" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDBOX name="x.nombre Value" width="1inch" floatingBehavior="enclosed" text="{{x.nombre}}"/>
|
||||
</MINIPAGE>
|
||||
<rtl:match nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<rtl:match nameConstraint="OnEveryRow" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="DATA" width="8" length="max" alignment="near" fontSize="7" layoutDirection="leftToRight">
|
||||
<MINIPAGE name="MiniPage4" width="6.91853" length="1.7inch" layoutDirection="leftToRight"/>
|
||||
<rtl:input-variable name="factura" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDBOX name="factura Value" width="0.72inch" floatingBehavior="enclosed" text="{{factura}}"/>
|
||||
<rtl:input-variable name="x.fecha_factura" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDBOX name="x.fecha_factura Value1" width="0.72inch" floatingBehavior="enclosed" text="{{x.fecha_factura}}"/>
|
||||
<rtl:input-variable name="corriente" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="corriente Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{corriente}}"/>
|
||||
<rtl:input-variable name="de1a30" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="de1a30 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{de1a30}}"/>
|
||||
<rtl:input-variable name="de31a60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="de31a60 Value" width="0.72inch" anchorX="1" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{de31a60}}"/>
|
||||
<rtl:input-variable name="de61a90" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="de61a90 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{de61a90}}"/>
|
||||
<rtl:input-variable name="masde90" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="masde90 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{masde90}}"/>
|
||||
<rtl:input-variable name="x.pendiente" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="x.pendiente Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{x.pendiente}}"/>
|
||||
</MINIPAGE>
|
||||
<LAYOUTNODE name="EncabezadoDetalle" width="min" length="min" fontSize="8" fontBold="true" layoutDirection="leftToRight" floatingBehavior="enclosed" roundedCorners="true" borderWidth="1" borderStyle="solid">
|
||||
<WORDBOX name="WordBox3" width="2.7cm" floatingBehavior="enclosed" text="VENDEDOR"/>
|
||||
<WORDBOX name="WordBox11" width="3cm" alignment="baseline" floatingBehavior="enclosed" text="Documento"/>
|
||||
<WORDBOX name="WordBox10" width="2.2inch" alignment="baseline" floatingBehavior="enclosed" text="Cliente"/>
|
||||
<WORDBOX name="WordBox9" width=".8inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="Aplicacion"/>
|
||||
<WORDBOX name="WordBox4" width="5cm" floatingBehavior="enclosed" textAlignment="right" text="VALOR ORIGINAL"/>
|
||||
</LAYOUTNODE>
|
||||
<rtl:match name="Group equipos" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<MINIPAGE name="GequipoVentas" width="180" length="15">
|
||||
<rtl:input-variable name="zdatos.equipos" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="yequipo_Ventas Value" width="width("M")*20" alignment="baseline" floatingBehavior="enclosed" text="{{zdatos.equipos}}"/>
|
||||
<rtl:match name="Group vendedor" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<rtl:match name="Group num_doc" nameConstraint="Group" minOccurs="0" maxOccurs="unbounded">
|
||||
<rtl:match name="OnEveryRow" nameConstraint="OnEveryRow" minOccurs="0" maxOccurs="unbounded">
|
||||
<LAYOUTNODE name="Gvenedores" width="max" length="max" fontSize="8" layoutDirection="leftToRight" floatingBehavior="enclosed">
|
||||
<rtl:input-variable name="zdatos.vendedor" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="yVendedor Value" width="1.5inch" floatingBehavior="enclosed" text="{{zdatos.vendedor}}" textAlignment="left"/>
|
||||
<rtl:input-variable name="zdatos.tipo_doc" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDBOX name="zdatos.tipo_doc Value" width=".5inch" alignment="baseline" floatingBehavior="enclosed" text="{{zdatos.tipo_doc}}"/>
|
||||
<rtl:input-variable name="zdatos.num_doc" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="zdatos.num_doc Value" width=".6inch" anchorX="1" alignment="baseline" floatingBehavior="enclosed" textAlignment="left" format="----------#" value="{{zdatos.num_doc}}"/>
|
||||
<rtl:input-variable name="zdatos.cliente" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="zdatos.cliente Value" width="width("M")*35" alignment="baseline" fontSize="8" floatingBehavior="enclosed" text="{{zdatos.cliente}}"/>
|
||||
<rtl:input-variable name="zdatos.tipo_apl" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDBOX name="zdatos.tipo_apl Value" width=".5cm" alignment="baseline" floatingBehavior="enclosed" text="{{zdatos.tipo_apl}}"/>
|
||||
<rtl:input-variable name="zreferencia" type="FGLString" expectedLocation="expectedHere"/>
|
||||
<WORDWRAPBOX name="zreferencia Value" width=".5inch" alignment="baseline" floatingBehavior="enclosed" text="{{zreferencia}}" textAlignment="left"/>
|
||||
<rtl:input-variable name="zdatos.valor" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="yvalor_orig Value" width=".6inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{zdatos.valor}}"/>
|
||||
</LAYOUTNODE>
|
||||
</rtl:match>
|
||||
<rtl:input-variable name="zdatos.tipo_doc" type="FGLString" expectedLocation="expectedBefore"/>
|
||||
<LAYOUTNODE name="TotalDocumento" rtl:condition="zdatos.tipo_doc!="AV"&&zdatos.tipo_doc!="NC"" width="max" length="max" fontSize="8" fontBold="true" layoutDirection="leftToRight" floatingBehavior="enclosed" roundedCorners="true" borderWidth="1" borderStyle="solid">
|
||||
<rtl:input-variable name="zdatos.num_doc" type="FGLNumeric" expectedLocation="expectedBefore"/>
|
||||
<WORDBOX name="WordBox" width="3.8inch" alignment="baseline" floatingBehavior="enclosed" text="{{"Total "+zdatos.num_doc.format("<<<<<<<<")}}"/>
|
||||
<rtl:input-variable name="total2" type="FGLNumeric" expectedLocation="expectedBefore"/>
|
||||
<DECIMALFORMATBOX name="total2 Value" width="3.3inch" anchorX="1" alignment="baseline" fontBold="true" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{total2}}" roundedCorners="false" borderWidth="1" borderStyle="none"/>
|
||||
</LAYOUTNODE>
|
||||
</rtl:match>
|
||||
<LAYOUTNODE name="TotalVendedor" width="max" length="max" bgColor="#c8c8c8" fontSize="8" fontBold="true" layoutDirection="leftToRight" floatingBehavior="enclosed" roundedCorners="false" borderWidth="1" borderStyle="none">
|
||||
<rtl:input-variable name="zdatos.vendedor" type="FGLString" expectedLocation="expectedBefore"/>
|
||||
<WORDBOX name="WordBox12" width="3.8inch" alignment="baseline" floatingBehavior="enclosed" text="{{"Total "+zdatos.vendedor}}"/>
|
||||
<rtl:input-variable name="etotal1" type="FGLNumeric" expectedLocation="expectedBefore"/>
|
||||
<DECIMALFORMATBOX name="etotal1 Value" width="3.3inch" anchorX="1" alignment="baseline" bgColor="#c8c8c8" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{etotal1}}" roundedCorners="false" borderWidth="1" borderStyle="none"/>
|
||||
</LAYOUTNODE>
|
||||
</rtl:match>
|
||||
<MINIPAGE name="Tot.cliente" width="min" length="7.5inch" fontSize="7" fontBold="true" layoutDirection="leftToRight" borderWidth="0.1" borderStyle="solid">
|
||||
<WORDBOX name="WordBox10" width="3.14inch" floatingBehavior="enclosed" textAlignment="right" text="Total Cliente: "/>
|
||||
<rtl:input-variable name="tcte" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tcte Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tcte}}"/>
|
||||
<rtl:input-variable name="t30" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="t30 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{t30}}"/>
|
||||
<rtl:input-variable name="t45" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="t45 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{t45}}"/>
|
||||
<rtl:input-variable name="t60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="t60 Value" width="0.72inch" anchorX="1" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{t60}}"/>
|
||||
<rtl:input-variable name="tm60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tm60 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tm60}}"/>
|
||||
<rtl:input-variable name="tsaldo" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tsaldo Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tsaldo}}"/>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
<MINIPAGE name="Tot.vendedor" width="min" length="7.5inch" alignment="near" fontSize="7" fontBold="true" layoutDirection="leftToRight" borderWidth="0.5" borderStyle="solid">
|
||||
<WORDBOX name="WordBox11" width="3.14inch" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" text="Total Vendedor: "/>
|
||||
<rtl:input-variable name="ttcte" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ttcte Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{ttcte}}"/>
|
||||
<rtl:input-variable name="tt30" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tt30 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tt30}}"/>
|
||||
<rtl:input-variable name="tt45" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tt45 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tt45}}"/>
|
||||
<rtl:input-variable name="tt60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tt60 Value" width="0.72inch" anchorX="1" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tt60}}"/>
|
||||
<rtl:input-variable name="ttm60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ttm60 Value" width="0.72inch" anchorX="1" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{ttm60}}"/>
|
||||
<rtl:input-variable name="ttsaldo" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ttsaldo Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{ttsaldo}}"/>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
<MINIPAGE name="Totales.generales" width="min" length="7.5inch" fontSize="7" fontBold="true" layoutDirection="leftToRight" borderWidth="0.1" borderStyle="solid">
|
||||
<WORDBOX name="WordBox12" width="3.14inch" floatingBehavior="enclosed" textAlignment="right" text="Totales Generales:"/>
|
||||
<rtl:input-variable name="ttcte" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ttcte Value1" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{ttcte}}"/>
|
||||
<rtl:input-variable name="ttt30" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ttt30 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{ttt30}}"/>
|
||||
<rtl:input-variable name="ttt45" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ttt45 Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{ttt45}}"/>
|
||||
<rtl:input-variable name="ttt60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="ttt60 Value" width="0.72inch" anchorX="1" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{ttt60}}"/>
|
||||
<rtl:input-variable name="tttm60" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tttm60 Value" width="0.72inch" anchorX="1" alignment="baseline" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tttm60}}"/>
|
||||
<rtl:input-variable name="tttsaldo" type="FGLNumeric" expectedLocation="expectedHere"/>
|
||||
<DECIMALFORMATBOX name="tttsaldo Value" width="0.72inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{tttsaldo}}"/>
|
||||
</MINIPAGE>
|
||||
<LAYOUTNODE name="totales" width="min" length="min" fontSize="8" fontBold="true" layoutDirection="leftToRight" floatingBehavior="enclosed" roundedCorners="true" borderWidth="1" borderStyle="solid">
|
||||
<WORDBOX name="WordBox6" width="4inch" floatingBehavior="enclosed" text="TOTAL"/>
|
||||
<rtl:input-variable name="total_general1" type="FGLNumeric" expectedLocation="expectedBefore"/>
|
||||
<DECIMALFORMATBOX name="total_general1 Value" width="3.2inch" anchorX="1" floatingBehavior="enclosed" textAlignment="right" format="---,---,---,--&.&&" value="{{total_general1}}"/>
|
||||
</LAYOUTNODE>
|
||||
</MINIPAGE>
|
||||
</rtl:match>
|
||||
</PXML>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SemillaModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<valor>WwW0VXsgqcEZbOUMnVD20kgn+7/K40O9Ms5zZEGSzf7SikTV6wAEHjdzDEVwLKJIAPKFe9rp3MfPi7xnv40mu2980EsrpRTmllVIaTOE0KeeBoZekOGC1Tn18R+JuHetNBAchOdWIGpk6LRkEp0yQA==</valor>
|
||||
<fecha>2026-07-16T10:42:51.0668064-04:00</fecha>
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
||||
<SignedInfo>
|
||||
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
|
||||
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
|
||||
<Reference URI="">
|
||||
<Transforms>
|
||||
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
|
||||
</Transforms>
|
||||
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
|
||||
<DigestValue>k9ci+rdnRRpaPe2vZCrPGdlMXuTNtEdV3IRbSCIuuPw=</DigestValue>
|
||||
</Reference>
|
||||
</SignedInfo>
|
||||
<SignatureValue>Ut48SQO6/VuztmFtDFgReAN6xLxrX29XK49U0nIybLvk3c+ps6b8VAHIBkSI/zdy+8YzLszlHGn0WIQAp661HS1kZ1ZSXaZ8nSri1Zl8HyB8ArvCHJqmaBgwnkxVoX+T5OgEqbDHtsBRc0keq88xLF5UcFG1dEcMlvmiM6wTHhj6JSTgTYjtAy3oDdgniO/JLc/iDVJqwAiZEwCkYmayo9uBxv+Jz+IuLhsqrt6dFJHfBEJZA3jyMBNMdSriE1LbVyGcjpFCb482r7Sr5w+ngt8mtrA2cT5QP949lHiRpvbgvkiStF2X8urB4Vgs1UTNV/d/0zOsucUpfdPBJY+KGA==</SignatureValue>
|
||||
<KeyInfo>
|
||||
<X509Data>
|
||||
<X509Certificate>MIIJgDCCB2igAwIBAgIILvImiGW0S1gwDQYJKoZIhvcNAQELBQAwgbgxFzAVBgNVBGEMDlZBVERPLTQwMTAyMzY4MSMwIQYDVQQDDBpkaWdpZmlybWEgQ0EgU3Vib3JkaW5hZGEgMTESMBAGA1UECwwJZGlnaWZpcm1hMTswOQYDVQQKDDJDw6FtYXJhIGRlIENvbWVyY2lvIHkgUHJvZHVjY2nDs24gZGUgU2FudG8gRG9taW5nbzEaMBgGA1UEBwwRRGlzdHJpdG8gTmFjaW9uYWwxCzAJBgNVBAYTAkRPMB4XDTI1MDkwMzE1MDcwMFoXDTI3MDkwMzE1MDcwMFowgbYxOzA5BgNVBAkMMkNBTExFIENFTlRSQUwgTUFEUkVWSUVKQSBOT1JURSwwOTAxMCxTYW4gQ3Jpc3RvYmFsMSEwHwYDVQQDDBhKT1JHRSBSSUNBUkRPIFNVQkVSTyBJU0ExGjAYBgNVBAUTEUlEQ0RPLTAxMzAwMDQ4NjY1MRYwFAYDVQQqDA1KT1JHRSBSSUNBUkRPMRMwEQYDVQQEDApTVUJFUk8gSVNBMQswCQYDVQQGEwJETzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJDFW87AVh9FknnJSlXpHVzRnuS5hzcQlpXVweQvVxEAXksq6i2bX7UCrS6RFOyR1fm59daQuxyk3Ralk4StBMUXg1fpVe1WWi4+rDccIHtRf+SvC7bhCAITk6kUnWGLs03ZrAIxWmQQtQCF8KMIVhSqIGnKRR3UzKq0s9Mi/yBSkvLobuSUDJFpV80cdt17eww9BiHEMnyoedHJ+Dd/11UAFehnhNhzNvIJwdWu2TZO2SAKPmAHc2oZwHkCz0laQAbWwrq2vEXQ55Hw8mclhE3c/zqUjn/KDlmfXaTK2gilvGPnFjQqIR7PeXD9WfKMQZDDcJr9w59o+lGL7NNbHJkCAwEAAaOCBIwwggSIMHoGCCsGAQUFBwEDBG4wbDAIBgYEAI5GAQEwCwYGBACORgEDAgEUMAgGBgQAjkYBBDA0BgYEAI5GAQUwKjAoFiJodHRwczovL2Rwcy5jYW1hcmFzYW50b2RvbWluZ28uZG8vEwJFTjATBgYEAI5GAQYwCQYHBACORgEGATCB3AYIKwYBBQUHAQEEgc8wgcwwSAYIKwYBBQUHMAKGPGh0dHBzOi8vd3d3LmNhbWFyYXNhbnRvZG9taW5nby5kby9kaWdpZmlybWEvQ0NQU0RfY2FkZW5hLmNydDA/BggrBgEFBQcwAYYzaHR0cDovL29jc3AxLmNhbWFyYXNhbnRvZG9taW5nby5kby9wdWJsaWMvcGtpL29jc3AvMD8GCCsGAQUFBzABhjNodHRwOi8vb2NzcDIuY2FtYXJhc2FudG9kb21pbmdvLmRvL3B1YmxpYy9wa2kvb2NzcC8wHQYDVR0OBBYEFFdrvC9iM4+tPDIWPR+/gnqvDeTdMB8GA1UdIwQYMBaAFM7rpVkdIemjmSWnCkqsx5WQBhELMCoGA1UdEgQjMCGBH2RpZ2lmaXJtYUBjYW1hcmFzYW50b2RvbWluZ28uZG8wggHZBgNVHSAEggHQMIIBzDAJBgcEAIvsQAEAMIIBvQYLKwYBBAGBzHwBAwEwggGsMC4GCCsGAQUFBwIBFiJodHRwczovL2Nwcy5jYW1hcmFzYW50b2RvbWluZ28uZG8vMIIBeAYIKwYBBQUHAgIwggFqHoIBZgBDAGUAcgB0AGkAZgBpAGMAYQBkAG8AIABwAGEAcgBhACAAcAByAG8AYwBlAGQAaQBtAGkAZQBuAHQAbwBzACAAdAByAGkAYgB1AHQAYQByAGkAbwBzACAAZQBuACAAcAAxADIAIABlAG0AaQB0AGkAZABvACAAcABvAHIAIABDAEMAUABTAEQALAAgAHUAYgBpAGMAYQBkAG8AIABBAHYAZQAuACAAMgA3ACAAZABlACAAZgBlAGIAcgBlAHIAbwAgAGUAcwBxACAAdABpAHIAYQBkAGUAbgB0AGUAcwAgADIAMgA4ACAAdABvAHIAcgBlACAAZgByAGkAdQBzAGEALAAgAEwAYQAgAEUAcwBwAGUAcgBpAGwAbABhACwAIABTAGEAbgB0AG8AIABEAG8AbQBpAG4AZwBvACwAIABSAGUAcAD6AGIAbABpAGMAYQAgAEQAbwBtAGkAbgBpAGMAYQBuAGEwgY8GA1UdHwSBhzCBhDBAoD6gPIY6aHR0cDovL2NybDEuY2FtYXJhc2FudG9kb21pbmdvLmRvL3B1YmxpYy9wa2kvY3JsL0NDUFNELmNybDBAoD6gPIY6aHR0cDovL2NybDIuY2FtYXJhc2FudG9kb21pbmdvLmRvL3B1YmxpYy9wa2kvY3JsL0NDUFNELmNybDAOBgNVHQ8BAf8EBAMCBeAwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMCEGA1UdEQQaMBiBFmpzb3RvQG1hcm1vdGVjaC5jb20uZG8wDQYJKoZIhvcNAQELBQADggIBAIiGfGfXGgO5zHP5BkVKAUHMkKrUP7G3ohexFPp53Io1WbdL3L7oE8EtArLQyySdWr+0Yxb/6VE74krBUb+RhpghKlIhOTqsJvOL8Bdo3prI23hZWi2A4wHZn99W3pISBU2PE8QTodoaR0yOpIgqyYCIZmgHGSExFymDHp8iwfqxSS3HWnXgK5eI5iU/Zisl9bPBhHrFR1j9WjnZTx7IxocGmvd/efn26dJ3MgTP/TUx0P7jatukcTUazl6N9Ht/rHFBSan9vzG+rgSPRvT/flIRhSJyUvVuBGv1+NJWy5R1HoazlVO0cR4QB+U3nvg6E1j0ceccybWjIowA38pU/YpI81UVXSl0dbtwrFPrRmMzfnvMATX8H1NrOb98cLlIss9U1yWQxdyTes4mItBTYjA0K0ESUFGKL3ZputaM7KDW85kWkjXQj/TJP4DClyzO4SjVx9ZFqSkz+yFzlvbfTU7clVshJHYxlmuO+nou19+2l7SPHz2UaikU4JAmdn9bNIypte31BF30rahUywK6ePT1nQ5xL1tSIe2m9BtyG/45yiHobm7kljEeBl4EzkY2mFEp84cH4s28BbRF/S2p8xkGFqNtDKa+DwcWd97IG+62en+/2vE75a9KRUxneW8Ipl6P/e5moXyLYLZS0lMGShBom8cTYdLFFRAPbksXIa5U</X509Certificate>
|
||||
</X509Data>
|
||||
</KeyInfo>
|
||||
</Signature>
|
||||
</SemillaModel>
|
||||
@@ -1,32 +0,0 @@
|
||||
// check_cert_match.js
|
||||
const fs = require('fs');
|
||||
const crypto = require('crypto');
|
||||
|
||||
function pemToDer(pem) {
|
||||
return Buffer.from(
|
||||
pem.replace(/-----BEGIN CERTIFICATE-----/g, '')
|
||||
.replace(/-----END CERTIFICATE-----/g, '')
|
||||
.replace(/\s+/g, ''),
|
||||
'base64'
|
||||
);
|
||||
}
|
||||
|
||||
function sha1Fingerprint(der) {
|
||||
return crypto.createHash('sha1').update(der).digest('hex').toUpperCase().match(/.{2}/g).join(':');
|
||||
}
|
||||
|
||||
// 1) Cert PEM que usa FourJs (el mismo con el que te funciona): p.ej. .\cert\marmotech\onlyCert.pem
|
||||
const certPemFour = fs.readFileSync('.\\onlyCert.pem', 'utf8');
|
||||
const fpFour = sha1Fingerprint(pemToDer(certPemFour));
|
||||
console.log('Fingerprint PEM:', fpFour);
|
||||
|
||||
// 2) Extraer el cert del XML de FourJs (Signature.xml)
|
||||
const xml = fs.readFileSync('.\\Signature.xml', 'utf8');
|
||||
const m = xml.match(/<X509Certificate>([\s\S]*?)<\/X509Certificate>/i);
|
||||
if (!m) throw new Error('No se encontró <X509Certificate> en Signature.xml');
|
||||
const certFromXmlDer = Buffer.from(m[1].replace(/\s+/g, ''), 'base64');
|
||||
const fpXml = sha1Fingerprint(certFromXmlDer);
|
||||
console.log('Fingerprint en Signature.xml:', fpXml);
|
||||
|
||||
// Comparar
|
||||
console.log('¿Coinciden? ', fpFour === fpXml ? 'SÍ ✅' : 'NO ❌');
|
||||
@@ -1,25 +0,0 @@
|
||||
// compara_cert_ok_vs_pem.js
|
||||
const fs = require("fs");
|
||||
const crypto = require("crypto");
|
||||
|
||||
const pemToB64 = (pem) =>
|
||||
String(pem).replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----|\s+/g, "").trim();
|
||||
const b64ToDer = (b64) => Buffer.from(b64, "base64");
|
||||
const printInfo = (label, der) => {
|
||||
const sha1 = crypto.createHash("sha1").update(der).digest("hex");
|
||||
const sha256 = crypto.createHash("sha256").update(der).digest("hex");
|
||||
console.log(`[${label}] sha1=${sha1} sha256=${sha256}`);
|
||||
};
|
||||
|
||||
const xml = fs.readFileSync("Signature.xml", "utf8");
|
||||
const m = xml.match(/<X509Certificate>([^<]+)<\/X509Certificate>/i);
|
||||
if (!m) throw new Error("No se encontró <X509Certificate> en Signature.xml");
|
||||
const okB64 = m[1].replace(/\s+/g, "");
|
||||
const okDer = b64ToDer(okB64);
|
||||
|
||||
const pem = fs.readFileSync("onlyCert.pem", "utf8");
|
||||
const pemDer = b64ToDer(pemToB64(pem));
|
||||
|
||||
printInfo("DGII_OK", okDer);
|
||||
printInfo("NODE_PEM", pemDer);
|
||||
console.log("\n¿Mismo certificado?:", okDer.equals(pemDer));
|
||||
@@ -1,28 +0,0 @@
|
||||
// list_x509_from_signature.js
|
||||
const fs = require('fs');
|
||||
const { X509Certificate } = require('crypto');
|
||||
|
||||
const xml = fs.readFileSync('./Signature.xml', 'utf8'); // firmado por FourJs (válido en DGII)
|
||||
const certs = [...xml.matchAll(/<X509Certificate>([\s\S]*?)<\/X509Certificate>/gi)]
|
||||
.map(m => m[1].replace(/\s+/g, ''));
|
||||
|
||||
if (!certs.length) {
|
||||
console.error('No se encontraron bloques <X509Certificate> en Signature.xml');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
certs.forEach((b64, i) => {
|
||||
const pem = `-----BEGIN CERTIFICATE-----\n${b64.replace(/(.{64})/g,'$1\n')}\n-----END CERTIFICATE-----\n`;
|
||||
const x = new X509Certificate(pem);
|
||||
const sha1 = x.fingerprint.replace(/(..)(?=.)/g,'$1:'); // SHA1 fingerprint
|
||||
const sha256 = x.fingerprint256.replace(/(..)(?=.)/g,'$1:'); // SHA256 fingerprint
|
||||
const subject = x.subject; // "CN=..., O=..., C=..."
|
||||
const issuer = x.issuer;
|
||||
const isCA = x.ca; // boolean (true si es CA)
|
||||
console.log(`[#${i}] isCA=${isCA}`);
|
||||
console.log(` Subject : ${subject}`);
|
||||
console.log(` Issuer : ${issuer}`);
|
||||
console.log(` SHA1 : ${sha1}`);
|
||||
console.log(` SHA256 : ${sha256}`);
|
||||
console.log('---');
|
||||
});
|
||||
@@ -1,58 +0,0 @@
|
||||
{
|
||||
"name": "marmotech",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@xmldom/is-dom-node": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/is-dom-node/-/is-dom-node-1.0.1.tgz",
|
||||
"integrity": "sha512-CJDxIgE5I0FH+ttq/Fxy6nRpxP70+e2O048EPe85J2use3XKdatVM7dDVvFNjQudd9B49NPoZ+8PG49zj4Er8Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
}
|
||||
},
|
||||
"node_modules/@xmldom/xmldom": {
|
||||
"version": "0.8.10",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
|
||||
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-forge": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
|
||||
"integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
|
||||
"license": "(BSD-3-Clause OR GPL-2.0)",
|
||||
"engines": {
|
||||
"node": ">= 6.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xml-crypto": {
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-6.1.2.tgz",
|
||||
"integrity": "sha512-leBOVQdVi8FvPJrMYoum7Ici9qyxfE4kVi+AkpUoYCSXaQF4IlBm1cneTK9oAxR61LpYxTx7lNcsnBIeRpGW2w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@xmldom/is-dom-node": "^1.0.1",
|
||||
"@xmldom/xmldom": "^0.8.10",
|
||||
"xpath": "^0.0.33"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/xpath": {
|
||||
"version": "0.0.33",
|
||||
"resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.33.tgz",
|
||||
"integrity": "sha512-NNXnzrkDrAzalLhIUc01jO2mOzXGXh1JwPgkihcLLzw98c0WgYDmmjSh1Kl3wzaxSVWMuA+fe0WTWOBDWCBmNA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2023 Chris Barth
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,91 +0,0 @@
|
||||
# is-dom-node
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Description
|
||||
|
||||
`@xmldom/is-dom-node` is a versatile TypeScript library designed to provide robust utility functions for working with DOM nodes. Whether you're developing for the browser or dealing with XML in NodeJS, this library offers a comprehensive set of functions for checking and asserting various types of DOM nodes. It's particularly useful when working with NodeJS libraries like [xpath](https://www.npmjs.com/package/xpath) and [@xmldom/xmldom](https://www.npmjs.com/package/@xmldom/xmldom), as it can validate the objects returned by these libraries.
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
npm install @xmldom/is-dom-node
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Import the library and use it as follows:
|
||||
|
||||
```javascript
|
||||
import * as isDomNode from "@xmldom/is-dom-node";
|
||||
|
||||
const element = document.createElement("div");
|
||||
const result = isDomNode.isElementNode(element); // Output: true
|
||||
```
|
||||
|
||||
### TypeScript Example
|
||||
|
||||
```typescript
|
||||
import * as isDomNode from "@xmldom/is-dom-node";
|
||||
|
||||
function handleNode(node: Node) {
|
||||
if (isDomNode.isElementNode(node)) {
|
||||
// TypeScript now knows `node` is an Element
|
||||
console.log(node.tagName);
|
||||
} else if (isDomNode.isTextNode(node)) {
|
||||
// TypeScript now knows `node` is a Text node
|
||||
console.log(node.wholeText);
|
||||
} else {
|
||||
try {
|
||||
// Assert that the node is a Comment node
|
||||
isDomNode.assertIsCommentNode(node);
|
||||
// TypeScript now knows `node` is a Comment node
|
||||
console.log(node.nodeValue);
|
||||
} catch (error) {
|
||||
console.error("Node is not a Comment node:", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## API Overview
|
||||
|
||||
The API consists of two main types of functions:
|
||||
|
||||
### `is...` Functions
|
||||
|
||||
These functions return a boolean value indicating whether the given object meets certain criteria:
|
||||
|
||||
- `isNodeLike`: Checks if a given value resembles a DOM node.
|
||||
- `isArrayOfNodes`: Checks if the given value is an array of DOM nodes.
|
||||
- `isElementNode`, `isAttributeNode`, `isTextNode`, etc.: Check for specific types of DOM nodes.
|
||||
|
||||
### `assertIs...` Functions
|
||||
|
||||
These functions assert that a given object meets certain criteria and throw an error if it doesn't:
|
||||
|
||||
- `assertIsNodeLike`: Asserts that a given value is a DOM node.
|
||||
- `assertIsArrayOfNodes`: Asserts that the given value is an array of DOM nodes.
|
||||
- `assertIsElementNode`, `assertIsAttributeNode`, `assertIsTextNode`, etc.: Assert for specific types of DOM nodes.
|
||||
|
||||
### TypeScript Type Narrowing
|
||||
|
||||
Both the `is...` and `assertIs...` functions can be used for TypeScript type narrowing. After a successful check or assertion, TypeScript will recognize the specific type of the DOM node, allowing for more robust and error-free code.
|
||||
|
||||
## Features
|
||||
|
||||
- Lightweight
|
||||
- Written in TypeScript
|
||||
- Comprehensive tests
|
||||
- Compatible with NodeJS XML libraries like `xpath` and `@xmldom/xmldom`
|
||||
|
||||
## Contributing
|
||||
|
||||
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
|
||||
@@ -1,33 +0,0 @@
|
||||
export declare enum NodeTypes {
|
||||
ELEMENT_NODE = 1,
|
||||
ATTRIBUTE_NODE = 2,
|
||||
TEXT_NODE = 3,
|
||||
CDATA_SECTION_NODE = 4,
|
||||
PROCESSING_INSTRUCTION_NODE = 7,
|
||||
COMMENT_NODE = 8,
|
||||
DOCUMENT_NODE = 9,
|
||||
DOCUMENT_TYPE_NODE = 10,
|
||||
DOCUMENT_FRAGMENT_NODE = 11
|
||||
}
|
||||
export declare function isNodeLike(value: any): value is Node;
|
||||
export declare function assertIsNodeLike(value: unknown): asserts value is Node;
|
||||
export declare function isArrayOfNodes(value: unknown): value is Node[];
|
||||
export declare function assertIsArrayOfNodes(value: unknown): asserts value is Node[];
|
||||
export declare const isElementNode: (value: unknown) => value is Element;
|
||||
export declare const isAttributeNode: (value: unknown) => value is Attr;
|
||||
export declare const isTextNode: (value: unknown) => value is Text;
|
||||
export declare const isCDATASectionNode: (value: unknown) => value is CDATASection;
|
||||
export declare const isProcessingInstructionNode: (value: unknown) => value is ProcessingInstruction;
|
||||
export declare const isCommentNode: (value: unknown) => value is Comment;
|
||||
export declare const isDocumentNode: (value: unknown) => value is Document;
|
||||
export declare const isDocumentTypeNode: (value: unknown) => value is DocumentType;
|
||||
export declare const isDocumentFragmentNode: (value: unknown) => value is DocumentFragment;
|
||||
export declare const assertIsElementNode: (value: unknown) => asserts value is Element;
|
||||
export declare const assertIsAttributeNode: (value: unknown) => asserts value is Attr;
|
||||
export declare const assertIsTextNode: (value: unknown) => asserts value is Text;
|
||||
export declare const assertIsCDATASectionNode: (value: unknown) => asserts value is CDATASection;
|
||||
export declare const assertIsProcessingInstructionNode: (value: unknown) => asserts value is ProcessingInstruction;
|
||||
export declare const assertIsCommentNode: (value: unknown) => asserts value is Comment;
|
||||
export declare const assertIsDocumentNode: (value: unknown) => asserts value is Document;
|
||||
export declare const assertIsDocumentTypeNode: (value: unknown) => asserts value is DocumentType;
|
||||
export declare const assertIsDocumentFragmentNode: (value: unknown) => asserts value is DocumentFragment;
|
||||
@@ -1,91 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.assertIsDocumentFragmentNode = exports.assertIsDocumentTypeNode = exports.assertIsDocumentNode = exports.assertIsCommentNode = exports.assertIsProcessingInstructionNode = exports.assertIsCDATASectionNode = exports.assertIsTextNode = exports.assertIsAttributeNode = exports.assertIsElementNode = exports.isDocumentFragmentNode = exports.isDocumentTypeNode = exports.isDocumentNode = exports.isCommentNode = exports.isProcessingInstructionNode = exports.isCDATASectionNode = exports.isTextNode = exports.isAttributeNode = exports.isElementNode = exports.assertIsArrayOfNodes = exports.isArrayOfNodes = exports.assertIsNodeLike = exports.isNodeLike = exports.NodeTypes = void 0;
|
||||
var NodeTypes;
|
||||
(function (NodeTypes) {
|
||||
NodeTypes[NodeTypes["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
|
||||
NodeTypes[NodeTypes["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
|
||||
NodeTypes[NodeTypes["TEXT_NODE"] = 3] = "TEXT_NODE";
|
||||
NodeTypes[NodeTypes["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
|
||||
NodeTypes[NodeTypes["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
|
||||
NodeTypes[NodeTypes["COMMENT_NODE"] = 8] = "COMMENT_NODE";
|
||||
NodeTypes[NodeTypes["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
|
||||
NodeTypes[NodeTypes["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
|
||||
NodeTypes[NodeTypes["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
|
||||
})(NodeTypes || (exports.NodeTypes = NodeTypes = {}));
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function isNodeLike(value) {
|
||||
return (value &&
|
||||
typeof value === "object" &&
|
||||
Number.isInteger(value.nodeType) &&
|
||||
value.nodeType >= 1 &&
|
||||
value.nodeType <= 11 &&
|
||||
typeof value.nodeName === "string" &&
|
||||
typeof value.appendChild === "function" &&
|
||||
typeof value.removeChild === "function");
|
||||
}
|
||||
exports.isNodeLike = isNodeLike;
|
||||
function assertIsNodeLike(value) {
|
||||
if (!isNodeLike(value)) {
|
||||
throw new Error(`Value is not a Node-like object. Received: ${value}`);
|
||||
}
|
||||
}
|
||||
exports.assertIsNodeLike = assertIsNodeLike;
|
||||
function isArrayOfNodes(value) {
|
||||
return Array.isArray(value) && value.every(isNodeLike);
|
||||
}
|
||||
exports.isArrayOfNodes = isArrayOfNodes;
|
||||
function assertIsArrayOfNodes(value) {
|
||||
if (!isArrayOfNodes(value)) {
|
||||
throw new Error("Value is not an array of Nodes");
|
||||
}
|
||||
}
|
||||
exports.assertIsArrayOfNodes = assertIsArrayOfNodes;
|
||||
function isNodeOfType(type, value) {
|
||||
return isNodeLike(value) && value.nodeType === type;
|
||||
}
|
||||
function assertIsNodeOfType(type, value) {
|
||||
const typeName = Object.keys(NodeTypes).find((key) => NodeTypes[key] === type);
|
||||
if (!isNodeOfType(type, value)) {
|
||||
throw new Error(`Value is not of type ${typeName}`);
|
||||
}
|
||||
}
|
||||
const isElementNode = (value) => isNodeOfType(NodeTypes.ELEMENT_NODE, value);
|
||||
exports.isElementNode = isElementNode;
|
||||
const isAttributeNode = (value) => isNodeOfType(NodeTypes.ATTRIBUTE_NODE, value);
|
||||
exports.isAttributeNode = isAttributeNode;
|
||||
const isTextNode = (value) => isNodeOfType(NodeTypes.TEXT_NODE, value);
|
||||
exports.isTextNode = isTextNode;
|
||||
const isCDATASectionNode = (value) => isNodeOfType(NodeTypes.CDATA_SECTION_NODE, value);
|
||||
exports.isCDATASectionNode = isCDATASectionNode;
|
||||
const isProcessingInstructionNode = (value) => isNodeOfType(NodeTypes.PROCESSING_INSTRUCTION_NODE, value);
|
||||
exports.isProcessingInstructionNode = isProcessingInstructionNode;
|
||||
const isCommentNode = (value) => isNodeOfType(NodeTypes.COMMENT_NODE, value);
|
||||
exports.isCommentNode = isCommentNode;
|
||||
const isDocumentNode = (value) => isNodeOfType(NodeTypes.DOCUMENT_NODE, value);
|
||||
exports.isDocumentNode = isDocumentNode;
|
||||
const isDocumentTypeNode = (value) => isNodeOfType(NodeTypes.DOCUMENT_TYPE_NODE, value);
|
||||
exports.isDocumentTypeNode = isDocumentTypeNode;
|
||||
const isDocumentFragmentNode = (value) => isNodeOfType(NodeTypes.DOCUMENT_FRAGMENT_NODE, value);
|
||||
exports.isDocumentFragmentNode = isDocumentFragmentNode;
|
||||
const assertIsElementNode = (value) => {
|
||||
assertIsNodeOfType(NodeTypes.ELEMENT_NODE, value);
|
||||
};
|
||||
exports.assertIsElementNode = assertIsElementNode;
|
||||
const assertIsAttributeNode = (value) => assertIsNodeOfType(NodeTypes.ATTRIBUTE_NODE, value);
|
||||
exports.assertIsAttributeNode = assertIsAttributeNode;
|
||||
const assertIsTextNode = (value) => assertIsNodeOfType(NodeTypes.TEXT_NODE, value);
|
||||
exports.assertIsTextNode = assertIsTextNode;
|
||||
const assertIsCDATASectionNode = (value) => assertIsNodeOfType(NodeTypes.CDATA_SECTION_NODE, value);
|
||||
exports.assertIsCDATASectionNode = assertIsCDATASectionNode;
|
||||
const assertIsProcessingInstructionNode = (value) => assertIsNodeOfType(NodeTypes.PROCESSING_INSTRUCTION_NODE, value);
|
||||
exports.assertIsProcessingInstructionNode = assertIsProcessingInstructionNode;
|
||||
const assertIsCommentNode = (value) => assertIsNodeOfType(NodeTypes.COMMENT_NODE, value);
|
||||
exports.assertIsCommentNode = assertIsCommentNode;
|
||||
const assertIsDocumentNode = (value) => assertIsNodeOfType(NodeTypes.DOCUMENT_NODE, value);
|
||||
exports.assertIsDocumentNode = assertIsDocumentNode;
|
||||
const assertIsDocumentTypeNode = (value) => assertIsNodeOfType(NodeTypes.DOCUMENT_TYPE_NODE, value);
|
||||
exports.assertIsDocumentTypeNode = assertIsDocumentTypeNode;
|
||||
const assertIsDocumentFragmentNode = (value) => assertIsNodeOfType(NodeTypes.DOCUMENT_FRAGMENT_NODE, value);
|
||||
exports.assertIsDocumentFragmentNode = assertIsDocumentFragmentNode;
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"name": "@xmldom/is-dom-node",
|
||||
"version": "1.0.1",
|
||||
"description": "TypeScript helper functions to narrow the type of object to a Node descendant",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"changelog": "gren changelog --override --generate --head main",
|
||||
"lint": "eslint \"{src,test}/*.ts\" --cache && npm run prettier-check",
|
||||
"lint:fix": "eslint --fix \"{src,test}/*.ts\" && npm run prettier-format",
|
||||
"prepare": "tsc",
|
||||
"prettier-check": "prettier --config .prettierrc.json --check .",
|
||||
"prettier-format": "prettier --config .prettierrc.json --write .",
|
||||
"prerelease": "git clean -xfd && npm ci && npm run lint && npm test && npm run build",
|
||||
"release": "release-it",
|
||||
"update:major": "npx npm-check-updates -i",
|
||||
"tsc": "tsc",
|
||||
"update:minor": "npx npm-check-updates -i -t minor",
|
||||
"test": "npm run tsc && nyc mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/xmldom/is-dom-node.git"
|
||||
},
|
||||
"keywords": [
|
||||
"dom",
|
||||
"node",
|
||||
"typescript",
|
||||
"narrow",
|
||||
"guard"
|
||||
],
|
||||
"author": "Chris Barth <chrisjbarth@hotmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/xmldom/is-dom-node/issues"
|
||||
},
|
||||
"homepage": "https://github.com/xmldom/is-dom-node#readme",
|
||||
"files": [
|
||||
"dist/"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@cjbarth/github-release-notes": "^4.2.0",
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||
"@types/jsdom": "^21.1.2",
|
||||
"@types/mocha": "^10.0.2",
|
||||
"@types/node": "^16.18.58",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||
"@typescript-eslint/parser": "^6.7.5",
|
||||
"@xmldom/xmldom": "^0.8.10",
|
||||
"choma": "^1.2.1",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-deprecation": "^2.0.0",
|
||||
"jsdom": "^22.1.0",
|
||||
"mocha": "^10.2.0",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^3.0.3",
|
||||
"prettier-plugin-packagejson": "^2.4.6",
|
||||
"release-it": "^16.2.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -1,459 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.8.10](https://github.com/xmldom/xmldom/compare/0.8.9...0.8.10)
|
||||
|
||||
### Fixed
|
||||
|
||||
- dom: prevent iteration over deleted items [`#514`](https://github.com/xmldom/xmldom/pull/514)/ [`#499`](https://github.com/xmldom/xmldom/issues/499)
|
||||
|
||||
Thank you, [@qtow](https://github.com/qtow), for your contributions
|
||||
|
||||
|
||||
## [0.8.9](https://github.com/xmldom/xmldom/compare/0.8.8...0.8.9)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Set nodeName property in ProcessingInstruction [`#509`](https://github.com/xmldom/xmldom/pull/509) / [`#505`](https://github.com/xmldom/xmldom/issues/505)
|
||||
|
||||
Thank you, [@cjbarth](https://github.com/cjbarth), for your contributions
|
||||
|
||||
|
||||
## [0.8.8](https://github.com/xmldom/xmldom/compare/0.8.7...0.8.8)
|
||||
|
||||
### Fixed
|
||||
|
||||
- extend list of HTML entities [`#489`](https://github.com/xmldom/xmldom/pull/489)
|
||||
|
||||
Thank you, [@zorkow](https://github.com/zorkow), for your contributions
|
||||
|
||||
## [0.8.7](https://github.com/xmldom/xmldom/compare/0.8.6...0.8.7)
|
||||
|
||||
### Fixed
|
||||
|
||||
- properly parse closing where the last attribute has no value [`#485`](https://github.com/xmldom/xmldom/pull/485) / [`#486`](https://github.com/xmldom/xmldom/issues/486)
|
||||
|
||||
Thank you, [@bulandent](https://github.com/bulandent), for your contributions
|
||||
|
||||
|
||||
## [0.7.10](https://github.com/xmldom/xmldom/compare/0.7.9...0.7.10)
|
||||
|
||||
### Fixed
|
||||
|
||||
- properly parse closing where the last attribute has no value [`#485`](https://github.com/xmldom/xmldom/pull/485) / [`#486`](https://github.com/xmldom/xmldom/issues/486)
|
||||
|
||||
Thank you, [@bulandent](https://github.com/bulandent), for your contributions
|
||||
|
||||
|
||||
## [0.8.6](https://github.com/xmldom/xmldom/compare/0.8.5...0.8.6)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Properly check nodes before replacement [`#457`](https://github.com/xmldom/xmldom/pull/457) / [`#455`](https://github.com/xmldom/xmldom/issues/455) / [`#456`](https://github.com/xmldom/xmldom/issues/456)
|
||||
|
||||
Thank you, [@edemaine](https://github.com/edemaine), [@pedro-l9](https://github.com/pedro-l9), for your contributions
|
||||
|
||||
|
||||
## [0.8.5](https://github.com/xmldom/xmldom/compare/0.8.4...0.8.5)
|
||||
|
||||
### Fixed
|
||||
|
||||
- fix: Restore ES5 compatibility [`#452`](https://github.com/xmldom/xmldom/pull/452) / [`#453`](https://github.com/xmldom/xmldom/issues/453)
|
||||
|
||||
Thank you, [@fengxinming](https://github.com/fengxinming), for your contributions
|
||||
|
||||
|
||||
## [0.8.4](https://github.com/xmldom/xmldom/compare/0.8.3...0.8.4)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Security: Prevent inserting DOM nodes when they are not well-formed [`CVE-2022-39353`](https://github.com/xmldom/xmldom/security/advisories/GHSA-crh6-fp67-6883)
|
||||
In case such a DOM would be created, the part that is not well-formed will be transformed into text nodes, in which xml specific characters like `<` and `>` are encoded accordingly.
|
||||
In the upcoming version 0.9.0 those text nodes will no longer be added and an error will be thrown instead.
|
||||
This change can break your code, if you relied on this behavior, e.g. multiple root elements in the past. We consider it more important to align with the specs that we want to be aligned with, considering the potential security issues that might derive from people not being aware of the difference in behavior.
|
||||
Related Spec: <https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity>
|
||||
|
||||
Thank you, [@frumioj](https://github.com/frumioj), [@cjbarth](https://github.com/cjbarth), [@markgollnick](https://github.com/markgollnick) for your contributions
|
||||
|
||||
|
||||
## [0.8.3](https://github.com/xmldom/xmldom/compare/0.8.3...0.8.2)
|
||||
|
||||
### Fixed
|
||||
- Avoid iterating over prototype properties [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
|
||||
|
||||
Thank you, [@Supraja9726](https://github.com/Supraja9726) for your contributions
|
||||
|
||||
|
||||
## [0.8.2](https://github.com/xmldom/xmldom/compare/0.8.1...0.8.2)
|
||||
|
||||
### Fixed
|
||||
- fix(dom): Serialize `>` as specified (#395) [`#58`](https://github.com/xmldom/xmldom/issues/58)
|
||||
|
||||
### Other
|
||||
- docs: Add `nodeType` values to public interface description [`#396`](https://github.com/xmldom/xmldom/pull/396)
|
||||
- test: Add executable examples for node and typescript [`#317`](https://github.com/xmldom/xmldom/pull/317)
|
||||
- fix(dom): Serialize `>` as specified [`#395`](https://github.com/xmldom/xmldom/pull/395)
|
||||
- chore: Add minimal `Object.assign` ponyfill [`#379`](https://github.com/xmldom/xmldom/pull/379)
|
||||
- docs: Refine release documentation [`#378`](https://github.com/xmldom/xmldom/pull/378)
|
||||
- chore: update various dev dependencies
|
||||
|
||||
Thank you [@niklasl](https://github.com/niklasl), [@cburatto](https://github.com/cburatto), [@SheetJSDev](https://github.com/SheetJSDev), [@pyrsmk](https://github.com/pyrsmk) for your contributions
|
||||
|
||||
## [0.8.1](https://github.com/xmldom/xmldom/compare/0.8.0...0.8.1)
|
||||
|
||||
### Fixes
|
||||
- Only use own properties in entityMap [`#374`](https://github.com/xmldom/xmldom/pull/374)
|
||||
|
||||
### Docs
|
||||
- Add security policy [`#365`](https://github.com/xmldom/xmldom/pull/365)
|
||||
- changelog: Correct contributor name and link [`#366`](https://github.com/xmldom/xmldom/pull/366)
|
||||
- Describe release/publish steps [`#358`](https://github.com/xmldom/xmldom/pull/358), [`#376`](https://github.com/xmldom/xmldom/pull/376)
|
||||
- Add snyk package health badge [`#360`](https://github.com/xmldom/xmldom/pull/360)
|
||||
|
||||
|
||||
## [0.8.0](https://github.com/xmldom/xmldom/compare/0.7.5...0.8.0)
|
||||
|
||||
### Fixed
|
||||
- Normalize all line endings according to XML specs [1.0](https://w3.org/TR/xml/#sec-line-ends) and [1.1](https://www.w3.org/TR/xml11/#sec-line-ends) \
|
||||
BREAKING CHANGE: Certain combination of line break characters are normalized to a single `\n` before parsing takes place and will no longer be preserved.
|
||||
- [`#303`](https://github.com/xmldom/xmldom/issues/303) / [`#307`](https://github.com/xmldom/xmldom/pull/307)
|
||||
- [`#49`](https://github.com/xmldom/xmldom/issues/49), [`#97`](https://github.com/xmldom/xmldom/issues/97), [`#324`](https://github.com/xmldom/xmldom/issues/324) / [`#314`](https://github.com/xmldom/xmldom/pull/314)
|
||||
- XMLSerializer: Preserve whitespace character references [`#284`](https://github.com/xmldom/xmldom/issues/284) / [`#310`](https://github.com/xmldom/xmldom/pull/310) \
|
||||
BREAKING CHANGE: If you relied on the not spec compliant preservation of literal `\t`, `\n` or `\r` in **attribute values**.
|
||||
To preserve those you will have to create XML that instead contains the correct numerical (or hexadecimal) equivalent (e.g. `	`, `
`, `
`).
|
||||
- Drop deprecated exports `DOMImplementation` and `XMLSerializer` from `lib/dom-parser.js` [#53](https://github.com/xmldom/xmldom/issues/53) / [`#309`](https://github.com/xmldom/xmldom/pull/309)
|
||||
BREAKING CHANGE: Use the one provided by the main package export.
|
||||
- dom: Remove all links as part of `removeChild` [`#343`](https://github.com/xmldom/xmldom/issues/343) / [`#355`](https://github.com/xmldom/xmldom/pull/355)
|
||||
|
||||
### Chore
|
||||
- ci: Restore latest tested node version to 16.x [`#325`](https://github.com/xmldom/xmldom/pull/325)
|
||||
- ci: Split test and lint steps into jobs [`#111`](https://github.com/xmldom/xmldom/issues/111) / [`#304`](https://github.com/xmldom/xmldom/pull/304)
|
||||
- Pinned and updated devDependencies
|
||||
|
||||
Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://github.com/victorandree), [@mdierolf](https://github.com/mdierolf), [@tsabbay](https://github.com/tsabbay), [@fatihpense](https://github.com/fatihpense) for your contributions
|
||||
|
||||
## 0.7.5
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.7.4...0.7.5)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Preserve default namespace when serializing [`#319`](https://github.com/xmldom/xmldom/issues/319) / [`#321`](https://github.com/xmldom/xmldom/pull/321)
|
||||
Thank you, [@lupestro](https://github.com/lupestro)
|
||||
|
||||
## 0.7.4
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.7.3...0.7.4)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Restore ability to parse `__prototype__` attributes [`#315`](https://github.com/xmldom/xmldom/pull/315)
|
||||
Thank you, [@dsimpsonOMF](https://github.com/dsimpsonOMF)
|
||||
|
||||
## 0.7.3
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.7.2...0.7.3)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Add doctype when parsing from string [`#277`](https://github.com/xmldom/xmldom/issues/277) / [`#301`](https://github.com/xmldom/xmldom/pull/301)
|
||||
- Correct typo in error message [`#294`](https://github.com/xmldom/xmldom/pull/294)
|
||||
Thank you, [@rrthomas](https://github.com/rrthomas)
|
||||
|
||||
### Refactor:
|
||||
|
||||
- Improve exports & require statements, new main package entry [`#233`](https://github.com/xmldom/xmldom/pull/233)
|
||||
|
||||
### Docs:
|
||||
|
||||
- Fix Stryker badge [`#298`](https://github.com/xmldom/xmldom/pull/298)
|
||||
- Fix link to help-wanted issues [`#299`](https://github.com/xmldom/xmldom/pull/299)
|
||||
|
||||
### Chore:
|
||||
|
||||
- Execute stryker:dry-run on branches [`#302`](https://github.com/xmldom/xmldom/pull/302)
|
||||
- Fix stryker config [`#300`](https://github.com/xmldom/xmldom/pull/300)
|
||||
- Split test and lint scripts [`#297`](https://github.com/xmldom/xmldom/pull/297)
|
||||
- Switch to stryker dashboard owned by org [`#292`](https://github.com/xmldom/xmldom/pull/292)
|
||||
|
||||
## 0.7.2
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.7.1...0.7.2)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Types: Add index.d.ts to packaged files [`#288`](https://github.com/xmldom/xmldom/pull/288)
|
||||
Thank you, [@forty](https://github.com/forty)
|
||||
|
||||
## 0.7.1
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.7.0...0.7.1)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Types: Copy types from DefinitelyTyped [`#283`](https://github.com/xmldom/xmldom/pull/283)
|
||||
Thank you, [@kachkaev](https://github.com/kachkaev)
|
||||
|
||||
### Chore:
|
||||
- package.json: remove author, maintainers, etc. [`#279`](https://github.com/xmldom/xmldom/pull/279)
|
||||
|
||||
## 0.7.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.6.0...0.7.0)
|
||||
|
||||
Due to [`#271`](https://github.com/xmldom/xmldom/issue/271) this version was published as
|
||||
- unscoped `xmldom` package to github (git tags [`0.7.0`](https://github.com/xmldom/xmldom/tree/0.7.0) and [`0.7.0+unscoped`](https://github.com/xmldom/xmldom/tree/0.7.0%2Bunscoped))
|
||||
- scoped `@xmldom/xmldom` package to npm (git tag `0.7.0+scoped`)
|
||||
For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issuecomment-902172483)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Security: Misinterpretation of malicious XML input [`CVE-2021-32796`](https://github.com/xmldom/xmldom/security/advisories/GHSA-5fg8-2547-mr8q)
|
||||
- Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you, [@ChALkeR](https://github.com/ChALkeR)
|
||||
- Inherit namespace prefix from parent when required [`#268`](https://github.com/xmldom/xmldom/pull/268)
|
||||
- Handle whitespace in closing tags [`#267`](https://github.com/xmldom/xmldom/pull/267)
|
||||
- Update `DOMImplementation` according to recent specs [`#210`](https://github.com/xmldom/xmldom/pull/210)
|
||||
BREAKING CHANGE: Only if you "passed features to be marked as available as a constructor arguments" and expected it to "magically work".
|
||||
- No longer serializes any namespaces with an empty URI [`#244`](https://github.com/xmldom/xmldom/pull/244)
|
||||
(related to [`#168`](https://github.com/xmldom/xmldom/pull/168) released in 0.6.0)
|
||||
BREAKING CHANGE: Only if you rely on ["unsetting" a namespace prefix](https://github.com/xmldom/xmldom/pull/168#issuecomment-886984994) by setting it to an empty string
|
||||
- Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you, [@rrthomas](https://github.com/rrthomas)
|
||||
|
||||
### CI
|
||||
|
||||
- We are now additionally running tests against node v16
|
||||
- Stryker tests on the master branch now run against node v14
|
||||
|
||||
### Docs
|
||||
|
||||
- Describe relations with and between specs: [`#211`](https://github.com/xmldom/xmldom/pull/211), [`#247`](https://github.com/xmldom/xmldom/pull/247)
|
||||
|
||||
## 0.6.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.5.0...0.6.0)
|
||||
|
||||
### Fixes
|
||||
|
||||
- Stop serializing empty namespace values like `xmlns:ds=""` [`#168`](https://github.com/xmldom/xmldom/pull/168)
|
||||
BREAKING CHANGE: If your code expected empty namespaces attributes to be serialized.
|
||||
Thank you, [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
|
||||
- Escape `<` to `<` when serializing attribute values [`#198`](https://github.com/xmldom/xmldom/issues/198) / [`#199`](https://github.com/xmldom/xmldom/pull/199)
|
||||
|
||||
## 0.5.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.4.0...0.5.0)
|
||||
|
||||
### Fixes
|
||||
- Avoid misinterpretation of malicious XML input - [`GHSA-h6q6-9hqw-rwfv`](https://github.com/xmldom/xmldom/security/advisories/GHSA-h6q6-9hqw-rwfv) (CVE-2021-21366)
|
||||
- Improve error reporting; throw on duplicate attribute\
|
||||
BREAKING CHANGE: It is currently not clear how to consistently deal with duplicate attributes, so it's also safer for our users to fail when detecting them.
|
||||
It's possible to configure the `DOMParser.errorHandler` before parsing, to handle those errors differently.
|
||||
|
||||
To accomplish this and also be able to verify it in tests I needed to
|
||||
- create a new `Error` type `ParseError` and export it
|
||||
- Throw `ParseError` from `errorHandler.fatalError` and prevent those from being caught in `XMLReader`.
|
||||
- export `DOMHandler` constructor as `__DOMHandler`
|
||||
- Preserve quotes in DOCTYPE declaration
|
||||
Since the only purpose of parsing the DOCTYPE is to be able to restore it when serializing, we decided that it would be best to leave the parsed `publicId` and `systemId` as is, including any quotes.
|
||||
BREAKING CHANGE: If somebody relies on the actual unquoted values of those ids, they will need to take care of either single or double quotes and the right escaping.
|
||||
(Without this change this would not have been possible because the SAX parser already dropped the information about the quotes that have been used in the source.)
|
||||
|
||||
https://www.w3.org/TR/2006/REC-xml11-20060816/#dtd
|
||||
https://www.w3.org/TR/2006/REC-xml11-20060816/#IDAX1KS (External Entity Declaration)
|
||||
|
||||
- Fix breaking preprocessors' directives when parsing attributes [`#171`](https://github.com/xmldom/xmldom/pull/171)
|
||||
- fix(dom): Escape `]]>` when serializing CharData [`#181`](https://github.com/xmldom/xmldom/pull/181)
|
||||
- Switch to (only) MIT license (drop problematic LGPL license option) [`#178`](https://github.com/xmldom/xmldom/pull/178)
|
||||
- Export DOMException; remove custom assertions; etc. [`#174`](https://github.com/xmldom/xmldom/pull/174)
|
||||
|
||||
### Docs
|
||||
- Update MDN links in `readme.md` [`#188`](https://github.com/xmldom/xmldom/pull/188)
|
||||
|
||||
## 0.4.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.3.0...0.4.0)
|
||||
|
||||
### Fixes
|
||||
- **BREAKING** Restore ` ` behavior from v0.1.27 [`#67`](https://github.com/xmldom/xmldom/pull/67)
|
||||
- **BREAKING** Typecheck source param before parsing [`#113`](https://github.com/xmldom/xmldom/pull/113)
|
||||
- Include documents in package files list [`#156`](https://github.com/xmldom/xmldom/pull/156)
|
||||
- Preserve doctype with sysid [`#144`](https://github.com/xmldom/xmldom/pull/144)
|
||||
- Remove ES6 syntax from getElementsByClassName [`#91`](https://github.com/xmldom/xmldom/pull/91)
|
||||
- Revert "Add lowercase of åäö in entityMap" due to duplicate entries [`#84`](https://github.com/xmldom/xmldom/pull/84)
|
||||
- fix: Convert all line separators to LF [`#66`](https://github.com/xmldom/xmldom/pull/66)
|
||||
|
||||
### Docs
|
||||
- Update CHANGELOG.md through version 0.3.0 [`#63`](https://github.com/xmldom/xmldom/pull/63)
|
||||
- Update badges [`#78`](https://github.com/xmldom/xmldom/pull/78)
|
||||
- Add .editorconfig file [`#104`](https://github.com/xmldom/xmldom/pull/104)
|
||||
- Add note about import [`#79`](https://github.com/xmldom/xmldom/pull/79)
|
||||
- Modernize & improve the example in readme.md [`#81`](https://github.com/xmldom/xmldom/pull/81)
|
||||
|
||||
### CI
|
||||
- Add Stryker Mutator [`#70`](https://github.com/xmldom/xmldom/pull/70)
|
||||
- Add Stryker action to update dashboard [`#77`](https://github.com/xmldom/xmldom/pull/77)
|
||||
- Add Node GitHub action workflow [`#64`](https://github.com/xmldom/xmldom/pull/64)
|
||||
- add & enable eslint [`#106`](https://github.com/xmldom/xmldom/pull/106)
|
||||
- Use eslint-plugin-es5 to enforce ES5 syntax [`#107`](https://github.com/xmldom/xmldom/pull/107)
|
||||
- Recover `vows` tests, drop `proof` tests [`#59`](https://github.com/xmldom/xmldom/pull/59)
|
||||
- Add jest tessuite and first tests [`#114`](https://github.com/xmldom/xmldom/pull/114)
|
||||
- Add jest testsuite with `xmltest` cases [`#112`](https://github.com/xmldom/xmldom/pull/112)
|
||||
- Configure Renovate [`#108`](https://github.com/xmldom/xmldom/pull/108)
|
||||
- Test European HTML entities [`#86`](https://github.com/xmldom/xmldom/pull/86)
|
||||
- Updated devDependencies
|
||||
|
||||
### Other
|
||||
- Remove files that are not of any use [`#131`](https://github.com/xmldom/xmldom/pull/131), [`#65`](https://github.com/xmldom/xmldom/pull/65), [`#33`](https://github.com/xmldom/xmldom/pull/33)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.2.1...0.3.0)
|
||||
|
||||
- **BREAKING** Node >=10.x is now required.
|
||||
- **BREAKING** Remove `component.json` (deprecated package manager https://github.com/componentjs/guide)
|
||||
- **BREAKING** Move existing sources into `lib` subdirectory.
|
||||
- **POSSIBLY BREAKING** Introduce `files` entry in `package.json` and remove use of `.npmignore`.
|
||||
- [Add `Document.getElementsByClassName`](https://github.com/xmldom/xmldom/issues/24).
|
||||
- [Add `Node` to the list of exports](https://github.com/xmldom/xmldom/pull/27)
|
||||
- [Add lowercase of åäö in `entityMap`](https://github.com/xmldom/xmldom/pull/23).
|
||||
- Move CHANGELOG to markdown file.
|
||||
- Move LICENSE to markdown file.
|
||||
|
||||
## 0.2.1
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.2.0...0.2.1)
|
||||
|
||||
- Correct `homepage`, `repository` and `bugs` URLs in `package.json`.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...0.2.0)
|
||||
|
||||
- Includes all **BREAKING** changes introduced in [`xmldom-alpha@v0.1.28`](#0128) by the original authors.
|
||||
- **POSSIBLY BREAKING** [remove the `Object.create` check from the `_extends` method of `dom.js` that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/0be2ae910a8a22c9ec2cac042e04de4c04317d2a#diff-7d1c5d97786fdf9af5446a241d0b6d56L19-L22) ().
|
||||
- **POSSIBLY BREAKING** [remove code that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/366159a76a181ce9a0d83f5dc48205686cfaf9cc)
|
||||
- formatting/corrections in `package.json`
|
||||
|
||||
## 0.1.31
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...v0.1.31)
|
||||
|
||||
The patch versions (`v0.1.29` - `v0.1.31`) that have been released on the [v0.1.x branch](https://github.com/xmldom/xmldom/tree/0.1.x), to reflect the changed maintainers, **are branched off from [`v0.1.27`](#0127) so they don't include the breaking changes introduced in [`xmldom-alpha@v0.1.28`](#0128)**:
|
||||
|
||||
## Maintainer changes
|
||||
|
||||
After the last commit to the original repository <https://github.com/jindw/xmldom> on the 9th of May 2017, the first commit to <https://github.com/xmldom/xmldom> is from the 19th of December 2019. [The fork has been announced in the original repository on the 2nd of March 2020.](https://github.com/jindw/xmldom/issues/259)
|
||||
|
||||
The versions listed below have been published to one or both of the following packages:
|
||||
- <https://www.npmjs.com/package/xmldom-alpha>
|
||||
- <https://www.npmjs.com/package/xmldom>
|
||||
|
||||
It is currently not planned to continue publishing the `xmldom-alpha` package.
|
||||
|
||||
The new maintainers did not invest time to understand changes that led to the last `xmldom` version [`0.1.27`](#0127) published by the original maintainer, but consider it the basis for their work.
|
||||
A timeline of all the changes that happened from that version until `0.3.0` is available in <https://github.com/xmldom/xmldom/issues/62>. Any related questions should be asked there.
|
||||
|
||||
## 0.1.28
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...xmldom-alpha@v0.1.28)
|
||||
|
||||
Published by @jindw on the 9th of May 2017 as
|
||||
- `xmldom-alpha@0.1.28`
|
||||
|
||||
- **BREAKING** includes [regression regarding ` ` (issue #57)](https://github.com/xmldom/xmldom/issues/57)
|
||||
- [Fix `license` field in `package.json`](https://github.com/jindw/xmldom/pull/178)
|
||||
- [Conditional converting of HTML entities](https://github.com/jindw/xmldom/pull/80)
|
||||
- Fix `dom.js` serialization issue for missing document element ([example that failed on `toString()` before this change](https://github.com/xmldom/xmldom/blob/a58dcf7a265522e80ce520fe3be0cddb1b976f6f/test/parse/unclosedcomment.js#L10-L11))
|
||||
- Add new module `entities.js`
|
||||
|
||||
## 0.1.27
|
||||
|
||||
Published by @jindw on the 28th of Nov 2016 as
|
||||
- `xmldom@0.1.27`
|
||||
- `xmldom-alpha@0.1.27`
|
||||
|
||||
- Various bug fixes.
|
||||
|
||||
## 0.1.26
|
||||
|
||||
Published on the 18th of Nov 2016
|
||||
as `xmldom@0.1.26`
|
||||
|
||||
- Details unknown
|
||||
|
||||
## 0.1.25
|
||||
|
||||
Published on the 18th of Nov 2016 as
|
||||
- `xmldom@0.1.25`
|
||||
|
||||
- Details unknown
|
||||
|
||||
## 0.1.24
|
||||
|
||||
Published on the 27th of November 2016 as
|
||||
- `xmldom@0.1.24`
|
||||
- `xmldom-alpha@0.1.24`
|
||||
|
||||
- Added node filter.
|
||||
|
||||
## 0.1.23
|
||||
|
||||
Published on the 5th of May 2016 as
|
||||
- `xmldom-alpha@0.1.23`
|
||||
|
||||
- Add namespace support for nest node serialize.
|
||||
- Various other bug fixes.
|
||||
|
||||
## 0.1.22
|
||||
|
||||
- Merge XMLNS serialization.
|
||||
- Remove \r from source string.
|
||||
- Print namespaces for child elements.
|
||||
- Switch references to nodeType to use named constants.
|
||||
- Add nodelist toString support.
|
||||
|
||||
## 0.1.21
|
||||
|
||||
- Fix serialize bug.
|
||||
|
||||
## 0.1.20
|
||||
|
||||
- Optimize invalid XML support.
|
||||
- Add toString sorter for attributes output.
|
||||
- Add html self closed node button.
|
||||
- Add `*` NS support for getElementsByTagNameNS.
|
||||
- Convert attribute's value to string in setAttributeNS.
|
||||
- Add support for HTML entities for HTML docs only.
|
||||
- Fix TypeError when Document is created with DocumentType.
|
||||
|
||||
## 0.1.19
|
||||
|
||||
- Fix [infinite loop on unclosed comment (jindw/xmldom#68)](https://github.com/jindw/xmldom/issues/68)
|
||||
- Add error report for unclosed tag.
|
||||
- Various other fixes.
|
||||
|
||||
## 0.1.18
|
||||
|
||||
- Add default `ns` support.
|
||||
- parseFromString now renders entirely plain text documents as textNode.
|
||||
- Enable option to ignore white space on parsing.
|
||||
|
||||
## 0.1.17
|
||||
|
||||
**Details missing for this and potential earlier version**
|
||||
|
||||
## 0.1.16
|
||||
|
||||
- Correctly handle multibyte Unicode greater than two byts. #57. #56.
|
||||
- Initial unit testing and test coverage. #53. #46. #19.
|
||||
- Create Bower `component.json` #52.
|
||||
|
||||
## 0.1.8
|
||||
|
||||
- Add: some test case from node-o3-xml(excludes xpath support)
|
||||
- Fix: remove existed attribute before setting (bug introduced in v0.1.5)
|
||||
- Fix: index direct access for childNodes and any NodeList collection(not w3c standard)
|
||||
- Fix: remove last child bug
|
||||
@@ -1,8 +0,0 @@
|
||||
Copyright 2019 - present Christopher J. Brody and other contributors, as listed in: https://github.com/xmldom/xmldom/graphs/contributors
|
||||
Copyright 2012 - 2017 @jindw <jindw@xidea.org> and other contributors, as listed in: https://github.com/jindw/xmldom/graphs/contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,50 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
The most up-to-date version of this document can be found at <https://github.com/xmldom/xmldom/security/policy>.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
This repository contains the code for the libraries `xmldom` and `@xmldom/xmldom` on npm.
|
||||
|
||||
As long as we didn't publish v1, we aim to maintain the last two minor versions with security fixes. If it is possible we provide security fixes as path versions.
|
||||
If you think there is a good reason to also patch an earlier version let us know in a github issue or the release discussion once the fix has been provided.
|
||||
The maintainers will consider it and if we agree and have/find the required resources, a patch for that version will be provided.
|
||||
|
||||
Please notice that [we are no longer able to publish the (unscoped) `xmldom` package](https://github.com/xmldom/xmldom/issues/271),
|
||||
and that all existing versions of `xmldom` are affected by at least one security vulnerability and should be considered deprecated.
|
||||
You can still report issues regarding `xmldom` as described below.
|
||||
|
||||
If you need help with migrating from `xmldom` to `@xmldom/xmldom`, file a github issue or PR in the affected repository and mention @karfau.
|
||||
|
||||
## Reporting vulnerabilities
|
||||
|
||||
Please email reports about any security related issues you find to `security@xmldom.org`, which will forward it to the list of maintainers.
|
||||
The maintainers will try to respond within 7 calendar days. (If nobody peplies after 7 days, please us send a reminder!)
|
||||
As part of you communication please make sure to always hit "Reply all", so all maintainers are kept in the loop.
|
||||
|
||||
In addition, please include the following information along with your report:
|
||||
|
||||
- Your name and affiliation (if any).
|
||||
- A description of the technical details of the vulnerabilities. It is very important to let us know how we can reproduce your findings.
|
||||
- An explanation who can exploit this vulnerability, and what they gain when doing so -- write an attack scenario. This will help us evaluate your report quickly, especially if the issue is complex.
|
||||
- Whether this vulnerability public or known to third parties. If it is, please provide details.
|
||||
|
||||
If you believe that an existing (public) issue is security-related, please send an email to `security@xmldom.org`.
|
||||
The email should include the issue URL and a short description of why it should be handled according to this security policy.
|
||||
|
||||
Once an issue is reported, the maintainers use the following disclosure process:
|
||||
|
||||
- When a report is received, we confirm the issue, determine its severity and the affected versions.
|
||||
- If we know of specific third-party services or software based on xmldom that require mitigation before publication, those projects will be notified.
|
||||
- A [github security advisory](https://docs.github.com/en/code-security/security-advisories/about-github-security-advisories) is [created](https://docs.github.com/en/code-security/security-advisories/creating-a-security-advisory) (but not published) which details the problem and steps for mitigation.
|
||||
- If the reporter provides a github account and agrees to it, we (add that github account as a collaborator on the advisuory)[https://docs.github.com/en/code-security/security-advisories/adding-a-collaborator-to-a-security-advisory].
|
||||
- The vulnerability is fixed in a [private fork](https://docs.github.com/en/code-security/security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-security-vulnerability) and potential workarounds are identified.
|
||||
- The maintainers audit the existing code to find any potential similar problems.
|
||||
- The release for the current minor version and the [security advisory are published](https://docs.github.com/en/code-security/security-advisories/publishing-a-security-advisory).
|
||||
- The release(s) for previous minor version(s) are published.
|
||||
|
||||
We credit reporters for identifying security issues, if they confirm that they want to.
|
||||
|
||||
## Known vulnerabilities
|
||||
|
||||
See https://github.com/xmldom/xmldom/security/advisories?state=published
|
||||
@@ -1,43 +0,0 @@
|
||||
/// <reference lib="dom" />
|
||||
|
||||
declare module "@xmldom/xmldom" {
|
||||
var DOMParser: DOMParserStatic;
|
||||
var XMLSerializer: XMLSerializerStatic;
|
||||
var DOMImplementation: DOMImplementationStatic;
|
||||
|
||||
interface DOMImplementationStatic {
|
||||
new(): DOMImplementation;
|
||||
}
|
||||
|
||||
interface DOMParserStatic {
|
||||
new (): DOMParser;
|
||||
new (options: Options): DOMParser;
|
||||
}
|
||||
|
||||
interface XMLSerializerStatic {
|
||||
new (): XMLSerializer;
|
||||
}
|
||||
|
||||
interface DOMParser {
|
||||
parseFromString(xmlsource: string, mimeType?: string): Document;
|
||||
}
|
||||
|
||||
interface XMLSerializer {
|
||||
serializeToString(node: Node): string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
locator?: any;
|
||||
errorHandler?: ErrorHandlerFunction | ErrorHandlerObject | undefined;
|
||||
}
|
||||
|
||||
interface ErrorHandlerFunction {
|
||||
(level: string, msg: any): any;
|
||||
}
|
||||
|
||||
interface ErrorHandlerObject {
|
||||
warning?: ((msg: any) => any) | undefined;
|
||||
error?: ((msg: any) => any) | undefined;
|
||||
fatalError?: ((msg: any) => any) | undefined;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
extends:
|
||||
- 'plugin:es5/no-es2015'
|
||||
@@ -1,203 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.
|
||||
*
|
||||
* Works with anything that has a `length` property and index access properties, including NodeList.
|
||||
*
|
||||
* @template {unknown} T
|
||||
* @param {Array<T> | ({length:number, [number]: T})} list
|
||||
* @param {function (item: T, index: number, list:Array<T> | ({length:number, [number]: T})):boolean} predicate
|
||||
* @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac `Array.prototype` by default,
|
||||
* allows injecting a custom implementation in tests
|
||||
* @returns {T | undefined}
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
|
||||
* @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find
|
||||
*/
|
||||
function find(list, predicate, ac) {
|
||||
if (ac === undefined) {
|
||||
ac = Array.prototype;
|
||||
}
|
||||
if (list && typeof ac.find === 'function') {
|
||||
return ac.find.call(list, predicate);
|
||||
}
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (Object.prototype.hasOwnProperty.call(list, i)) {
|
||||
var item = list[i];
|
||||
if (predicate.call(undefined, item, i, list)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* "Shallow freezes" an object to render it immutable.
|
||||
* Uses `Object.freeze` if available,
|
||||
* otherwise the immutability is only in the type.
|
||||
*
|
||||
* Is used to create "enum like" objects.
|
||||
*
|
||||
* @template T
|
||||
* @param {T} object the object to freeze
|
||||
* @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
|
||||
* allows to inject custom object constructor for tests
|
||||
* @returns {Readonly<T>}
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
|
||||
*/
|
||||
function freeze(object, oc) {
|
||||
if (oc === undefined) {
|
||||
oc = Object
|
||||
}
|
||||
return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
|
||||
}
|
||||
|
||||
/**
|
||||
* Since we can not rely on `Object.assign` we provide a simplified version
|
||||
* that is sufficient for our needs.
|
||||
*
|
||||
* @param {Object} target
|
||||
* @param {Object | null | undefined} source
|
||||
*
|
||||
* @returns {Object} target
|
||||
* @throws TypeError if target is not an object
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
||||
* @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
|
||||
*/
|
||||
function assign(target, source) {
|
||||
if (target === null || typeof target !== 'object') {
|
||||
throw new TypeError('target is not an object')
|
||||
}
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key]
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* All mime types that are allowed as input to `DOMParser.parseFromString`
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
|
||||
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
|
||||
* @see DOMParser.prototype.parseFromString
|
||||
*/
|
||||
var MIME_TYPE = freeze({
|
||||
/**
|
||||
* `text/html`, the only mime type that triggers treating an XML document as HTML.
|
||||
*
|
||||
* @see DOMParser.SupportedType.isHTML
|
||||
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
|
||||
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
|
||||
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
|
||||
*/
|
||||
HTML: 'text/html',
|
||||
|
||||
/**
|
||||
* Helper method to check a mime type if it indicates an HTML document
|
||||
*
|
||||
* @param {string} [value]
|
||||
* @returns {boolean}
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
|
||||
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
|
||||
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
|
||||
isHTML: function (value) {
|
||||
return value === MIME_TYPE.HTML
|
||||
},
|
||||
|
||||
/**
|
||||
* `application/xml`, the standard mime type for XML documents.
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
|
||||
* @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
|
||||
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
|
||||
*/
|
||||
XML_APPLICATION: 'application/xml',
|
||||
|
||||
/**
|
||||
* `text/html`, an alias for `application/xml`.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
|
||||
* @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
|
||||
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
|
||||
*/
|
||||
XML_TEXT: 'text/xml',
|
||||
|
||||
/**
|
||||
* `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
|
||||
* but is parsed as an XML document.
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
|
||||
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
|
||||
* @see https://en.wikipedia.org/wiki/XHTML Wikipedia
|
||||
*/
|
||||
XML_XHTML_APPLICATION: 'application/xhtml+xml',
|
||||
|
||||
/**
|
||||
* `image/svg+xml`,
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
|
||||
* @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
|
||||
* @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
|
||||
*/
|
||||
XML_SVG_IMAGE: 'image/svg+xml',
|
||||
})
|
||||
|
||||
/**
|
||||
* Namespaces that are used in this code base.
|
||||
*
|
||||
* @see http://www.w3.org/TR/REC-xml-names
|
||||
*/
|
||||
var NAMESPACE = freeze({
|
||||
/**
|
||||
* The XHTML namespace.
|
||||
*
|
||||
* @see http://www.w3.org/1999/xhtml
|
||||
*/
|
||||
HTML: 'http://www.w3.org/1999/xhtml',
|
||||
|
||||
/**
|
||||
* Checks if `uri` equals `NAMESPACE.HTML`.
|
||||
*
|
||||
* @param {string} [uri]
|
||||
*
|
||||
* @see NAMESPACE.HTML
|
||||
*/
|
||||
isHTML: function (uri) {
|
||||
return uri === NAMESPACE.HTML
|
||||
},
|
||||
|
||||
/**
|
||||
* The SVG namespace.
|
||||
*
|
||||
* @see http://www.w3.org/2000/svg
|
||||
*/
|
||||
SVG: 'http://www.w3.org/2000/svg',
|
||||
|
||||
/**
|
||||
* The `xml:` namespace.
|
||||
*
|
||||
* @see http://www.w3.org/XML/1998/namespace
|
||||
*/
|
||||
XML: 'http://www.w3.org/XML/1998/namespace',
|
||||
|
||||
/**
|
||||
* The `xmlns:` namespace
|
||||
*
|
||||
* @see https://www.w3.org/2000/xmlns/
|
||||
*/
|
||||
XMLNS: 'http://www.w3.org/2000/xmlns/',
|
||||
})
|
||||
|
||||
exports.assign = assign;
|
||||
exports.find = find;
|
||||
exports.freeze = freeze;
|
||||
exports.MIME_TYPE = MIME_TYPE;
|
||||
exports.NAMESPACE = NAMESPACE;
|
||||
@@ -1,322 +0,0 @@
|
||||
var conventions = require("./conventions");
|
||||
var dom = require('./dom')
|
||||
var entities = require('./entities');
|
||||
var sax = require('./sax');
|
||||
|
||||
var DOMImplementation = dom.DOMImplementation;
|
||||
|
||||
var NAMESPACE = conventions.NAMESPACE;
|
||||
|
||||
var ParseError = sax.ParseError;
|
||||
var XMLReader = sax.XMLReader;
|
||||
|
||||
/**
|
||||
* Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends:
|
||||
*
|
||||
* > XML parsed entities are often stored in computer files which,
|
||||
* > for editing convenience, are organized into lines.
|
||||
* > These lines are typically separated by some combination
|
||||
* > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).
|
||||
* >
|
||||
* > To simplify the tasks of applications, the XML processor must behave
|
||||
* > as if it normalized all line breaks in external parsed entities (including the document entity)
|
||||
* > on input, before parsing, by translating all of the following to a single #xA character:
|
||||
* >
|
||||
* > 1. the two-character sequence #xD #xA
|
||||
* > 2. the two-character sequence #xD #x85
|
||||
* > 3. the single character #x85
|
||||
* > 4. the single character #x2028
|
||||
* > 5. any #xD character that is not immediately followed by #xA or #x85.
|
||||
*
|
||||
* @param {string} input
|
||||
* @returns {string}
|
||||
*/
|
||||
function normalizeLineEndings(input) {
|
||||
return input
|
||||
.replace(/\r[\n\u0085]/g, '\n')
|
||||
.replace(/[\r\u0085\u2028]/g, '\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef Locator
|
||||
* @property {number} [columnNumber]
|
||||
* @property {number} [lineNumber]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef DOMParserOptions
|
||||
* @property {DOMHandler} [domBuilder]
|
||||
* @property {Function} [errorHandler]
|
||||
* @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing
|
||||
* defaults to `normalizeLineEndings`
|
||||
* @property {Locator} [locator]
|
||||
* @property {Record<string, string>} [xmlns]
|
||||
*
|
||||
* @see normalizeLineEndings
|
||||
*/
|
||||
|
||||
/**
|
||||
* The DOMParser interface provides the ability to parse XML or HTML source code
|
||||
* from a string into a DOM `Document`.
|
||||
*
|
||||
* _xmldom is different from the spec in that it allows an `options` parameter,
|
||||
* to override the default behavior._
|
||||
*
|
||||
* @param {DOMParserOptions} [options]
|
||||
* @constructor
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
|
||||
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
|
||||
*/
|
||||
function DOMParser(options){
|
||||
this.options = options ||{locator:{}};
|
||||
}
|
||||
|
||||
DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
var options = this.options;
|
||||
var sax = new XMLReader();
|
||||
var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler
|
||||
var errorHandler = options.errorHandler;
|
||||
var locator = options.locator;
|
||||
var defaultNSMap = options.xmlns||{};
|
||||
var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;
|
||||
var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
|
||||
if(locator){
|
||||
domBuilder.setDocumentLocator(locator)
|
||||
}
|
||||
|
||||
sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
|
||||
sax.domBuilder = options.domBuilder || domBuilder;
|
||||
if(isHTML){
|
||||
defaultNSMap[''] = NAMESPACE.HTML;
|
||||
}
|
||||
defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
|
||||
var normalize = options.normalizeLineEndings || normalizeLineEndings;
|
||||
if (source && typeof source === 'string') {
|
||||
sax.parse(
|
||||
normalize(source),
|
||||
defaultNSMap,
|
||||
entityMap
|
||||
)
|
||||
} else {
|
||||
sax.errorHandler.error('invalid doc source')
|
||||
}
|
||||
return domBuilder.doc;
|
||||
}
|
||||
function buildErrorHandler(errorImpl,domBuilder,locator){
|
||||
if(!errorImpl){
|
||||
if(domBuilder instanceof DOMHandler){
|
||||
return domBuilder;
|
||||
}
|
||||
errorImpl = domBuilder ;
|
||||
}
|
||||
var errorHandler = {}
|
||||
var isCallback = errorImpl instanceof Function;
|
||||
locator = locator||{}
|
||||
function build(key){
|
||||
var fn = errorImpl[key];
|
||||
if(!fn && isCallback){
|
||||
fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
|
||||
}
|
||||
errorHandler[key] = fn && function(msg){
|
||||
fn('[xmldom '+key+']\t'+msg+_locator(locator));
|
||||
}||function(){};
|
||||
}
|
||||
build('warning');
|
||||
build('error');
|
||||
build('fatalError');
|
||||
return errorHandler;
|
||||
}
|
||||
|
||||
//console.log('#\n\n\n\n\n\n\n####')
|
||||
/**
|
||||
* +ContentHandler+ErrorHandler
|
||||
* +LexicalHandler+EntityResolver2
|
||||
* -DeclHandler-DTDHandler
|
||||
*
|
||||
* DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
|
||||
* DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
|
||||
*/
|
||||
function DOMHandler() {
|
||||
this.cdata = false;
|
||||
}
|
||||
function position(locator,node){
|
||||
node.lineNumber = locator.lineNumber;
|
||||
node.columnNumber = locator.columnNumber;
|
||||
}
|
||||
/**
|
||||
* @see org.xml.sax.ContentHandler#startDocument
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
|
||||
*/
|
||||
DOMHandler.prototype = {
|
||||
startDocument : function() {
|
||||
this.doc = new DOMImplementation().createDocument(null, null, null);
|
||||
if (this.locator) {
|
||||
this.doc.documentURI = this.locator.systemId;
|
||||
}
|
||||
},
|
||||
startElement:function(namespaceURI, localName, qName, attrs) {
|
||||
var doc = this.doc;
|
||||
var el = doc.createElementNS(namespaceURI, qName||localName);
|
||||
var len = attrs.length;
|
||||
appendElement(this, el);
|
||||
this.currentElement = el;
|
||||
|
||||
this.locator && position(this.locator,el)
|
||||
for (var i = 0 ; i < len; i++) {
|
||||
var namespaceURI = attrs.getURI(i);
|
||||
var value = attrs.getValue(i);
|
||||
var qName = attrs.getQName(i);
|
||||
var attr = doc.createAttributeNS(namespaceURI, qName);
|
||||
this.locator &&position(attrs.getLocator(i),attr);
|
||||
attr.value = attr.nodeValue = value;
|
||||
el.setAttributeNode(attr)
|
||||
}
|
||||
},
|
||||
endElement:function(namespaceURI, localName, qName) {
|
||||
var current = this.currentElement
|
||||
var tagName = current.tagName;
|
||||
this.currentElement = current.parentNode;
|
||||
},
|
||||
startPrefixMapping:function(prefix, uri) {
|
||||
},
|
||||
endPrefixMapping:function(prefix) {
|
||||
},
|
||||
processingInstruction:function(target, data) {
|
||||
var ins = this.doc.createProcessingInstruction(target, data);
|
||||
this.locator && position(this.locator,ins)
|
||||
appendElement(this, ins);
|
||||
},
|
||||
ignorableWhitespace:function(ch, start, length) {
|
||||
},
|
||||
characters:function(chars, start, length) {
|
||||
chars = _toString.apply(this,arguments)
|
||||
//console.log(chars)
|
||||
if(chars){
|
||||
if (this.cdata) {
|
||||
var charNode = this.doc.createCDATASection(chars);
|
||||
} else {
|
||||
var charNode = this.doc.createTextNode(chars);
|
||||
}
|
||||
if(this.currentElement){
|
||||
this.currentElement.appendChild(charNode);
|
||||
}else if(/^\s*$/.test(chars)){
|
||||
this.doc.appendChild(charNode);
|
||||
//process xml
|
||||
}
|
||||
this.locator && position(this.locator,charNode)
|
||||
}
|
||||
},
|
||||
skippedEntity:function(name) {
|
||||
},
|
||||
endDocument:function() {
|
||||
this.doc.normalize();
|
||||
},
|
||||
setDocumentLocator:function (locator) {
|
||||
if(this.locator = locator){// && !('lineNumber' in locator)){
|
||||
locator.lineNumber = 0;
|
||||
}
|
||||
},
|
||||
//LexicalHandler
|
||||
comment:function(chars, start, length) {
|
||||
chars = _toString.apply(this,arguments)
|
||||
var comm = this.doc.createComment(chars);
|
||||
this.locator && position(this.locator,comm)
|
||||
appendElement(this, comm);
|
||||
},
|
||||
|
||||
startCDATA:function() {
|
||||
//used in characters() methods
|
||||
this.cdata = true;
|
||||
},
|
||||
endCDATA:function() {
|
||||
this.cdata = false;
|
||||
},
|
||||
|
||||
startDTD:function(name, publicId, systemId) {
|
||||
var impl = this.doc.implementation;
|
||||
if (impl && impl.createDocumentType) {
|
||||
var dt = impl.createDocumentType(name, publicId, systemId);
|
||||
this.locator && position(this.locator,dt)
|
||||
appendElement(this, dt);
|
||||
this.doc.doctype = dt;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @see org.xml.sax.ErrorHandler
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
|
||||
*/
|
||||
warning:function(error) {
|
||||
console.warn('[xmldom warning]\t'+error,_locator(this.locator));
|
||||
},
|
||||
error:function(error) {
|
||||
console.error('[xmldom error]\t'+error,_locator(this.locator));
|
||||
},
|
||||
fatalError:function(error) {
|
||||
throw new ParseError(error, this.locator);
|
||||
}
|
||||
}
|
||||
function _locator(l){
|
||||
if(l){
|
||||
return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'
|
||||
}
|
||||
}
|
||||
function _toString(chars,start,length){
|
||||
if(typeof chars == 'string'){
|
||||
return chars.substr(start,length)
|
||||
}else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
|
||||
if(chars.length >= start+length || start){
|
||||
return new java.lang.String(chars,start,length)+'';
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html
|
||||
* used method of org.xml.sax.ext.LexicalHandler:
|
||||
* #comment(chars, start, length)
|
||||
* #startCDATA()
|
||||
* #endCDATA()
|
||||
* #startDTD(name, publicId, systemId)
|
||||
*
|
||||
*
|
||||
* IGNORED method of org.xml.sax.ext.LexicalHandler:
|
||||
* #endDTD()
|
||||
* #startEntity(name)
|
||||
* #endEntity(name)
|
||||
*
|
||||
*
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html
|
||||
* IGNORED method of org.xml.sax.ext.DeclHandler
|
||||
* #attributeDecl(eName, aName, type, mode, value)
|
||||
* #elementDecl(name, model)
|
||||
* #externalEntityDecl(name, publicId, systemId)
|
||||
* #internalEntityDecl(name, value)
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html
|
||||
* IGNORED method of org.xml.sax.EntityResolver2
|
||||
* #resolveEntity(String name,String publicId,String baseURI,String systemId)
|
||||
* #resolveEntity(publicId, systemId)
|
||||
* #getExternalSubset(name, baseURI)
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html
|
||||
* IGNORED method of org.xml.sax.DTDHandler
|
||||
* #notationDecl(name, publicId, systemId) {};
|
||||
* #unparsedEntityDecl(name, publicId, systemId, notationName) {};
|
||||
*/
|
||||
"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){
|
||||
DOMHandler.prototype[key] = function(){return null}
|
||||
})
|
||||
|
||||
/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */
|
||||
function appendElement (hander,node) {
|
||||
if (!hander.currentElement) {
|
||||
hander.doc.appendChild(node);
|
||||
} else {
|
||||
hander.currentElement.appendChild(node);
|
||||
}
|
||||
}//appendChild and setAttributeNS are preformance key
|
||||
|
||||
exports.__DOMHandler = DOMHandler;
|
||||
exports.normalizeLineEndings = normalizeLineEndings;
|
||||
exports.DOMParser = DOMParser;
|
||||
@@ -1,4 +0,0 @@
|
||||
var dom = require('./dom')
|
||||
exports.DOMImplementation = dom.DOMImplementation
|
||||
exports.XMLSerializer = dom.XMLSerializer
|
||||
exports.DOMParser = require('./dom-parser').DOMParser
|
||||
@@ -1,662 +0,0 @@
|
||||
var NAMESPACE = require("./conventions").NAMESPACE;
|
||||
|
||||
//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
||||
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
||||
//[5] Name ::= NameStartChar (NameChar)*
|
||||
var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF
|
||||
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
|
||||
var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
|
||||
//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
|
||||
//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
|
||||
|
||||
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
||||
//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
|
||||
var S_TAG = 0;//tag name offerring
|
||||
var S_ATTR = 1;//attr name offerring
|
||||
var S_ATTR_SPACE=2;//attr name end and space offer
|
||||
var S_EQ = 3;//=space?
|
||||
var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)
|
||||
var S_ATTR_END = 5;//attr value end and no space(quot end)
|
||||
var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)
|
||||
var S_TAG_CLOSE = 7;//closed el<el />
|
||||
|
||||
/**
|
||||
* Creates an error that will not be caught by XMLReader aka the SAX parser.
|
||||
*
|
||||
* @param {string} message
|
||||
* @param {any?} locator Optional, can provide details about the location in the source
|
||||
* @constructor
|
||||
*/
|
||||
function ParseError(message, locator) {
|
||||
this.message = message
|
||||
this.locator = locator
|
||||
if(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
|
||||
}
|
||||
ParseError.prototype = new Error();
|
||||
ParseError.prototype.name = ParseError.name
|
||||
|
||||
function XMLReader(){
|
||||
|
||||
}
|
||||
|
||||
XMLReader.prototype = {
|
||||
parse:function(source,defaultNSMap,entityMap){
|
||||
var domBuilder = this.domBuilder;
|
||||
domBuilder.startDocument();
|
||||
_copy(defaultNSMap ,defaultNSMap = {})
|
||||
parse(source,defaultNSMap,entityMap,
|
||||
domBuilder,this.errorHandler);
|
||||
domBuilder.endDocument();
|
||||
}
|
||||
}
|
||||
function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
function fixedFromCharCode(code) {
|
||||
// String.prototype.fromCharCode does not supports
|
||||
// > 2 bytes unicode chars directly
|
||||
if (code > 0xffff) {
|
||||
code -= 0x10000;
|
||||
var surrogate1 = 0xd800 + (code >> 10)
|
||||
, surrogate2 = 0xdc00 + (code & 0x3ff);
|
||||
|
||||
return String.fromCharCode(surrogate1, surrogate2);
|
||||
} else {
|
||||
return String.fromCharCode(code);
|
||||
}
|
||||
}
|
||||
function entityReplacer(a){
|
||||
var k = a.slice(1,-1);
|
||||
if (Object.hasOwnProperty.call(entityMap, k)) {
|
||||
return entityMap[k];
|
||||
}else if(k.charAt(0) === '#'){
|
||||
return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))
|
||||
}else{
|
||||
errorHandler.error('entity not found:'+a);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
function appendText(end){//has some bugs
|
||||
if(end>start){
|
||||
var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);
|
||||
locator&&position(start);
|
||||
domBuilder.characters(xt,0,end-start);
|
||||
start = end
|
||||
}
|
||||
}
|
||||
function position(p,m){
|
||||
while(p>=lineEnd && (m = linePattern.exec(source))){
|
||||
lineStart = m.index;
|
||||
lineEnd = lineStart + m[0].length;
|
||||
locator.lineNumber++;
|
||||
//console.log('line++:',locator,startPos,endPos)
|
||||
}
|
||||
locator.columnNumber = p-lineStart+1;
|
||||
}
|
||||
var lineStart = 0;
|
||||
var lineEnd = 0;
|
||||
var linePattern = /.*(?:\r\n?|\n)|.*$/g
|
||||
var locator = domBuilder.locator;
|
||||
|
||||
var parseStack = [{currentNSMap:defaultNSMapCopy}]
|
||||
var closeMap = {};
|
||||
var start = 0;
|
||||
while(true){
|
||||
try{
|
||||
var tagStart = source.indexOf('<',start);
|
||||
if(tagStart<0){
|
||||
if(!source.substr(start).match(/^\s*$/)){
|
||||
var doc = domBuilder.doc;
|
||||
var text = doc.createTextNode(source.substr(start));
|
||||
doc.appendChild(text);
|
||||
domBuilder.currentElement = text;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(tagStart>start){
|
||||
appendText(tagStart);
|
||||
}
|
||||
switch(source.charAt(tagStart+1)){
|
||||
case '/':
|
||||
var end = source.indexOf('>',tagStart+3);
|
||||
var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
|
||||
var config = parseStack.pop();
|
||||
if(end<0){
|
||||
|
||||
tagName = source.substring(tagStart+2).replace(/[\s<].*/,'');
|
||||
errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);
|
||||
end = tagStart+1+tagName.length;
|
||||
}else if(tagName.match(/\s</)){
|
||||
tagName = tagName.replace(/[\s<].*/,'');
|
||||
errorHandler.error("end tag name: "+tagName+' maybe not complete');
|
||||
end = tagStart+1+tagName.length;
|
||||
}
|
||||
var localNSMap = config.localNSMap;
|
||||
var endMatch = config.tagName == tagName;
|
||||
var endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase()
|
||||
if(endIgnoreCaseMach){
|
||||
domBuilder.endElement(config.uri,config.localName,tagName);
|
||||
if(localNSMap){
|
||||
for (var prefix in localNSMap) {
|
||||
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
||||
domBuilder.endPrefixMapping(prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!endMatch){
|
||||
errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); // No known test case
|
||||
}
|
||||
}else{
|
||||
parseStack.push(config)
|
||||
}
|
||||
|
||||
end++;
|
||||
break;
|
||||
// end elment
|
||||
case '?':// <?...?>
|
||||
locator&&position(tagStart);
|
||||
end = parseInstruction(source,tagStart,domBuilder);
|
||||
break;
|
||||
case '!':// <!doctype,<![CDATA,<!--
|
||||
locator&&position(tagStart);
|
||||
end = parseDCC(source,tagStart,domBuilder,errorHandler);
|
||||
break;
|
||||
default:
|
||||
locator&&position(tagStart);
|
||||
var el = new ElementAttributes();
|
||||
var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
|
||||
//elStartEnd
|
||||
var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);
|
||||
var len = el.length;
|
||||
|
||||
|
||||
if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
|
||||
el.closed = true;
|
||||
if(!entityMap.nbsp){
|
||||
errorHandler.warning('unclosed xml attribute');
|
||||
}
|
||||
}
|
||||
if(locator && len){
|
||||
var locator2 = copyLocator(locator,{});
|
||||
//try{//attribute position fixed
|
||||
for(var i = 0;i<len;i++){
|
||||
var a = el[i];
|
||||
position(a.offset);
|
||||
a.locator = copyLocator(locator,{});
|
||||
}
|
||||
domBuilder.locator = locator2
|
||||
if(appendElement(el,domBuilder,currentNSMap)){
|
||||
parseStack.push(el)
|
||||
}
|
||||
domBuilder.locator = locator;
|
||||
}else{
|
||||
if(appendElement(el,domBuilder,currentNSMap)){
|
||||
parseStack.push(el)
|
||||
}
|
||||
}
|
||||
|
||||
if (NAMESPACE.isHTML(el.uri) && !el.closed) {
|
||||
end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)
|
||||
} else {
|
||||
end++;
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
if (e instanceof ParseError) {
|
||||
throw e;
|
||||
}
|
||||
errorHandler.error('element parse error: '+e)
|
||||
end = -1;
|
||||
}
|
||||
if(end>start){
|
||||
start = end;
|
||||
}else{
|
||||
//TODO: 这里有可能sax回退,有位置错误风险
|
||||
appendText(Math.max(tagStart,start)+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function copyLocator(f,t){
|
||||
t.lineNumber = f.lineNumber;
|
||||
t.columnNumber = f.columnNumber;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
|
||||
* @return end of the elementStartPart(end of elementEndPart for selfClosed el)
|
||||
*/
|
||||
function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){
|
||||
|
||||
/**
|
||||
* @param {string} qname
|
||||
* @param {string} value
|
||||
* @param {number} startIndex
|
||||
*/
|
||||
function addAttribute(qname, value, startIndex) {
|
||||
if (el.attributeNames.hasOwnProperty(qname)) {
|
||||
errorHandler.fatalError('Attribute ' + qname + ' redefined')
|
||||
}
|
||||
el.addValue(
|
||||
qname,
|
||||
// @see https://www.w3.org/TR/xml/#AVNormalize
|
||||
// since the xmldom sax parser does not "interpret" DTD the following is not implemented:
|
||||
// - recursive replacement of (DTD) entity references
|
||||
// - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
|
||||
value.replace(/[\t\n\r]/g, ' ').replace(/&#?\w+;/g, entityReplacer),
|
||||
startIndex
|
||||
)
|
||||
}
|
||||
var attrName;
|
||||
var value;
|
||||
var p = ++start;
|
||||
var s = S_TAG;//status
|
||||
while(true){
|
||||
var c = source.charAt(p);
|
||||
switch(c){
|
||||
case '=':
|
||||
if(s === S_ATTR){//attrName
|
||||
attrName = source.slice(start,p);
|
||||
s = S_EQ;
|
||||
}else if(s === S_ATTR_SPACE){
|
||||
s = S_EQ;
|
||||
}else{
|
||||
//fatalError: equal must after attrName or space after attrName
|
||||
throw new Error('attribute equal must after attrName'); // No known test case
|
||||
}
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE
|
||||
){//equal
|
||||
if(s === S_ATTR){
|
||||
errorHandler.warning('attribute value must after "="')
|
||||
attrName = source.slice(start,p)
|
||||
}
|
||||
start = p+1;
|
||||
p = source.indexOf(c,start)
|
||||
if(p>0){
|
||||
value = source.slice(start, p);
|
||||
addAttribute(attrName, value, start-1);
|
||||
s = S_ATTR_END;
|
||||
}else{
|
||||
//fatalError: no end quot match
|
||||
throw new Error('attribute value no end \''+c+'\' match');
|
||||
}
|
||||
}else if(s == S_ATTR_NOQUOT_VALUE){
|
||||
value = source.slice(start, p);
|
||||
addAttribute(attrName, value, start);
|
||||
errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');
|
||||
start = p+1;
|
||||
s = S_ATTR_END
|
||||
}else{
|
||||
//fatalError: no equal before
|
||||
throw new Error('attribute value must after "="'); // No known test case
|
||||
}
|
||||
break;
|
||||
case '/':
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));
|
||||
case S_ATTR_END:
|
||||
case S_TAG_SPACE:
|
||||
case S_TAG_CLOSE:
|
||||
s =S_TAG_CLOSE;
|
||||
el.closed = true;
|
||||
case S_ATTR_NOQUOT_VALUE:
|
||||
case S_ATTR:
|
||||
break;
|
||||
case S_ATTR_SPACE:
|
||||
el.closed = true;
|
||||
break;
|
||||
//case S_EQ:
|
||||
default:
|
||||
throw new Error("attribute invalid close char('/')") // No known test case
|
||||
}
|
||||
break;
|
||||
case ''://end document
|
||||
errorHandler.error('unexpected end of input');
|
||||
if(s == S_TAG){
|
||||
el.setTagName(source.slice(start,p));
|
||||
}
|
||||
return p;
|
||||
case '>':
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));
|
||||
case S_ATTR_END:
|
||||
case S_TAG_SPACE:
|
||||
case S_TAG_CLOSE:
|
||||
break;//normal
|
||||
case S_ATTR_NOQUOT_VALUE://Compatible state
|
||||
case S_ATTR:
|
||||
value = source.slice(start,p);
|
||||
if(value.slice(-1) === '/'){
|
||||
el.closed = true;
|
||||
value = value.slice(0,-1)
|
||||
}
|
||||
case S_ATTR_SPACE:
|
||||
if(s === S_ATTR_SPACE){
|
||||
value = attrName;
|
||||
}
|
||||
if(s == S_ATTR_NOQUOT_VALUE){
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!');
|
||||
addAttribute(attrName, value, start)
|
||||
}else{
|
||||
if(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){
|
||||
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
|
||||
}
|
||||
addAttribute(value, value, start)
|
||||
}
|
||||
break;
|
||||
case S_EQ:
|
||||
throw new Error('attribute value missed!!');
|
||||
}
|
||||
// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName))
|
||||
return p;
|
||||
/*xml space '\x20' | #x9 | #xD | #xA; */
|
||||
case '\u0080':
|
||||
c = ' ';
|
||||
default:
|
||||
if(c<= ' '){//space
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));//tagName
|
||||
s = S_TAG_SPACE;
|
||||
break;
|
||||
case S_ATTR:
|
||||
attrName = source.slice(start,p)
|
||||
s = S_ATTR_SPACE;
|
||||
break;
|
||||
case S_ATTR_NOQUOT_VALUE:
|
||||
var value = source.slice(start, p);
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
|
||||
addAttribute(attrName, value, start)
|
||||
case S_ATTR_END:
|
||||
s = S_TAG_SPACE;
|
||||
break;
|
||||
//case S_TAG_SPACE:
|
||||
//case S_EQ:
|
||||
//case S_ATTR_SPACE:
|
||||
// void();break;
|
||||
//case S_TAG_CLOSE:
|
||||
//ignore warning
|
||||
}
|
||||
}else{//not space
|
||||
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
||||
//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
|
||||
switch(s){
|
||||
//case S_TAG:void();break;
|
||||
//case S_ATTR:void();break;
|
||||
//case S_ATTR_NOQUOT_VALUE:void();break;
|
||||
case S_ATTR_SPACE:
|
||||
var tagName = el.tagName;
|
||||
if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
|
||||
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!')
|
||||
}
|
||||
addAttribute(attrName, attrName, start);
|
||||
start = p;
|
||||
s = S_ATTR;
|
||||
break;
|
||||
case S_ATTR_END:
|
||||
errorHandler.warning('attribute space is required"'+attrName+'"!!')
|
||||
case S_TAG_SPACE:
|
||||
s = S_ATTR;
|
||||
start = p;
|
||||
break;
|
||||
case S_EQ:
|
||||
s = S_ATTR_NOQUOT_VALUE;
|
||||
start = p;
|
||||
break;
|
||||
case S_TAG_CLOSE:
|
||||
throw new Error("elements closed character '/' and '>' must be connected to");
|
||||
}
|
||||
}
|
||||
}//end outer switch
|
||||
//console.log('p++',p)
|
||||
p++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return true if has new namespace define
|
||||
*/
|
||||
function appendElement(el,domBuilder,currentNSMap){
|
||||
var tagName = el.tagName;
|
||||
var localNSMap = null;
|
||||
//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
|
||||
var i = el.length;
|
||||
while(i--){
|
||||
var a = el[i];
|
||||
var qName = a.qName;
|
||||
var value = a.value;
|
||||
var nsp = qName.indexOf(':');
|
||||
if(nsp>0){
|
||||
var prefix = a.prefix = qName.slice(0,nsp);
|
||||
var localName = qName.slice(nsp+1);
|
||||
var nsPrefix = prefix === 'xmlns' && localName
|
||||
}else{
|
||||
localName = qName;
|
||||
prefix = null
|
||||
nsPrefix = qName === 'xmlns' && ''
|
||||
}
|
||||
//can not set prefix,because prefix !== ''
|
||||
a.localName = localName ;
|
||||
//prefix == null for no ns prefix attribute
|
||||
if(nsPrefix !== false){//hack!!
|
||||
if(localNSMap == null){
|
||||
localNSMap = {}
|
||||
//console.log(currentNSMap,0)
|
||||
_copy(currentNSMap,currentNSMap={})
|
||||
//console.log(currentNSMap,1)
|
||||
}
|
||||
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
|
||||
a.uri = NAMESPACE.XMLNS
|
||||
domBuilder.startPrefixMapping(nsPrefix, value)
|
||||
}
|
||||
}
|
||||
var i = el.length;
|
||||
while(i--){
|
||||
a = el[i];
|
||||
var prefix = a.prefix;
|
||||
if(prefix){//no prefix attribute has no namespace
|
||||
if(prefix === 'xml'){
|
||||
a.uri = NAMESPACE.XML;
|
||||
}if(prefix !== 'xmlns'){
|
||||
a.uri = currentNSMap[prefix || '']
|
||||
|
||||
//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
|
||||
}
|
||||
}
|
||||
}
|
||||
var nsp = tagName.indexOf(':');
|
||||
if(nsp>0){
|
||||
prefix = el.prefix = tagName.slice(0,nsp);
|
||||
localName = el.localName = tagName.slice(nsp+1);
|
||||
}else{
|
||||
prefix = null;//important!!
|
||||
localName = el.localName = tagName;
|
||||
}
|
||||
//no prefix element has default namespace
|
||||
var ns = el.uri = currentNSMap[prefix || ''];
|
||||
domBuilder.startElement(ns,localName,tagName,el);
|
||||
//endPrefixMapping and startPrefixMapping have not any help for dom builder
|
||||
//localNSMap = null
|
||||
if(el.closed){
|
||||
domBuilder.endElement(ns,localName,tagName);
|
||||
if(localNSMap){
|
||||
for (prefix in localNSMap) {
|
||||
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
||||
domBuilder.endPrefixMapping(prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
el.currentNSMap = currentNSMap;
|
||||
el.localNSMap = localNSMap;
|
||||
//parseStack.push(el);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){
|
||||
if(/^(?:script|textarea)$/i.test(tagName)){
|
||||
var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd);
|
||||
var text = source.substring(elStartEnd+1,elEndStart);
|
||||
if(/[&<]/.test(text)){
|
||||
if(/^script$/i.test(tagName)){
|
||||
//if(!/\]\]>/.test(text)){
|
||||
//lexHandler.startCDATA();
|
||||
domBuilder.characters(text,0,text.length);
|
||||
//lexHandler.endCDATA();
|
||||
return elEndStart;
|
||||
//}
|
||||
}//}else{//text area
|
||||
text = text.replace(/&#?\w+;/g,entityReplacer);
|
||||
domBuilder.characters(text,0,text.length);
|
||||
return elEndStart;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
return elStartEnd+1;
|
||||
}
|
||||
function fixSelfClosed(source,elStartEnd,tagName,closeMap){
|
||||
//if(tagName in closeMap){
|
||||
var pos = closeMap[tagName];
|
||||
if(pos == null){
|
||||
//console.log(tagName)
|
||||
pos = source.lastIndexOf('</'+tagName+'>')
|
||||
if(pos<elStartEnd){//忘记闭合
|
||||
pos = source.lastIndexOf('</'+tagName)
|
||||
}
|
||||
closeMap[tagName] =pos
|
||||
}
|
||||
return pos<elStartEnd;
|
||||
//}
|
||||
}
|
||||
|
||||
function _copy (source, target) {
|
||||
for (var n in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, n)) {
|
||||
target[n] = source[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
||||
var next= source.charAt(start+2)
|
||||
switch(next){
|
||||
case '-':
|
||||
if(source.charAt(start + 3) === '-'){
|
||||
var end = source.indexOf('-->',start+4);
|
||||
//append comment source.substring(4,end)//<!--
|
||||
if(end>start){
|
||||
domBuilder.comment(source,start+4,end-start-4);
|
||||
return end+3;
|
||||
}else{
|
||||
errorHandler.error("Unclosed comment");
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
//error
|
||||
return -1;
|
||||
}
|
||||
default:
|
||||
if(source.substr(start+3,6) == 'CDATA['){
|
||||
var end = source.indexOf(']]>',start+9);
|
||||
domBuilder.startCDATA();
|
||||
domBuilder.characters(source,start+9,end-start-9);
|
||||
domBuilder.endCDATA()
|
||||
return end+3;
|
||||
}
|
||||
//<!DOCTYPE
|
||||
//startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
|
||||
var matchs = split(source,start);
|
||||
var len = matchs.length;
|
||||
if(len>1 && /!doctype/i.test(matchs[0][0])){
|
||||
var name = matchs[1][0];
|
||||
var pubid = false;
|
||||
var sysid = false;
|
||||
if(len>3){
|
||||
if(/^public$/i.test(matchs[2][0])){
|
||||
pubid = matchs[3][0];
|
||||
sysid = len>4 && matchs[4][0];
|
||||
}else if(/^system$/i.test(matchs[2][0])){
|
||||
sysid = matchs[3][0];
|
||||
}
|
||||
}
|
||||
var lastMatch = matchs[len-1]
|
||||
domBuilder.startDTD(name, pubid, sysid);
|
||||
domBuilder.endDTD();
|
||||
|
||||
return lastMatch.index+lastMatch[0].length
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function parseInstruction(source,start,domBuilder){
|
||||
var end = source.indexOf('?>',start);
|
||||
if(end){
|
||||
var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
|
||||
if(match){
|
||||
var len = match[0].length;
|
||||
domBuilder.processingInstruction(match[1], match[2]) ;
|
||||
return end+2;
|
||||
}else{//error
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function ElementAttributes(){
|
||||
this.attributeNames = {}
|
||||
}
|
||||
ElementAttributes.prototype = {
|
||||
setTagName:function(tagName){
|
||||
if(!tagNamePattern.test(tagName)){
|
||||
throw new Error('invalid tagName:'+tagName)
|
||||
}
|
||||
this.tagName = tagName
|
||||
},
|
||||
addValue:function(qName, value, offset) {
|
||||
if(!tagNamePattern.test(qName)){
|
||||
throw new Error('invalid attribute:'+qName)
|
||||
}
|
||||
this.attributeNames[qName] = this.length;
|
||||
this[this.length++] = {qName:qName,value:value,offset:offset}
|
||||
},
|
||||
length:0,
|
||||
getLocalName:function(i){return this[i].localName},
|
||||
getLocator:function(i){return this[i].locator},
|
||||
getQName:function(i){return this[i].qName},
|
||||
getURI:function(i){return this[i].uri},
|
||||
getValue:function(i){return this[i].value}
|
||||
// ,getIndex:function(uri, localName)){
|
||||
// if(localName){
|
||||
//
|
||||
// }else{
|
||||
// var qName = uri
|
||||
// }
|
||||
// },
|
||||
// getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
|
||||
// getType:function(uri,localName){}
|
||||
// getType:function(i){},
|
||||
}
|
||||
|
||||
|
||||
|
||||
function split(source,start){
|
||||
var match;
|
||||
var buf = [];
|
||||
var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
|
||||
reg.lastIndex = start;
|
||||
reg.exec(source);//skip <
|
||||
while(match = reg.exec(source)){
|
||||
buf.push(match);
|
||||
if(match[1])return buf;
|
||||
}
|
||||
}
|
||||
|
||||
exports.XMLReader = XMLReader;
|
||||
exports.ParseError = ParseError;
|
||||
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"name": "@xmldom/xmldom",
|
||||
"version": "0.8.10",
|
||||
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
||||
"keywords": [
|
||||
"w3c",
|
||||
"dom",
|
||||
"xml",
|
||||
"parser",
|
||||
"javascript",
|
||||
"DOMParser",
|
||||
"XMLSerializer",
|
||||
"ponyfill"
|
||||
],
|
||||
"homepage": "https://github.com/xmldom/xmldom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/xmldom/xmldom.git"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"readme.md",
|
||||
"SECURITY.md",
|
||||
"index.d.ts",
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"format": "prettier --write test",
|
||||
"changelog": "auto-changelog --unreleased-only",
|
||||
"start": "nodemon --watch package.json --watch lib --watch test --exec 'npm --silent run test && npm --silent run lint'",
|
||||
"stryker": "stryker run",
|
||||
"stryker:dry-run": "stryker run -m '' --reporters progress",
|
||||
"test": "jest",
|
||||
"testrelease": "npm test && eslint lib",
|
||||
"version": "./changelog-has-version.sh",
|
||||
"release": "np --no-yarn --test-script testrelease --branch release-0.8.x patch"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@stryker-mutator/core": "5.6.1",
|
||||
"auto-changelog": "2.4.0",
|
||||
"eslint": "8.25.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-plugin-es5": "1.5.0",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"get-stream": "6.0.1",
|
||||
"jest": "27.5.1",
|
||||
"nodemon": "2.0.20",
|
||||
"np": "7.6.2",
|
||||
"prettier": "2.7.1",
|
||||
"xmltest": "1.5.0",
|
||||
"yauzl": "2.10.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/xmldom/xmldom/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"auto-changelog": {
|
||||
"prepend": true,
|
||||
"remote": "upstream",
|
||||
"tagPrefix": "",
|
||||
"template": "./auto-changelog.hbs"
|
||||
}
|
||||
}
|
||||
@@ -1,356 +0,0 @@
|
||||
# @xmldom/xmldom
|
||||
|
||||
***Since version 0.7.0 this package is published to npm as [`@xmldom/xmldom`](https://www.npmjs.com/package/@xmldom/xmldom) and no longer as [`xmldom`](https://www.npmjs.com/package/xmldom), because [we are no longer able to publish `xmldom`](https://github.com/xmldom/xmldom/issues/271).***
|
||||
*For better readability in the docs we will continue to talk about this library as "xmldom".*
|
||||
|
||||
[](https://github.com/xmldom/xmldom/blob/master/LICENSE)
|
||||
[](https://www.npmjs.com/package/@xmldom/xmldom)
|
||||
[](https://snyk.io/advisor/npm-package/@xmldom/xmldom)
|
||||
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
||||
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Ahelp-wanted)
|
||||
[](https://dashboard.stryker-mutator.io/reports/github.com/xmldom/xmldom/master)
|
||||
|
||||
|
||||
xmldom is a javascript [ponyfill](https://ponyfill.com/) to provide the following APIs [that are present in modern browsers](https://caniuse.com/xml-serializer) to other runtimes:
|
||||
- convert an XML string into a DOM tree
|
||||
```
|
||||
new DOMParser().parseFromString(xml, mimeType) => Document
|
||||
```
|
||||
- create, access and modify a DOM tree
|
||||
```
|
||||
new DOMImplementation().createDocument(...) => Document
|
||||
```
|
||||
- serialize a DOM tree back into an XML string
|
||||
```
|
||||
new XMLSerializer().serializeToString(node) => string
|
||||
```
|
||||
|
||||
The target runtimes `xmldom` supports are currently Node >= v10 (ES5) and Rhino ([not tested as part of CI](https://github.com/xmldom/xmldom/discussions/214)).
|
||||
|
||||
When deciding how to fix bugs or implement features, `xmldom` tries to stay as close as possible to the various [related specifications/standards](#specs).
|
||||
As indicated by the version starting with `0.`, this implementation is not feature complete and some implemented features differ from what the specifications describe.
|
||||
**Issues and PRs for such differences are always welcome, even when they only provide a failing test case.**
|
||||
|
||||
This project was forked from it's [original source](https://github.com/jindw/xmldom) in 2019, more details about that transition can be found in the [CHANGELOG](CHANGELOG.md#maintainer-changes).
|
||||
|
||||
## Usage
|
||||
|
||||
### Install:
|
||||
|
||||
> npm install @xmldom/xmldom
|
||||
|
||||
### Example:
|
||||
|
||||
[In NodeJS](examples/nodejs/src/index.js)
|
||||
```javascript
|
||||
const { DOMParser, XMLSerializer } = require('@xmldom/xmldom')
|
||||
|
||||
const source = `<xml xmlns="a">
|
||||
<child>test</child>
|
||||
<child/>
|
||||
</xml>`
|
||||
|
||||
const doc = new DOMParser().parseFromString(source, 'text/xml')
|
||||
|
||||
const serialized = new XMLSerializer().serializeToString(doc)
|
||||
```
|
||||
|
||||
Note: in Typescript ~and ES6~(see #316) you can use the `import` approach, as follows:
|
||||
|
||||
```typescript
|
||||
import { DOMParser } from '@xmldom/xmldom'
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
* [DOMParser](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser):
|
||||
|
||||
```javascript
|
||||
parseFromString(xmlsource,mimeType)
|
||||
```
|
||||
* **options extension** _by xmldom_ (not DOM standard!!)
|
||||
|
||||
```javascript
|
||||
//added the options argument
|
||||
new DOMParser(options)
|
||||
|
||||
//errorHandler is supported
|
||||
new DOMParser({
|
||||
/**
|
||||
* locator is always need for error position info
|
||||
*/
|
||||
locator:{},
|
||||
/**
|
||||
* you can override the errorHandler for xml parser
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
|
||||
*/
|
||||
errorHandler:{warning:function(w){console.warn(w)},error:callback,fatalError:callback}
|
||||
//only callback model
|
||||
//errorHandler:function(level,msg){console.log(level,msg)}
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
* [XMLSerializer](https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer)
|
||||
|
||||
```javascript
|
||||
serializeToString(node)
|
||||
```
|
||||
### DOM level2 method and attribute:
|
||||
|
||||
* [Node](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247)
|
||||
|
||||
readonly class properties (aka `NodeType`),
|
||||
these can be accessed from any `Node` instance `node`:
|
||||
`if (node.nodeType === node.ELEMENT_NODE) {...`
|
||||
|
||||
1. `ELEMENT_NODE` (`1`)
|
||||
2. `ATTRIBUTE_NODE` (`2`)
|
||||
3. `TEXT_NODE` (`3`)
|
||||
4. `CDATA_SECTION_NODE` (`4`)
|
||||
5. `ENTITY_REFERENCE_NODE` (`5`)
|
||||
6. `ENTITY_NODE` (`6`)
|
||||
7. `PROCESSING_INSTRUCTION_NODE` (`7`)
|
||||
8. `COMMENT_NODE` (`8`)
|
||||
9. `DOCUMENT_NODE` (`9`)
|
||||
10. `DOCUMENT_TYPE_NODE` (`10`)
|
||||
11. `DOCUMENT_FRAGMENT_NODE` (`11`)
|
||||
12. `NOTATION_NODE` (`12`)
|
||||
|
||||
attribute:
|
||||
- `nodeValue` | `prefix`
|
||||
|
||||
readonly attribute:
|
||||
- `nodeName` | `nodeType` | `parentNode` | `childNodes` | `firstChild` | `lastChild` | `previousSibling` | `nextSibling` | `attributes` | `ownerDocument` | `namespaceURI` | `localName`
|
||||
|
||||
method:
|
||||
* `insertBefore(newChild, refChild)`
|
||||
* `replaceChild(newChild, oldChild)`
|
||||
* `removeChild(oldChild)`
|
||||
* `appendChild(newChild)`
|
||||
* `hasChildNodes()`
|
||||
* `cloneNode(deep)`
|
||||
* `normalize()`
|
||||
* `isSupported(feature, version)`
|
||||
* `hasAttributes()`
|
||||
* [DOMException](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html)
|
||||
|
||||
extends the Error type thrown as part of DOM API.
|
||||
|
||||
readonly class properties:
|
||||
- `INDEX_SIZE_ERR` (`1`)
|
||||
- `DOMSTRING_SIZE_ERR` (`2`)
|
||||
- `HIERARCHY_REQUEST_ERR` (`3`)
|
||||
- `WRONG_DOCUMENT_ERR` (`4`)
|
||||
- `INVALID_CHARACTER_ERR` (`5`)
|
||||
- `NO_DATA_ALLOWED_ERR` (`6`)
|
||||
- `NO_MODIFICATION_ALLOWED_ERR` (`7`)
|
||||
- `NOT_FOUND_ERR` (`8`)
|
||||
- `NOT_SUPPORTED_ERR` (`9`)
|
||||
- `INUSE_ATTRIBUTE_ERR` (`10`)
|
||||
- `INVALID_STATE_ERR` (`11`)
|
||||
- `SYNTAX_ERR` (`12`)
|
||||
- `INVALID_MODIFICATION_ERR` (`13`)
|
||||
- `NAMESPACE_ERR` (`14`)
|
||||
- `INVALID_ACCESS_ERR` (`15`)
|
||||
|
||||
attributes:
|
||||
- `code` with a value matching one of the above constants.
|
||||
|
||||
* [DOMImplementation](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-102161490)
|
||||
|
||||
method:
|
||||
- `hasFeature(feature, version)`
|
||||
- `createDocumentType(qualifiedName, publicId, systemId)`
|
||||
- `createDocument(namespaceURI, qualifiedName, doctype)`
|
||||
|
||||
* [Document](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#i-Document) : Node
|
||||
|
||||
readonly attribute:
|
||||
- `doctype` | `implementation` | `documentElement`
|
||||
|
||||
method:
|
||||
- `createElement(tagName)`
|
||||
- `createDocumentFragment()`
|
||||
- `createTextNode(data)`
|
||||
- `createComment(data)`
|
||||
- `createCDATASection(data)`
|
||||
- `createProcessingInstruction(target, data)`
|
||||
- `createAttribute(name)`
|
||||
- `createEntityReference(name)`
|
||||
- `getElementsByTagName(tagname)`
|
||||
- `importNode(importedNode, deep)`
|
||||
- `createElementNS(namespaceURI, qualifiedName)`
|
||||
- `createAttributeNS(namespaceURI, qualifiedName)`
|
||||
- `getElementsByTagNameNS(namespaceURI, localName)`
|
||||
- `getElementById(elementId)`
|
||||
|
||||
* [DocumentFragment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-B63ED1A3) : Node
|
||||
* [Element](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614) : Node
|
||||
|
||||
readonly attribute:
|
||||
- `tagName`
|
||||
|
||||
method:
|
||||
- `getAttribute(name)`
|
||||
- `setAttribute(name, value)`
|
||||
- `removeAttribute(name)`
|
||||
- `getAttributeNode(name)`
|
||||
- `setAttributeNode(newAttr)`
|
||||
- `removeAttributeNode(oldAttr)`
|
||||
- `getElementsByTagName(name)`
|
||||
- `getAttributeNS(namespaceURI, localName)`
|
||||
- `setAttributeNS(namespaceURI, qualifiedName, value)`
|
||||
- `removeAttributeNS(namespaceURI, localName)`
|
||||
- `getAttributeNodeNS(namespaceURI, localName)`
|
||||
- `setAttributeNodeNS(newAttr)`
|
||||
- `getElementsByTagNameNS(namespaceURI, localName)`
|
||||
- `hasAttribute(name)`
|
||||
- `hasAttributeNS(namespaceURI, localName)`
|
||||
|
||||
* [Attr](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-637646024) : Node
|
||||
|
||||
attribute:
|
||||
- `value`
|
||||
|
||||
readonly attribute:
|
||||
- `name` | `specified` | `ownerElement`
|
||||
|
||||
* [NodeList](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177)
|
||||
|
||||
readonly attribute:
|
||||
- `length`
|
||||
|
||||
method:
|
||||
- `item(index)`
|
||||
|
||||
* [NamedNodeMap](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1780488922)
|
||||
|
||||
readonly attribute:
|
||||
- `length`
|
||||
|
||||
method:
|
||||
- `getNamedItem(name)`
|
||||
- `setNamedItem(arg)`
|
||||
- `removeNamedItem(name)`
|
||||
- `item(index)`
|
||||
- `getNamedItemNS(namespaceURI, localName)`
|
||||
- `setNamedItemNS(arg)`
|
||||
- `removeNamedItemNS(namespaceURI, localName)`
|
||||
|
||||
* [CharacterData](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-FF21A306) : Node
|
||||
|
||||
method:
|
||||
- `substringData(offset, count)`
|
||||
- `appendData(arg)`
|
||||
- `insertData(offset, arg)`
|
||||
- `deleteData(offset, count)`
|
||||
- `replaceData(offset, count, arg)`
|
||||
|
||||
* [Text](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1312295772) : CharacterData
|
||||
|
||||
method:
|
||||
- `splitText(offset)`
|
||||
|
||||
* [CDATASection](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-667469212)
|
||||
* [Comment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1728279322) : CharacterData
|
||||
|
||||
* [DocumentType](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-412266927)
|
||||
|
||||
readonly attribute:
|
||||
- `name` | `entities` | `notations` | `publicId` | `systemId` | `internalSubset`
|
||||
|
||||
* Notation : Node
|
||||
|
||||
readonly attribute:
|
||||
- `publicId` | `systemId`
|
||||
|
||||
* Entity : Node
|
||||
|
||||
readonly attribute:
|
||||
- `publicId` | `systemId` | `notationName`
|
||||
|
||||
* EntityReference : Node
|
||||
* ProcessingInstruction : Node
|
||||
|
||||
attribute:
|
||||
- `data`
|
||||
readonly attribute:
|
||||
- `target`
|
||||
|
||||
### DOM level 3 support:
|
||||
|
||||
* [Node](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent)
|
||||
|
||||
attribute:
|
||||
- `textContent`
|
||||
|
||||
method:
|
||||
- `isDefaultNamespace(namespaceURI)`
|
||||
- `lookupNamespaceURI(prefix)`
|
||||
|
||||
### DOM extension by xmldom
|
||||
|
||||
* [Node] Source position extension;
|
||||
|
||||
attribute:
|
||||
- `lineNumber` //number starting from `1`
|
||||
- `columnNumber` //number starting from `1`
|
||||
|
||||
## Specs
|
||||
|
||||
The implementation is based on several specifications:
|
||||
|
||||
<!-- Should open in new tab and the links in the SVG should be clickable there! -->
|
||||
<a href="https://raw.githubusercontent.com/xmldom/xmldom/master/docs/specs.svg" target="_blank" rel="noopener noreferrer nofollow" ></a>
|
||||
|
||||
### DOM Parsing and Serialization
|
||||
|
||||
From the [W3C DOM Parsing and Serialization (WD 2016)](https://www.w3.org/TR/2016/WD-DOM-Parsing-20160517/) `xmldom` provides an implementation for the interfaces:
|
||||
- `DOMParser`
|
||||
- `XMLSerializer`
|
||||
|
||||
Note that there are some known deviations between this implementation and the W3 specifications.
|
||||
|
||||
Note: [The latest version of this spec](https://w3c.github.io/DOM-Parsing/) has the status "Editors Draft", since it is under active development. One major change is that [the definition of the `DOMParser` interface has been moved to the HTML spec](https://w3c.github.io/DOM-Parsing/#the-domparser-interface)
|
||||
|
||||
|
||||
### DOM
|
||||
|
||||
The original author claims that xmldom implements [DOM Level 2] in a "fully compatible" way and some parts of [DOM Level 3], but there are not enough tests to prove this. Both Specifications are now superseded by the [DOM Level 4 aka Living standard] wich has a much broader scope than xmldom.
|
||||
|
||||
xmldom implements the following interfaces (most constructors are currently not exposed):
|
||||
- `Attr`
|
||||
- `CDATASection`
|
||||
- `CharacterData`
|
||||
- `Comment`
|
||||
- `Document`
|
||||
- `DocumentFragment`
|
||||
- `DocumentType`
|
||||
- `DOMException` (constructor exposed)
|
||||
- `DOMImplementation` (constructor exposed)
|
||||
- `Element`
|
||||
- `Entity`
|
||||
- `EntityReference`
|
||||
- `LiveNodeList`
|
||||
- `NamedNodeMap`
|
||||
- `Node` (constructor exposed)
|
||||
- `NodeList`
|
||||
- `Notation`
|
||||
- `ProcessingInstruction`
|
||||
- `Text`
|
||||
|
||||
more details are available in the (incomplete) [API Reference](#api-reference) section.
|
||||
|
||||
### HTML
|
||||
|
||||
xmldom does not have any goal of supporting the full spec, but it has some capability to parse, report and serialize things differently when "detecting HTML" (by checking the default namespace).
|
||||
There is an upcoming change to better align the implementation with the latest specs, related to <https://github.com/xmldom/xmldom/issues/203>.
|
||||
|
||||
### SAX, XML, XMLNS
|
||||
|
||||
xmldom has an own SAX parser implementation to do the actual parsing, which implements some interfaces in alignment with the Java interfaces SAX defines:
|
||||
- `XMLReader`
|
||||
- `DOMHandler`
|
||||
|
||||
There is an idea/proposal to make it possible to replace it with something else in <https://github.com/xmldom/xmldom/issues/55>
|
||||
@@ -1,412 +0,0 @@
|
||||
Forge ChangeLog
|
||||
===============
|
||||
|
||||
## 1.3.1 - 2022-03-29
|
||||
|
||||
### Fixes
|
||||
- RFC 3447 and RFC 8017 allow for optional `DigestAlgorithm` `NULL` parameters
|
||||
for `sha*` algorithms and require `NULL` paramters for `md2` and `md5`
|
||||
algorithms.
|
||||
|
||||
## 1.3.0 - 2022-03-17
|
||||
|
||||
### Security
|
||||
- Three RSA PKCS#1 v1.5 signature verification issues were reported by Moosa
|
||||
Yahyazadeh (moosa-yahyazadeh@uiowa.edu).
|
||||
- **HIGH**: Leniency in checking `digestAlgorithm` structure can lead to
|
||||
signature forgery.
|
||||
- The code is lenient in checking the digest algorithm structure. This can
|
||||
allow a crafted structure that steals padding bytes and uses unchecked
|
||||
portion of the PKCS#1 encoded message to forge a signature when a low
|
||||
public exponent is being used. For more information, please see
|
||||
["Bleichenbacher's RSA signature forgery based on implementation
|
||||
error"](https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE/)
|
||||
by Hal Finney.
|
||||
- CVE ID: [CVE-2022-24771](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24771)
|
||||
- GHSA ID: [GHSA-cfm4-qjh2-4765](https://github.com/digitalbazaar/forge/security/advisories/GHSA-cfm4-qjh2-4765)
|
||||
- **HIGH**: Failing to check tailing garbage bytes can lead to signature
|
||||
forgery.
|
||||
- The code does not check for tailing garbage bytes after decoding a
|
||||
`DigestInfo` ASN.1 structure. This can allow padding bytes to be removed
|
||||
and garbage data added to forge a signature when a low public exponent is
|
||||
being used. For more information, please see ["Bleichenbacher's RSA
|
||||
signature forgery based on implementation
|
||||
error"](https://mailarchive.ietf.org/arch/msg/openpgp/5rnE9ZRN1AokBVj3VqblGlP63QE/)
|
||||
by Hal Finney.
|
||||
- CVE ID: [CVE-2022-24772](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24772)
|
||||
- GHSA ID: [GHSA-x4jg-mjrx-434g](https://github.com/digitalbazaar/forge/security/advisories/GHSA-x4jg-mjrx-434g)
|
||||
- **MEDIUM**: Leniency in checking type octet.
|
||||
- `DigestInfo` is not properly checked for proper ASN.1 structure. This can
|
||||
lead to successful verification with signatures that contain invalid
|
||||
structures but a valid digest.
|
||||
- CVE ID: [CVE-2022-24773](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24773)
|
||||
- GHSA ID: [GHSA-2r2c-g63r-vccr](https://github.com/digitalbazaar/forge/security/advisories/GHSA-2r2c-g63r-vccr)
|
||||
|
||||
### Fixed
|
||||
- [asn1] Add fallback to pretty print invalid UTF8 data.
|
||||
- [asn1] `fromDer` is now more strict and will default to ensuring all input
|
||||
bytes are parsed or throw an error. A new option `parseAllBytes` can disable
|
||||
this behavior.
|
||||
- **NOTE**: The previous behavior is being changed since it can lead to
|
||||
security issues with crafted inputs. It is possible that code doing custom
|
||||
DER parsing may need to adapt to this new behavior and optional flag.
|
||||
- [rsa] Add and use a validator to check for proper structure of parsed ASN.1
|
||||
`RSASSA-PKCS-v1_5` `DigestInfo` data. Additionally check that the hash
|
||||
algorithm identifier is a known value from RFC 8017
|
||||
`PKCS1-v1-5DigestAlgorithms`. An invalid `DigestInfo` or algorithm identifier
|
||||
will now throw an error.
|
||||
- **NOTE**: The previous lenient behavior is being changed to be more strict
|
||||
since it could lead to security issues with crafted inputs. It is possible
|
||||
that code may have to handle the errors from these stricter checks.
|
||||
|
||||
### Added
|
||||
- [oid] Added missing RFC 8017 PKCS1-v1-5DigestAlgorithms algorithm
|
||||
identifiers:
|
||||
- `1.2.840.113549.2.2` / `md2`
|
||||
- `2.16.840.1.101.3.4.2.4` / `sha224`
|
||||
- `2.16.840.1.101.3.4.2.5` / `sha512-224`
|
||||
- `2.16.840.1.101.3.4.2.6` / `sha512-256`
|
||||
|
||||
## 1.2.1 - 2022-01-11
|
||||
|
||||
### Fixed
|
||||
- [tests]: Load entire module to improve top-level testing and coverage
|
||||
reporting.
|
||||
- [log]: Refactor logging setup to avoid use of `URLSearchParams`.
|
||||
|
||||
## 1.2.0 - 2022-01-07
|
||||
|
||||
### Fixed
|
||||
- [x509] 'Expected' and 'Actual' issuers were backwards in verification failure
|
||||
message.
|
||||
|
||||
### Added
|
||||
- [oid,x509]: Added OID `1.3.14.3.2.29 / sha1WithRSASignature` for sha1 with
|
||||
RSA. Considered a deprecated equivalent to `1.2.840.113549.1.1.5 /
|
||||
sha1WithRSAEncryption`. See [discussion and
|
||||
links](https://github.com/digitalbazaar/forge/issues/825).
|
||||
|
||||
### Changed
|
||||
- [x509]: Reduce duplicate code. Add helper function to create a signature
|
||||
digest given an signature algorithm OID. Add helper function to verify
|
||||
signatures.
|
||||
|
||||
## 1.1.0 - 2022-01-06
|
||||
|
||||
### Fixed
|
||||
- [x509]: Correctly compute certificate issuer and subject hashes to match
|
||||
behavior of openssl.
|
||||
- [pem]: Accept certificate requests with "NEW" in the label. "BEGIN NEW
|
||||
CERTIFICATE REQUEST" handled as "BEGIN CERTIFICATE REQUEST".
|
||||
|
||||
## 1.0.0 - 2022-01-04
|
||||
|
||||
### Notes
|
||||
- **1.0.0**!
|
||||
- This project is over a decade old! Time for a 1.0.0 release.
|
||||
- The URL related changes may expose bugs in some of the networking related
|
||||
code (unrelated to the much wider used cryptography code). The automated and
|
||||
manual test coverage for this code is weak at best. Issues or patches to
|
||||
update the code or tests would be appreciated.
|
||||
|
||||
### Removed
|
||||
- **SECURITY**, **BREAKING**: Remove `forge.debug` API. The API has the
|
||||
potential for prototype pollution. This API was only briefly used by the
|
||||
maintainers for internal project debug purposes and was never intended to be
|
||||
used with untrusted user inputs. This API was not documented or advertised
|
||||
and is being removed rather than fixed.
|
||||
- **SECURITY**, **BREAKING**: Remove `forge.util.parseUrl()` (and
|
||||
`forge.http.parseUrl` alias) and use the [WHATWG URL
|
||||
Standard](https://url.spec.whatwg.org/). `URL` is supported by modern browers
|
||||
and modern Node.js. This change is needed to address URL parsing security
|
||||
issues. If `forge.util.parseUrl()` is used directly or through `forge.xhr` or
|
||||
`forge.http` APIs, and support is needed for environments without `URL`
|
||||
support, then a polyfill must be used.
|
||||
- **BREAKING**: Remove `forge.task` API. This API was never used, documented,
|
||||
or advertised by the maintainers. If anyone was using this API and wishes to
|
||||
continue development it in other project, please let the maintainers know.
|
||||
Due to use in the test suite, a modified version is located in
|
||||
`tests/support/`.
|
||||
- **BREAKING**: Remove `forge.util.makeLink`, `forge.util.makeRequest`,
|
||||
`forge.util.parseFragment`, `forge.util.getQueryVariables`. Replace with
|
||||
`URL`, `URLSearchParams`, and custom code as needed.
|
||||
|
||||
### Changed
|
||||
- **BREAKING**: Increase supported Node.js version to 6.13.0 for URL support.
|
||||
- **BREAKING**: Renamed `master` branch to `main`.
|
||||
- **BREAKING**: Release process updated to use tooling that prefixes versions
|
||||
with `v`. Other tools, scripts, or scanners may need to adapt.
|
||||
- **BREAKING**: Remove docs related to Bower and
|
||||
[forge-dist](https://github.com/digitalbazaar/forge-dist). Install using
|
||||
[another method](./README.md#installation).
|
||||
|
||||
### Added
|
||||
- OIDs for `surname`, `title`, and `givenName`.
|
||||
|
||||
### Fixed
|
||||
- **BREAKING**: OID 2.5.4.5 name fixed from `serialName` to `serialNumber`.
|
||||
Depending on how applications used this id to name association it could cause
|
||||
compatibility issues.
|
||||
|
||||
## 0.10.0 - 2020-09-01
|
||||
|
||||
### Changed
|
||||
- **BREAKING**: Node.js 4 no longer supported. The code *may* still work, and
|
||||
non-invasive patches to keep it working will be considered. However, more
|
||||
modern tools no longer support old Node.js versions making testing difficult.
|
||||
|
||||
### Removed
|
||||
- **BREAKING**: Remove `util.getPath`, `util.setPath`, and `util.deletePath`.
|
||||
`util.setPath` had a potential prototype pollution security issue when used
|
||||
with unsafe inputs. These functions are not used by `forge` itself. They date
|
||||
from an early time when `forge` was targeted at providing general helper
|
||||
functions. The library direction changed to be more focused on cryptography.
|
||||
Many other excellent libraries are more suitable for general utilities. If
|
||||
you need a replacement for these functions, consider `get`, `set`, and `unset`
|
||||
from [lodash](https://lodash.com/). But also consider the potential similar
|
||||
security issues with those APIs.
|
||||
|
||||
## 0.9.2 - 2020-09-01
|
||||
|
||||
### Changed
|
||||
- Added `util.setPath` security note to function docs and to README.
|
||||
|
||||
### Notes
|
||||
- **SECURITY**: The `util.setPath` function has the potential to cause
|
||||
prototype pollution if used with unsafe input.
|
||||
- This function is **not** used internally by `forge`.
|
||||
- The rest of the library is unaffected by this issue.
|
||||
- **Do not** use unsafe input with this function.
|
||||
- Usage with known input should function as expected. (Including input
|
||||
intentionally using potentially problematic keys.)
|
||||
- No code changes will be made to address this issue in 0.9.x. The current
|
||||
behavior *could* be considered a feature rather than a security issue.
|
||||
0.10.0 will be released that removes `util.getPath` and `util.setPath`.
|
||||
Consider `get` and `set` from [lodash](https://lodash.com/) if you need
|
||||
replacements. But also consider the potential similar security issues with
|
||||
those APIs.
|
||||
- https://snyk.io/vuln/SNYK-JS-NODEFORGE-598677
|
||||
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7720
|
||||
|
||||
## 0.9.1 - 2019-09-26
|
||||
|
||||
### Fixed
|
||||
- Ensure DES-CBC given IV is long enough for block size.
|
||||
|
||||
## 0.9.0 - 2019-09-04
|
||||
|
||||
### Added
|
||||
- Add ed25519.publicKeyFromAsn1 and ed25519.privateKeyFromAsn1 APIs.
|
||||
- A few OIDs used in EV certs.
|
||||
|
||||
### Fixed
|
||||
- Improve ed25519 NativeBuffer check.
|
||||
|
||||
## 0.8.5 - 2019-06-18
|
||||
|
||||
### Fixed
|
||||
- Remove use of `const`.
|
||||
|
||||
## 0.8.4 - 2019-05-22
|
||||
|
||||
### Changed
|
||||
- Replace all instances of Node.js `new Buffer` with `Buffer.from` and `Buffer.alloc`.
|
||||
|
||||
## 0.8.3 - 2019-05-15
|
||||
|
||||
### Fixed
|
||||
- Use basic character set for code.
|
||||
|
||||
## 0.8.2 - 2019-03-18
|
||||
|
||||
### Fixed
|
||||
- Fix tag calculation when continuing an AES-GCM block.
|
||||
|
||||
### Changed
|
||||
- Switch to eslint.
|
||||
|
||||
## 0.8.1 - 2019-02-23
|
||||
|
||||
### Fixed
|
||||
- Fix off-by-1 bug with kem random generation.
|
||||
|
||||
## 0.8.0 - 2019-01-31
|
||||
|
||||
### Fixed
|
||||
- Handle creation of certificates with `notBefore` and `notAfter` dates less
|
||||
than Jan 1, 1950 or greater than or equal to Jan 1, 2050.
|
||||
|
||||
### Added
|
||||
- Add OID 2.5.4.13 "description".
|
||||
- Add OID 2.16.840.1.113730.1.13 "nsComment".
|
||||
- Also handle extension when creating a certificate.
|
||||
- `pki.verifyCertificateChain`:
|
||||
- Add `validityCheckDate` option to allow checking the certificate validity
|
||||
period against an arbitrary `Date` or `null` for no check at all. The
|
||||
current date is used by default.
|
||||
- `tls.createConnection`:
|
||||
- Add `verifyOptions` option that passes through to
|
||||
`pki.verifyCertificateChain`. Can be used for the above `validityCheckDate`
|
||||
option.
|
||||
|
||||
### Changed
|
||||
- Support WebCrypto API in web workers.
|
||||
- `rsa.generateKeyPair`:
|
||||
- Use `crypto.generateKeyPair`/`crypto.generateKeyPairSync` on Node.js if
|
||||
available (10.12.0+) and not in pure JS mode.
|
||||
- Use JS fallback in `rsa.generateKeyPair` if `prng` option specified since
|
||||
this isn't supported by current native APIs.
|
||||
- Only run key generation comparison tests if keys will be deterministic.
|
||||
- PhantomJS is deprecated, now using Headless Chrome with Karma.
|
||||
- **Note**: Using Headless Chrome vs PhantomJS may cause newer JS features to
|
||||
slip into releases without proper support for older runtimes and browsers.
|
||||
Please report such issues and they will be addressed.
|
||||
- `pki.verifyCertificateChain`:
|
||||
- Signature changed to `(caStore, chain, options)`. Older `(caStore, chain,
|
||||
verify)` signature is still supported. New style is to to pass in a
|
||||
`verify` option.
|
||||
|
||||
## 0.7.6 - 2018-08-14
|
||||
|
||||
### Added
|
||||
- Test on Node.js 10.x.
|
||||
- Support for PKCS#7 detached signatures.
|
||||
|
||||
### Changed
|
||||
- Improve webpack/browser detection.
|
||||
|
||||
## 0.7.5 - 2018-03-30
|
||||
|
||||
### Fixed
|
||||
- Remove use of `const`.
|
||||
|
||||
## 0.7.4 - 2018-03-07
|
||||
|
||||
### Fixed
|
||||
- Potential regex denial of service in form.js.
|
||||
|
||||
### Added
|
||||
- Support for ED25519.
|
||||
- Support for baseN/base58.
|
||||
|
||||
## 0.7.3 - 2018-03-05
|
||||
|
||||
- Re-publish with npm 5.6.0 due to file timestamp issues.
|
||||
|
||||
## 0.7.2 - 2018-02-27
|
||||
|
||||
### Added
|
||||
- Support verification of SHA-384 certificates.
|
||||
- `1.2.840.10040.4.3'`/`dsa-with-sha1` OID.
|
||||
|
||||
### Fixed
|
||||
- Support importing PKCS#7 data with no certificates. RFC 2315 sec 9.1 states
|
||||
certificates are optional.
|
||||
- `asn1.equals` loop bug.
|
||||
- Fortuna implementation bugs.
|
||||
|
||||
## 0.7.1 - 2017-03-27
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix digestLength for hashes based on SHA-512.
|
||||
|
||||
## 0.7.0 - 2017-02-07
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix test looping bugs so all tests are run.
|
||||
- Improved ASN.1 parsing. Many failure cases eliminated. More sanity checks.
|
||||
Better behavior in default mode of parsing BIT STRINGs. Better handling of
|
||||
parsed BIT STRINGs in `toDer()`. More tests.
|
||||
- Improve X.509 BIT STRING handling by using new capture modes.
|
||||
|
||||
### Changed
|
||||
|
||||
- Major refactor to use CommonJS plus a browser build system.
|
||||
- Updated tests, examples, docs.
|
||||
- Updated dependencies.
|
||||
- Updated flash build system.
|
||||
- Improve OID mapping code.
|
||||
- Change test servers from Python to JavaScript.
|
||||
- Improve PhantomJS support.
|
||||
- Move Bower/bundle support to
|
||||
[forge-dist](https://github.com/digitalbazaar/forge-dist).
|
||||
- **BREAKING**: Require minimal digest algorithm dependencies from individual
|
||||
modules.
|
||||
- Enforce currently supported bit param values for byte buffer access. May be
|
||||
**BREAKING** for code that depended on unspecified and/or incorrect behavior.
|
||||
- Improve `asn1.prettyPrint()` BIT STRING display.
|
||||
|
||||
### Added
|
||||
|
||||
- webpack bundler support via `npm run build`:
|
||||
- Builds `.js`, `.min.js`, and basic sourcemaps.
|
||||
- Basic build: `forge.js`.
|
||||
- Build with extra utils and networking support: `forge.all.js`.
|
||||
- Build WebWorker support: `prime.worker.js`.
|
||||
- Browserify support in package.json.
|
||||
- Karma browser testing.
|
||||
- `forge.options` field.
|
||||
- `forge.options.usePureJavaScript` flag.
|
||||
- `forge.util.isNodejs` flag (used to select "native" APIs).
|
||||
- Run PhantomJS tests in Travis-CI.
|
||||
- Add "Donations" section to README.
|
||||
- Add IRC to "Contact" section of README.
|
||||
- Add "Security Considerations" section to README.
|
||||
- Add pbkdf2 usePureJavaScript test.
|
||||
- Add rsa.generateKeyPair async and usePureJavaScript tests.
|
||||
- Add .editorconfig support.
|
||||
- Add `md.all.js` which includes all digest algorithms.
|
||||
- Add asn1 `equals()` and `copy()`.
|
||||
- Add asn1 `validate()` capture options for BIT STRING contents and value.
|
||||
|
||||
### Removed
|
||||
|
||||
- **BREAKING**: Can no longer call `forge({...})` to create new instances.
|
||||
- Remove a large amount of old cruft.
|
||||
|
||||
### Migration from 0.6.x to 0.7.x
|
||||
|
||||
- (all) If you used the feature to create a new forge instance with new
|
||||
configuration options you will need to rework your code. That ability has
|
||||
been removed due to implementation complexity. The main rare use was to set
|
||||
the option to use pure JavaScript. That is now available as a library global
|
||||
flag `forge.options.usePureJavaScript`.
|
||||
- (npm,bower) If you used the default main file there is little to nothing to
|
||||
change.
|
||||
- (npm) If you accessed a sub-resource like `forge/js/pki` you should either
|
||||
switch to just using the main `forge` and access `forge.pki` or update to
|
||||
`forge/lib/pki`.
|
||||
- (bower) If you used a sub-resource like `forge/js/pki` you should switch to
|
||||
just using `forge` and access `forge.pki`. The bower release bundles
|
||||
everything in one minified file.
|
||||
- (bower) A configured workerScript like
|
||||
`/bower_components/forge/js/prime.worker.js` will need to change to
|
||||
`/bower_components/forge/dist/prime.worker.min.js`.
|
||||
- (all) If you used the networking support or flash socket support, you will
|
||||
need to use a custom build and/or adjust where files are loaded from. This
|
||||
functionality is not included in the bower distribution by default and is
|
||||
also now in a different directory.
|
||||
- (all) The library should now directly support building custom bundles with
|
||||
webpack, browserify, or similar.
|
||||
- (all) If building a custom bundle ensure the correct dependencies are
|
||||
included. In particular, note there is now a `md.all.js` file to include all
|
||||
digest algorithms. Individual files limit what they include by default to
|
||||
allow smaller custom builds. For instance, `pbdkf2.js` has a `sha1` default
|
||||
but does not include any algorithm files by default. This allows the
|
||||
possibility to include only `sha256` without the overhead of `sha1` and
|
||||
`sha512`.
|
||||
|
||||
### Notes
|
||||
|
||||
- This major update requires updating the version to 0.7.x. The existing
|
||||
work-in-progress "0.7.x" branch will be painfully rebased on top of this new
|
||||
0.7.x and moved forward to 0.8.x or later as needed.
|
||||
- 0.7.x is a start of simplifying forge based on common issues and what has
|
||||
appeared to be the most common usage. Please file issues with feedback if the
|
||||
changes are problematic for your use cases.
|
||||
|
||||
## 0.6.x - 2016 and earlier
|
||||
|
||||
- See Git commit log or https://github.com/digitalbazaar/forge.
|
||||
@@ -1,331 +0,0 @@
|
||||
You may use the Forge project under the terms of either the BSD License or the
|
||||
GNU General Public License (GPL) Version 2.
|
||||
|
||||
The BSD License is recommended for most projects. It is simple and easy to
|
||||
understand and it places almost no restrictions on what you can do with the
|
||||
Forge project.
|
||||
|
||||
If the GPL suits your project better you are also free to use Forge under
|
||||
that license.
|
||||
|
||||
You don't have to do anything special to choose one license or the other and
|
||||
you don't have to notify anyone which license you are using. You are free to
|
||||
use this project in commercial projects as long as the copyright header is
|
||||
left intact.
|
||||
|
||||
If you are a commercial entity and use this set of libraries in your
|
||||
commercial software then reasonable payment to Digital Bazaar, if you can
|
||||
afford it, is not required but is expected and would be appreciated. If this
|
||||
library saves you time, then it's saving you money. The cost of developing
|
||||
the Forge software was on the order of several hundred hours and tens of
|
||||
thousands of dollars. We are attempting to strike a balance between helping
|
||||
the development community while not being taken advantage of by lucrative
|
||||
commercial entities for our efforts.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
New BSD License (3-clause)
|
||||
Copyright (c) 2010, Digital Bazaar, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Digital Bazaar, Inc. nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL DIGITAL BAZAAR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"forge.all.min.js","sources":["webpack://[name]/forge.all.min.js"],"mappings":"AAAA","sourceRoot":""}
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"forge.min.js","sources":["webpack://[name]/forge.min.js"],"mappings":"AAAA","sourceRoot":""}
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"prime.worker.min.js","sources":["webpack:///prime.worker.min.js"],"mappings":"AAAA","sourceRoot":""}
|
||||
@@ -1,48 +0,0 @@
|
||||
Forge Flash Support
|
||||
===================
|
||||
|
||||
SocketPool.swf
|
||||
--------------
|
||||
|
||||
Some special networking features can optionally use a Flash component.
|
||||
Building the output SWF file requires the [Flex SDK][]. A pre-built component
|
||||
is included: `swf/SocketPool.swf`.
|
||||
|
||||
Building the output SWF requires the `mxmlc` tool from the [Flex SDK][]. If
|
||||
that tools is already installed then look in the `package.json` file for the
|
||||
commands to rebuild it. If you need the SDK installed, there is a npm module that installs it:
|
||||
|
||||
npm install
|
||||
|
||||
To build a regular component:
|
||||
|
||||
npm run build
|
||||
|
||||
Additional debug support can be built in with the following:
|
||||
|
||||
npm run build-debug
|
||||
|
||||
Policy Server
|
||||
-------------
|
||||
|
||||
Flash support requires the use of a Policy Server.
|
||||
|
||||
### Apache Flash Socket Policy Module
|
||||
|
||||
[mod_fsp](./mod_fsp) provides an [Apache][] module that can serve up a Flash
|
||||
Socket Policy. See `mod_fsp/README` for more details. This module makes it easy
|
||||
to modify an [Apache][] server to allow cross domain requests to be made to it.
|
||||
|
||||
### Simple Python Policy Server
|
||||
|
||||
`policyserver.py` provides a very simple test policy server.
|
||||
|
||||
### Simple Node.js Policy Server
|
||||
|
||||
`policyserver.js` provides a very simple test policy server. If a server is
|
||||
needed for production environments, please use another option such as perhaps
|
||||
[nodejs_socket_policy_server][].
|
||||
|
||||
[Apache]: http://httpd.apache.org/
|
||||
[Flex SDK]: https://flex.apache.org/
|
||||
[nodejs_socket_policy_server]: https://github.com/bichinger/nodejs_socket_policy_server
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "node-forge-flash",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Flash build support for Forge.",
|
||||
"homepage": "https://github.com/digitalbazaar/forge",
|
||||
"author": {
|
||||
"name": "Digital Bazaar, Inc.",
|
||||
"email": "support@digitalbazaar.com",
|
||||
"url": "http://digitalbazaar.com/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"flex-sdk": ""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/digitalbazaar/forge"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/digitalbazaar/forge/issues",
|
||||
"email": "support@digitalbazaar.com"
|
||||
},
|
||||
"license": "(BSD-3-Clause OR GPL-2.0)",
|
||||
"scripts": {
|
||||
"build": "mxmlc -debug=false -define=CONFIG::debugging,false -define=CONFIG::release,true -compiler.source-path=. -static-link-runtime-shared-libraries -output=swf/SocketPool.swf SocketPool.as",
|
||||
"build-debug": "mxmlc -debug=true -define=CONFIG::debugging,true -define=CONFIG::release,false -compiler.source-path=. -static-link-runtime-shared-libraries -output=swf/SocketPool.swf SocketPool.as"
|
||||
}
|
||||
}
|
||||
@@ -1,282 +0,0 @@
|
||||
/**
|
||||
* A Javascript implementation of AES Cipher Suites for TLS.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright (c) 2009-2015 Digital Bazaar, Inc.
|
||||
*
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./aes');
|
||||
require('./tls');
|
||||
|
||||
var tls = module.exports = forge.tls;
|
||||
|
||||
/**
|
||||
* Supported cipher suites.
|
||||
*/
|
||||
tls.CipherSuites['TLS_RSA_WITH_AES_128_CBC_SHA'] = {
|
||||
id: [0x00, 0x2f],
|
||||
name: 'TLS_RSA_WITH_AES_128_CBC_SHA',
|
||||
initSecurityParameters: function(sp) {
|
||||
sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes;
|
||||
sp.cipher_type = tls.CipherType.block;
|
||||
sp.enc_key_length = 16;
|
||||
sp.block_length = 16;
|
||||
sp.fixed_iv_length = 16;
|
||||
sp.record_iv_length = 16;
|
||||
sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1;
|
||||
sp.mac_length = 20;
|
||||
sp.mac_key_length = 20;
|
||||
},
|
||||
initConnectionState: initConnectionState
|
||||
};
|
||||
tls.CipherSuites['TLS_RSA_WITH_AES_256_CBC_SHA'] = {
|
||||
id: [0x00, 0x35],
|
||||
name: 'TLS_RSA_WITH_AES_256_CBC_SHA',
|
||||
initSecurityParameters: function(sp) {
|
||||
sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes;
|
||||
sp.cipher_type = tls.CipherType.block;
|
||||
sp.enc_key_length = 32;
|
||||
sp.block_length = 16;
|
||||
sp.fixed_iv_length = 16;
|
||||
sp.record_iv_length = 16;
|
||||
sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1;
|
||||
sp.mac_length = 20;
|
||||
sp.mac_key_length = 20;
|
||||
},
|
||||
initConnectionState: initConnectionState
|
||||
};
|
||||
|
||||
function initConnectionState(state, c, sp) {
|
||||
var client = (c.entity === forge.tls.ConnectionEnd.client);
|
||||
|
||||
// cipher setup
|
||||
state.read.cipherState = {
|
||||
init: false,
|
||||
cipher: forge.cipher.createDecipher('AES-CBC', client ?
|
||||
sp.keys.server_write_key : sp.keys.client_write_key),
|
||||
iv: client ? sp.keys.server_write_IV : sp.keys.client_write_IV
|
||||
};
|
||||
state.write.cipherState = {
|
||||
init: false,
|
||||
cipher: forge.cipher.createCipher('AES-CBC', client ?
|
||||
sp.keys.client_write_key : sp.keys.server_write_key),
|
||||
iv: client ? sp.keys.client_write_IV : sp.keys.server_write_IV
|
||||
};
|
||||
state.read.cipherFunction = decrypt_aes_cbc_sha1;
|
||||
state.write.cipherFunction = encrypt_aes_cbc_sha1;
|
||||
|
||||
// MAC setup
|
||||
state.read.macLength = state.write.macLength = sp.mac_length;
|
||||
state.read.macFunction = state.write.macFunction = tls.hmac_sha1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypts the TLSCompressed record into a TLSCipherText record using AES
|
||||
* in CBC mode.
|
||||
*
|
||||
* @param record the TLSCompressed record to encrypt.
|
||||
* @param s the ConnectionState to use.
|
||||
*
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
function encrypt_aes_cbc_sha1(record, s) {
|
||||
var rval = false;
|
||||
|
||||
// append MAC to fragment, update sequence number
|
||||
var mac = s.macFunction(s.macKey, s.sequenceNumber, record);
|
||||
record.fragment.putBytes(mac);
|
||||
s.updateSequenceNumber();
|
||||
|
||||
// TLS 1.1+ use an explicit IV every time to protect against CBC attacks
|
||||
var iv;
|
||||
if(record.version.minor === tls.Versions.TLS_1_0.minor) {
|
||||
// use the pre-generated IV when initializing for TLS 1.0, otherwise use
|
||||
// the residue from the previous encryption
|
||||
iv = s.cipherState.init ? null : s.cipherState.iv;
|
||||
} else {
|
||||
iv = forge.random.getBytesSync(16);
|
||||
}
|
||||
|
||||
s.cipherState.init = true;
|
||||
|
||||
// start cipher
|
||||
var cipher = s.cipherState.cipher;
|
||||
cipher.start({iv: iv});
|
||||
|
||||
// TLS 1.1+ write IV into output
|
||||
if(record.version.minor >= tls.Versions.TLS_1_1.minor) {
|
||||
cipher.output.putBytes(iv);
|
||||
}
|
||||
|
||||
// do encryption (default padding is appropriate)
|
||||
cipher.update(record.fragment);
|
||||
if(cipher.finish(encrypt_aes_cbc_sha1_padding)) {
|
||||
// set record fragment to encrypted output
|
||||
record.fragment = cipher.output;
|
||||
record.length = record.fragment.length();
|
||||
rval = true;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles padding for aes_cbc_sha1 in encrypt mode.
|
||||
*
|
||||
* @param blockSize the block size.
|
||||
* @param input the input buffer.
|
||||
* @param decrypt true in decrypt mode, false in encrypt mode.
|
||||
*
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
function encrypt_aes_cbc_sha1_padding(blockSize, input, decrypt) {
|
||||
/* The encrypted data length (TLSCiphertext.length) is one more than the sum
|
||||
of SecurityParameters.block_length, TLSCompressed.length,
|
||||
SecurityParameters.mac_length, and padding_length.
|
||||
|
||||
The padding may be any length up to 255 bytes long, as long as it results in
|
||||
the TLSCiphertext.length being an integral multiple of the block length.
|
||||
Lengths longer than necessary might be desirable to frustrate attacks on a
|
||||
protocol based on analysis of the lengths of exchanged messages. Each uint8
|
||||
in the padding data vector must be filled with the padding length value.
|
||||
|
||||
The padding length should be such that the total size of the
|
||||
GenericBlockCipher structure is a multiple of the cipher's block length.
|
||||
Legal values range from zero to 255, inclusive. This length specifies the
|
||||
length of the padding field exclusive of the padding_length field itself.
|
||||
|
||||
This is slightly different from PKCS#7 because the padding value is 1
|
||||
less than the actual number of padding bytes if you include the
|
||||
padding_length uint8 itself as a padding byte. */
|
||||
if(!decrypt) {
|
||||
// get the number of padding bytes required to reach the blockSize and
|
||||
// subtract 1 for the padding value (to make room for the padding_length
|
||||
// uint8)
|
||||
var padding = blockSize - (input.length() % blockSize);
|
||||
input.fillWithByte(padding - 1, padding);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles padding for aes_cbc_sha1 in decrypt mode.
|
||||
*
|
||||
* @param blockSize the block size.
|
||||
* @param output the output buffer.
|
||||
* @param decrypt true in decrypt mode, false in encrypt mode.
|
||||
*
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
function decrypt_aes_cbc_sha1_padding(blockSize, output, decrypt) {
|
||||
var rval = true;
|
||||
if(decrypt) {
|
||||
/* The last byte in the output specifies the number of padding bytes not
|
||||
including itself. Each of the padding bytes has the same value as that
|
||||
last byte (known as the padding_length). Here we check all padding
|
||||
bytes to ensure they have the value of padding_length even if one of
|
||||
them is bad in order to ward-off timing attacks. */
|
||||
var len = output.length();
|
||||
var paddingLength = output.last();
|
||||
for(var i = len - 1 - paddingLength; i < len - 1; ++i) {
|
||||
rval = rval && (output.at(i) == paddingLength);
|
||||
}
|
||||
if(rval) {
|
||||
// trim off padding bytes and last padding length byte
|
||||
output.truncate(paddingLength + 1);
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypts a TLSCipherText record into a TLSCompressed record using
|
||||
* AES in CBC mode.
|
||||
*
|
||||
* @param record the TLSCipherText record to decrypt.
|
||||
* @param s the ConnectionState to use.
|
||||
*
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
function decrypt_aes_cbc_sha1(record, s) {
|
||||
var rval = false;
|
||||
|
||||
var iv;
|
||||
if(record.version.minor === tls.Versions.TLS_1_0.minor) {
|
||||
// use pre-generated IV when initializing for TLS 1.0, otherwise use the
|
||||
// residue from the previous decryption
|
||||
iv = s.cipherState.init ? null : s.cipherState.iv;
|
||||
} else {
|
||||
// TLS 1.1+ use an explicit IV every time to protect against CBC attacks
|
||||
// that is appended to the record fragment
|
||||
iv = record.fragment.getBytes(16);
|
||||
}
|
||||
|
||||
s.cipherState.init = true;
|
||||
|
||||
// start cipher
|
||||
var cipher = s.cipherState.cipher;
|
||||
cipher.start({iv: iv});
|
||||
|
||||
// do decryption
|
||||
cipher.update(record.fragment);
|
||||
rval = cipher.finish(decrypt_aes_cbc_sha1_padding);
|
||||
|
||||
// even if decryption fails, keep going to minimize timing attacks
|
||||
|
||||
// decrypted data:
|
||||
// first (len - 20) bytes = application data
|
||||
// last 20 bytes = MAC
|
||||
var macLen = s.macLength;
|
||||
|
||||
// create a random MAC to check against should the mac length check fail
|
||||
// Note: do this regardless of the failure to keep timing consistent
|
||||
var mac = forge.random.getBytesSync(macLen);
|
||||
|
||||
// get fragment and mac
|
||||
var len = cipher.output.length();
|
||||
if(len >= macLen) {
|
||||
record.fragment = cipher.output.getBytes(len - macLen);
|
||||
mac = cipher.output.getBytes(macLen);
|
||||
} else {
|
||||
// bad data, but get bytes anyway to try to keep timing consistent
|
||||
record.fragment = cipher.output.getBytes();
|
||||
}
|
||||
record.fragment = forge.util.createBuffer(record.fragment);
|
||||
record.length = record.fragment.length();
|
||||
|
||||
// see if data integrity checks out, update sequence number
|
||||
var mac2 = s.macFunction(s.macKey, s.sequenceNumber, record);
|
||||
s.updateSequenceNumber();
|
||||
rval = compareMacs(s.macKey, mac, mac2) && rval;
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely compare two MACs. This function will compare two MACs in a way
|
||||
* that protects against timing attacks.
|
||||
*
|
||||
* TODO: Expose elsewhere as a utility API.
|
||||
*
|
||||
* See: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/february/double-hmac-verification/
|
||||
*
|
||||
* @param key the MAC key to use.
|
||||
* @param mac1 as a binary-encoded string of bytes.
|
||||
* @param mac2 as a binary-encoded string of bytes.
|
||||
*
|
||||
* @return true if the MACs are the same, false if not.
|
||||
*/
|
||||
function compareMacs(key, mac1, mac2) {
|
||||
var hmac = forge.hmac.create();
|
||||
|
||||
hmac.start('SHA1', key);
|
||||
hmac.update(mac1);
|
||||
mac1 = hmac.digest().getBytes();
|
||||
|
||||
hmac.start(null, null);
|
||||
hmac.update(mac2);
|
||||
mac2 = hmac.digest().getBytes();
|
||||
|
||||
return mac1 === mac2;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2019 Digital Bazaar, Inc.
|
||||
*/
|
||||
|
||||
var forge = require('./forge');
|
||||
require('./asn1');
|
||||
var asn1 = forge.asn1;
|
||||
|
||||
exports.privateKeyValidator = {
|
||||
// PrivateKeyInfo
|
||||
name: 'PrivateKeyInfo',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.SEQUENCE,
|
||||
constructed: true,
|
||||
value: [{
|
||||
// Version (INTEGER)
|
||||
name: 'PrivateKeyInfo.version',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.INTEGER,
|
||||
constructed: false,
|
||||
capture: 'privateKeyVersion'
|
||||
}, {
|
||||
// privateKeyAlgorithm
|
||||
name: 'PrivateKeyInfo.privateKeyAlgorithm',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.SEQUENCE,
|
||||
constructed: true,
|
||||
value: [{
|
||||
name: 'AlgorithmIdentifier.algorithm',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.OID,
|
||||
constructed: false,
|
||||
capture: 'privateKeyOid'
|
||||
}]
|
||||
}, {
|
||||
// PrivateKey
|
||||
name: 'PrivateKeyInfo',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.OCTETSTRING,
|
||||
constructed: false,
|
||||
capture: 'privateKey'
|
||||
}]
|
||||
};
|
||||
|
||||
exports.publicKeyValidator = {
|
||||
name: 'SubjectPublicKeyInfo',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.SEQUENCE,
|
||||
constructed: true,
|
||||
captureAsn1: 'subjectPublicKeyInfo',
|
||||
value: [{
|
||||
name: 'SubjectPublicKeyInfo.AlgorithmIdentifier',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.SEQUENCE,
|
||||
constructed: true,
|
||||
value: [{
|
||||
name: 'AlgorithmIdentifier.algorithm',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.OID,
|
||||
constructed: false,
|
||||
capture: 'publicKeyOid'
|
||||
}]
|
||||
},
|
||||
// capture group for ed25519PublicKey
|
||||
{
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.BITSTRING,
|
||||
constructed: false,
|
||||
composed: true,
|
||||
captureBitStringValue: 'ed25519PublicKey'
|
||||
}
|
||||
// FIXME: this is capture group for rsaPublicKey, use it in this API or
|
||||
// discard?
|
||||
/* {
|
||||
// subjectPublicKey
|
||||
name: 'SubjectPublicKeyInfo.subjectPublicKey',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.BITSTRING,
|
||||
constructed: false,
|
||||
value: [{
|
||||
// RSAPublicKey
|
||||
name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey',
|
||||
tagClass: asn1.Class.UNIVERSAL,
|
||||
type: asn1.Type.SEQUENCE,
|
||||
constructed: true,
|
||||
optional: true,
|
||||
captureAsn1: 'rsaPublicKey'
|
||||
}]
|
||||
} */
|
||||
]
|
||||
};
|
||||
@@ -1,186 +0,0 @@
|
||||
/**
|
||||
* Base-N/Base-X encoding/decoding functions.
|
||||
*
|
||||
* Original implementation from base-x:
|
||||
* https://github.com/cryptocoinjs/base-x
|
||||
*
|
||||
* Which is MIT licensed:
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright base-x contributors (c) 2016
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
var api = {};
|
||||
module.exports = api;
|
||||
|
||||
// baseN alphabet indexes
|
||||
var _reverseAlphabets = {};
|
||||
|
||||
/**
|
||||
* BaseN-encodes a Uint8Array using the given alphabet.
|
||||
*
|
||||
* @param input the Uint8Array to encode.
|
||||
* @param maxline the maximum number of encoded characters per line to use,
|
||||
* defaults to none.
|
||||
*
|
||||
* @return the baseN-encoded output string.
|
||||
*/
|
||||
api.encode = function(input, alphabet, maxline) {
|
||||
if(typeof alphabet !== 'string') {
|
||||
throw new TypeError('"alphabet" must be a string.');
|
||||
}
|
||||
if(maxline !== undefined && typeof maxline !== 'number') {
|
||||
throw new TypeError('"maxline" must be a number.');
|
||||
}
|
||||
|
||||
var output = '';
|
||||
|
||||
if(!(input instanceof Uint8Array)) {
|
||||
// assume forge byte buffer
|
||||
output = _encodeWithByteBuffer(input, alphabet);
|
||||
} else {
|
||||
var i = 0;
|
||||
var base = alphabet.length;
|
||||
var first = alphabet.charAt(0);
|
||||
var digits = [0];
|
||||
for(i = 0; i < input.length; ++i) {
|
||||
for(var j = 0, carry = input[i]; j < digits.length; ++j) {
|
||||
carry += digits[j] << 8;
|
||||
digits[j] = carry % base;
|
||||
carry = (carry / base) | 0;
|
||||
}
|
||||
|
||||
while(carry > 0) {
|
||||
digits.push(carry % base);
|
||||
carry = (carry / base) | 0;
|
||||
}
|
||||
}
|
||||
|
||||
// deal with leading zeros
|
||||
for(i = 0; input[i] === 0 && i < input.length - 1; ++i) {
|
||||
output += first;
|
||||
}
|
||||
// convert digits to a string
|
||||
for(i = digits.length - 1; i >= 0; --i) {
|
||||
output += alphabet[digits[i]];
|
||||
}
|
||||
}
|
||||
|
||||
if(maxline) {
|
||||
var regex = new RegExp('.{1,' + maxline + '}', 'g');
|
||||
output = output.match(regex).join('\r\n');
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a baseN-encoded (using the given alphabet) string to a
|
||||
* Uint8Array.
|
||||
*
|
||||
* @param input the baseN-encoded input string.
|
||||
*
|
||||
* @return the Uint8Array.
|
||||
*/
|
||||
api.decode = function(input, alphabet) {
|
||||
if(typeof input !== 'string') {
|
||||
throw new TypeError('"input" must be a string.');
|
||||
}
|
||||
if(typeof alphabet !== 'string') {
|
||||
throw new TypeError('"alphabet" must be a string.');
|
||||
}
|
||||
|
||||
var table = _reverseAlphabets[alphabet];
|
||||
if(!table) {
|
||||
// compute reverse alphabet
|
||||
table = _reverseAlphabets[alphabet] = [];
|
||||
for(var i = 0; i < alphabet.length; ++i) {
|
||||
table[alphabet.charCodeAt(i)] = i;
|
||||
}
|
||||
}
|
||||
|
||||
// remove whitespace characters
|
||||
input = input.replace(/\s/g, '');
|
||||
|
||||
var base = alphabet.length;
|
||||
var first = alphabet.charAt(0);
|
||||
var bytes = [0];
|
||||
for(var i = 0; i < input.length; i++) {
|
||||
var value = table[input.charCodeAt(i)];
|
||||
if(value === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(var j = 0, carry = value; j < bytes.length; ++j) {
|
||||
carry += bytes[j] * base;
|
||||
bytes[j] = carry & 0xff;
|
||||
carry >>= 8;
|
||||
}
|
||||
|
||||
while(carry > 0) {
|
||||
bytes.push(carry & 0xff);
|
||||
carry >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
// deal with leading zeros
|
||||
for(var k = 0; input[k] === first && k < input.length - 1; ++k) {
|
||||
bytes.push(0);
|
||||
}
|
||||
|
||||
if(typeof Buffer !== 'undefined') {
|
||||
return Buffer.from(bytes.reverse());
|
||||
}
|
||||
|
||||
return new Uint8Array(bytes.reverse());
|
||||
};
|
||||
|
||||
function _encodeWithByteBuffer(input, alphabet) {
|
||||
var i = 0;
|
||||
var base = alphabet.length;
|
||||
var first = alphabet.charAt(0);
|
||||
var digits = [0];
|
||||
for(i = 0; i < input.length(); ++i) {
|
||||
for(var j = 0, carry = input.at(i); j < digits.length; ++j) {
|
||||
carry += digits[j] << 8;
|
||||
digits[j] = carry % base;
|
||||
carry = (carry / base) | 0;
|
||||
}
|
||||
|
||||
while(carry > 0) {
|
||||
digits.push(carry % base);
|
||||
carry = (carry / base) | 0;
|
||||
}
|
||||
}
|
||||
|
||||
var output = '';
|
||||
|
||||
// deal with leading zeros
|
||||
for(i = 0; input.at(i) === 0 && i < input.length() - 1; ++i) {
|
||||
output += first;
|
||||
}
|
||||
// convert digits to a string
|
||||
for(i = digits.length - 1; i >= 0; --i) {
|
||||
output += alphabet[digits[i]];
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
/**
|
||||
* Cipher base API.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright (c) 2010-2014 Digital Bazaar, Inc.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./util');
|
||||
|
||||
module.exports = forge.cipher = forge.cipher || {};
|
||||
|
||||
// registered algorithms
|
||||
forge.cipher.algorithms = forge.cipher.algorithms || {};
|
||||
|
||||
/**
|
||||
* Creates a cipher object that can be used to encrypt data using the given
|
||||
* algorithm and key. The algorithm may be provided as a string value for a
|
||||
* previously registered algorithm or it may be given as a cipher algorithm
|
||||
* API object.
|
||||
*
|
||||
* @param algorithm the algorithm to use, either a string or an algorithm API
|
||||
* object.
|
||||
* @param key the key to use, as a binary-encoded string of bytes or a
|
||||
* byte buffer.
|
||||
*
|
||||
* @return the cipher.
|
||||
*/
|
||||
forge.cipher.createCipher = function(algorithm, key) {
|
||||
var api = algorithm;
|
||||
if(typeof api === 'string') {
|
||||
api = forge.cipher.getAlgorithm(api);
|
||||
if(api) {
|
||||
api = api();
|
||||
}
|
||||
}
|
||||
if(!api) {
|
||||
throw new Error('Unsupported algorithm: ' + algorithm);
|
||||
}
|
||||
|
||||
// assume block cipher
|
||||
return new forge.cipher.BlockCipher({
|
||||
algorithm: api,
|
||||
key: key,
|
||||
decrypt: false
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a decipher object that can be used to decrypt data using the given
|
||||
* algorithm and key. The algorithm may be provided as a string value for a
|
||||
* previously registered algorithm or it may be given as a cipher algorithm
|
||||
* API object.
|
||||
*
|
||||
* @param algorithm the algorithm to use, either a string or an algorithm API
|
||||
* object.
|
||||
* @param key the key to use, as a binary-encoded string of bytes or a
|
||||
* byte buffer.
|
||||
*
|
||||
* @return the cipher.
|
||||
*/
|
||||
forge.cipher.createDecipher = function(algorithm, key) {
|
||||
var api = algorithm;
|
||||
if(typeof api === 'string') {
|
||||
api = forge.cipher.getAlgorithm(api);
|
||||
if(api) {
|
||||
api = api();
|
||||
}
|
||||
}
|
||||
if(!api) {
|
||||
throw new Error('Unsupported algorithm: ' + algorithm);
|
||||
}
|
||||
|
||||
// assume block cipher
|
||||
return new forge.cipher.BlockCipher({
|
||||
algorithm: api,
|
||||
key: key,
|
||||
decrypt: true
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Registers an algorithm by name. If the name was already registered, the
|
||||
* algorithm API object will be overwritten.
|
||||
*
|
||||
* @param name the name of the algorithm.
|
||||
* @param algorithm the algorithm API object.
|
||||
*/
|
||||
forge.cipher.registerAlgorithm = function(name, algorithm) {
|
||||
name = name.toUpperCase();
|
||||
forge.cipher.algorithms[name] = algorithm;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a registered algorithm by name.
|
||||
*
|
||||
* @param name the name of the algorithm.
|
||||
*
|
||||
* @return the algorithm, if found, null if not.
|
||||
*/
|
||||
forge.cipher.getAlgorithm = function(name) {
|
||||
name = name.toUpperCase();
|
||||
if(name in forge.cipher.algorithms) {
|
||||
return forge.cipher.algorithms[name];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var BlockCipher = forge.cipher.BlockCipher = function(options) {
|
||||
this.algorithm = options.algorithm;
|
||||
this.mode = this.algorithm.mode;
|
||||
this.blockSize = this.mode.blockSize;
|
||||
this._finish = false;
|
||||
this._input = null;
|
||||
this.output = null;
|
||||
this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt;
|
||||
this._decrypt = options.decrypt;
|
||||
this.algorithm.initialize(options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts or restarts the encryption or decryption process, whichever
|
||||
* was previously configured.
|
||||
*
|
||||
* For non-GCM mode, the IV may be a binary-encoded string of bytes, an array
|
||||
* of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in
|
||||
* bytes, then it must be Nb (16) bytes in length. If the IV is given in as
|
||||
* 32-bit integers, then it must be 4 integers long.
|
||||
*
|
||||
* Note: an IV is not required or used in ECB mode.
|
||||
*
|
||||
* For GCM-mode, the IV must be given as a binary-encoded string of bytes or
|
||||
* a byte buffer. The number of bytes should be 12 (96 bits) as recommended
|
||||
* by NIST SP-800-38D but another length may be given.
|
||||
*
|
||||
* @param options the options to use:
|
||||
* iv the initialization vector to use as a binary-encoded string of
|
||||
* bytes, null to reuse the last ciphered block from a previous
|
||||
* update() (this "residue" method is for legacy support only).
|
||||
* additionalData additional authentication data as a binary-encoded
|
||||
* string of bytes, for 'GCM' mode, (default: none).
|
||||
* tagLength desired length of authentication tag, in bits, for
|
||||
* 'GCM' mode (0-128, default: 128).
|
||||
* tag the authentication tag to check if decrypting, as a
|
||||
* binary-encoded string of bytes.
|
||||
* output the output the buffer to write to, null to create one.
|
||||
*/
|
||||
BlockCipher.prototype.start = function(options) {
|
||||
options = options || {};
|
||||
var opts = {};
|
||||
for(var key in options) {
|
||||
opts[key] = options[key];
|
||||
}
|
||||
opts.decrypt = this._decrypt;
|
||||
this._finish = false;
|
||||
this._input = forge.util.createBuffer();
|
||||
this.output = options.output || forge.util.createBuffer();
|
||||
this.mode.start(opts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the next block according to the cipher mode.
|
||||
*
|
||||
* @param input the buffer to read from.
|
||||
*/
|
||||
BlockCipher.prototype.update = function(input) {
|
||||
if(input) {
|
||||
// input given, so empty it into the input buffer
|
||||
this._input.putBuffer(input);
|
||||
}
|
||||
|
||||
// do cipher operation until it needs more input and not finished
|
||||
while(!this._op.call(this.mode, this._input, this.output, this._finish) &&
|
||||
!this._finish) {}
|
||||
|
||||
// free consumed memory from input buffer
|
||||
this._input.compact();
|
||||
};
|
||||
|
||||
/**
|
||||
* Finishes encrypting or decrypting.
|
||||
*
|
||||
* @param pad a padding function to use in CBC mode, null for default,
|
||||
* signature(blockSize, buffer, decrypt).
|
||||
*
|
||||
* @return true if successful, false on error.
|
||||
*/
|
||||
BlockCipher.prototype.finish = function(pad) {
|
||||
// backwards-compatibility w/deprecated padding API
|
||||
// Note: will overwrite padding functions even after another start() call
|
||||
if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) {
|
||||
this.mode.pad = function(input) {
|
||||
return pad(this.blockSize, input, false);
|
||||
};
|
||||
this.mode.unpad = function(output) {
|
||||
return pad(this.blockSize, output, true);
|
||||
};
|
||||
}
|
||||
|
||||
// build options for padding and afterFinish functions
|
||||
var options = {};
|
||||
options.decrypt = this._decrypt;
|
||||
|
||||
// get # of bytes that won't fill a block
|
||||
options.overflow = this._input.length() % this.blockSize;
|
||||
|
||||
if(!this._decrypt && this.mode.pad) {
|
||||
if(!this.mode.pad(this._input, options)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// do final update
|
||||
this._finish = true;
|
||||
this.update();
|
||||
|
||||
if(this._decrypt && this.mode.unpad) {
|
||||
if(!this.mode.unpad(this.output, options)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.mode.afterFinish) {
|
||||
if(!this.mode.afterFinish(this.output, options)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
@@ -1,999 +0,0 @@
|
||||
/**
|
||||
* Supported cipher modes.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright (c) 2010-2014 Digital Bazaar, Inc.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./util');
|
||||
|
||||
forge.cipher = forge.cipher || {};
|
||||
|
||||
// supported cipher modes
|
||||
var modes = module.exports = forge.cipher.modes = forge.cipher.modes || {};
|
||||
|
||||
/** Electronic codebook (ECB) (Don't use this; it's not secure) **/
|
||||
|
||||
modes.ecb = function(options) {
|
||||
options = options || {};
|
||||
this.name = 'ECB';
|
||||
this.cipher = options.cipher;
|
||||
this.blockSize = options.blockSize || 16;
|
||||
this._ints = this.blockSize / 4;
|
||||
this._inBlock = new Array(this._ints);
|
||||
this._outBlock = new Array(this._ints);
|
||||
};
|
||||
|
||||
modes.ecb.prototype.start = function(options) {};
|
||||
|
||||
modes.ecb.prototype.encrypt = function(input, output, finish) {
|
||||
// not enough input to encrypt
|
||||
if(input.length() < this.blockSize && !(finish && input.length() > 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// get next block
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = input.getInt32();
|
||||
}
|
||||
|
||||
// encrypt block
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// write output
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(this._outBlock[i]);
|
||||
}
|
||||
};
|
||||
|
||||
modes.ecb.prototype.decrypt = function(input, output, finish) {
|
||||
// not enough input to decrypt
|
||||
if(input.length() < this.blockSize && !(finish && input.length() > 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// get next block
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = input.getInt32();
|
||||
}
|
||||
|
||||
// decrypt block
|
||||
this.cipher.decrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// write output
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(this._outBlock[i]);
|
||||
}
|
||||
};
|
||||
|
||||
modes.ecb.prototype.pad = function(input, options) {
|
||||
// add PKCS#7 padding to block (each pad byte is the
|
||||
// value of the number of pad bytes)
|
||||
var padding = (input.length() === this.blockSize ?
|
||||
this.blockSize : (this.blockSize - input.length()));
|
||||
input.fillWithByte(padding, padding);
|
||||
return true;
|
||||
};
|
||||
|
||||
modes.ecb.prototype.unpad = function(output, options) {
|
||||
// check for error: input data not a multiple of blockSize
|
||||
if(options.overflow > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ensure padding byte count is valid
|
||||
var len = output.length();
|
||||
var count = output.at(len - 1);
|
||||
if(count > (this.blockSize << 2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// trim off padding bytes
|
||||
output.truncate(count);
|
||||
return true;
|
||||
};
|
||||
|
||||
/** Cipher-block Chaining (CBC) **/
|
||||
|
||||
modes.cbc = function(options) {
|
||||
options = options || {};
|
||||
this.name = 'CBC';
|
||||
this.cipher = options.cipher;
|
||||
this.blockSize = options.blockSize || 16;
|
||||
this._ints = this.blockSize / 4;
|
||||
this._inBlock = new Array(this._ints);
|
||||
this._outBlock = new Array(this._ints);
|
||||
};
|
||||
|
||||
modes.cbc.prototype.start = function(options) {
|
||||
// Note: legacy support for using IV residue (has security flaws)
|
||||
// if IV is null, reuse block from previous processing
|
||||
if(options.iv === null) {
|
||||
// must have a previous block
|
||||
if(!this._prev) {
|
||||
throw new Error('Invalid IV parameter.');
|
||||
}
|
||||
this._iv = this._prev.slice(0);
|
||||
} else if(!('iv' in options)) {
|
||||
throw new Error('Invalid IV parameter.');
|
||||
} else {
|
||||
// save IV as "previous" block
|
||||
this._iv = transformIV(options.iv, this.blockSize);
|
||||
this._prev = this._iv.slice(0);
|
||||
}
|
||||
};
|
||||
|
||||
modes.cbc.prototype.encrypt = function(input, output, finish) {
|
||||
// not enough input to encrypt
|
||||
if(input.length() < this.blockSize && !(finish && input.length() > 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// get next block
|
||||
// CBC XOR's IV (or previous block) with plaintext
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = this._prev[i] ^ input.getInt32();
|
||||
}
|
||||
|
||||
// encrypt block
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// write output, save previous block
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(this._outBlock[i]);
|
||||
}
|
||||
this._prev = this._outBlock;
|
||||
};
|
||||
|
||||
modes.cbc.prototype.decrypt = function(input, output, finish) {
|
||||
// not enough input to decrypt
|
||||
if(input.length() < this.blockSize && !(finish && input.length() > 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// get next block
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = input.getInt32();
|
||||
}
|
||||
|
||||
// decrypt block
|
||||
this.cipher.decrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// write output, save previous ciphered block
|
||||
// CBC XOR's IV (or previous block) with ciphertext
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(this._prev[i] ^ this._outBlock[i]);
|
||||
}
|
||||
this._prev = this._inBlock.slice(0);
|
||||
};
|
||||
|
||||
modes.cbc.prototype.pad = function(input, options) {
|
||||
// add PKCS#7 padding to block (each pad byte is the
|
||||
// value of the number of pad bytes)
|
||||
var padding = (input.length() === this.blockSize ?
|
||||
this.blockSize : (this.blockSize - input.length()));
|
||||
input.fillWithByte(padding, padding);
|
||||
return true;
|
||||
};
|
||||
|
||||
modes.cbc.prototype.unpad = function(output, options) {
|
||||
// check for error: input data not a multiple of blockSize
|
||||
if(options.overflow > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ensure padding byte count is valid
|
||||
var len = output.length();
|
||||
var count = output.at(len - 1);
|
||||
if(count > (this.blockSize << 2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// trim off padding bytes
|
||||
output.truncate(count);
|
||||
return true;
|
||||
};
|
||||
|
||||
/** Cipher feedback (CFB) **/
|
||||
|
||||
modes.cfb = function(options) {
|
||||
options = options || {};
|
||||
this.name = 'CFB';
|
||||
this.cipher = options.cipher;
|
||||
this.blockSize = options.blockSize || 16;
|
||||
this._ints = this.blockSize / 4;
|
||||
this._inBlock = null;
|
||||
this._outBlock = new Array(this._ints);
|
||||
this._partialBlock = new Array(this._ints);
|
||||
this._partialOutput = forge.util.createBuffer();
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.cfb.prototype.start = function(options) {
|
||||
if(!('iv' in options)) {
|
||||
throw new Error('Invalid IV parameter.');
|
||||
}
|
||||
// use IV as first input
|
||||
this._iv = transformIV(options.iv, this.blockSize);
|
||||
this._inBlock = this._iv.slice(0);
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.cfb.prototype.encrypt = function(input, output, finish) {
|
||||
// not enough input to encrypt
|
||||
var inputLength = input.length();
|
||||
if(inputLength === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// encrypt block
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// handle full block
|
||||
if(this._partialBytes === 0 && inputLength >= this.blockSize) {
|
||||
// XOR input with output, write input as output
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = input.getInt32() ^ this._outBlock[i];
|
||||
output.putInt32(this._inBlock[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// handle partial block
|
||||
var partialBytes = (this.blockSize - inputLength) % this.blockSize;
|
||||
if(partialBytes > 0) {
|
||||
partialBytes = this.blockSize - partialBytes;
|
||||
}
|
||||
|
||||
// XOR input with output, write input as partial output
|
||||
this._partialOutput.clear();
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._partialBlock[i] = input.getInt32() ^ this._outBlock[i];
|
||||
this._partialOutput.putInt32(this._partialBlock[i]);
|
||||
}
|
||||
|
||||
if(partialBytes > 0) {
|
||||
// block still incomplete, restore input buffer
|
||||
input.read -= this.blockSize;
|
||||
} else {
|
||||
// block complete, update input block
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = this._partialBlock[i];
|
||||
}
|
||||
}
|
||||
|
||||
// skip any previous partial bytes
|
||||
if(this._partialBytes > 0) {
|
||||
this._partialOutput.getBytes(this._partialBytes);
|
||||
}
|
||||
|
||||
if(partialBytes > 0 && !finish) {
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
partialBytes - this._partialBytes));
|
||||
this._partialBytes = partialBytes;
|
||||
return true;
|
||||
}
|
||||
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
inputLength - this._partialBytes));
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.cfb.prototype.decrypt = function(input, output, finish) {
|
||||
// not enough input to decrypt
|
||||
var inputLength = input.length();
|
||||
if(inputLength === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// encrypt block (CFB always uses encryption mode)
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// handle full block
|
||||
if(this._partialBytes === 0 && inputLength >= this.blockSize) {
|
||||
// XOR input with output, write input as output
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = input.getInt32();
|
||||
output.putInt32(this._inBlock[i] ^ this._outBlock[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// handle partial block
|
||||
var partialBytes = (this.blockSize - inputLength) % this.blockSize;
|
||||
if(partialBytes > 0) {
|
||||
partialBytes = this.blockSize - partialBytes;
|
||||
}
|
||||
|
||||
// XOR input with output, write input as partial output
|
||||
this._partialOutput.clear();
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._partialBlock[i] = input.getInt32();
|
||||
this._partialOutput.putInt32(this._partialBlock[i] ^ this._outBlock[i]);
|
||||
}
|
||||
|
||||
if(partialBytes > 0) {
|
||||
// block still incomplete, restore input buffer
|
||||
input.read -= this.blockSize;
|
||||
} else {
|
||||
// block complete, update input block
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = this._partialBlock[i];
|
||||
}
|
||||
}
|
||||
|
||||
// skip any previous partial bytes
|
||||
if(this._partialBytes > 0) {
|
||||
this._partialOutput.getBytes(this._partialBytes);
|
||||
}
|
||||
|
||||
if(partialBytes > 0 && !finish) {
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
partialBytes - this._partialBytes));
|
||||
this._partialBytes = partialBytes;
|
||||
return true;
|
||||
}
|
||||
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
inputLength - this._partialBytes));
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
/** Output feedback (OFB) **/
|
||||
|
||||
modes.ofb = function(options) {
|
||||
options = options || {};
|
||||
this.name = 'OFB';
|
||||
this.cipher = options.cipher;
|
||||
this.blockSize = options.blockSize || 16;
|
||||
this._ints = this.blockSize / 4;
|
||||
this._inBlock = null;
|
||||
this._outBlock = new Array(this._ints);
|
||||
this._partialOutput = forge.util.createBuffer();
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.ofb.prototype.start = function(options) {
|
||||
if(!('iv' in options)) {
|
||||
throw new Error('Invalid IV parameter.');
|
||||
}
|
||||
// use IV as first input
|
||||
this._iv = transformIV(options.iv, this.blockSize);
|
||||
this._inBlock = this._iv.slice(0);
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.ofb.prototype.encrypt = function(input, output, finish) {
|
||||
// not enough input to encrypt
|
||||
var inputLength = input.length();
|
||||
if(input.length() === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// encrypt block (OFB always uses encryption mode)
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// handle full block
|
||||
if(this._partialBytes === 0 && inputLength >= this.blockSize) {
|
||||
// XOR input with output and update next input
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(input.getInt32() ^ this._outBlock[i]);
|
||||
this._inBlock[i] = this._outBlock[i];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// handle partial block
|
||||
var partialBytes = (this.blockSize - inputLength) % this.blockSize;
|
||||
if(partialBytes > 0) {
|
||||
partialBytes = this.blockSize - partialBytes;
|
||||
}
|
||||
|
||||
// XOR input with output
|
||||
this._partialOutput.clear();
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);
|
||||
}
|
||||
|
||||
if(partialBytes > 0) {
|
||||
// block still incomplete, restore input buffer
|
||||
input.read -= this.blockSize;
|
||||
} else {
|
||||
// block complete, update input block
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._inBlock[i] = this._outBlock[i];
|
||||
}
|
||||
}
|
||||
|
||||
// skip any previous partial bytes
|
||||
if(this._partialBytes > 0) {
|
||||
this._partialOutput.getBytes(this._partialBytes);
|
||||
}
|
||||
|
||||
if(partialBytes > 0 && !finish) {
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
partialBytes - this._partialBytes));
|
||||
this._partialBytes = partialBytes;
|
||||
return true;
|
||||
}
|
||||
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
inputLength - this._partialBytes));
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.ofb.prototype.decrypt = modes.ofb.prototype.encrypt;
|
||||
|
||||
/** Counter (CTR) **/
|
||||
|
||||
modes.ctr = function(options) {
|
||||
options = options || {};
|
||||
this.name = 'CTR';
|
||||
this.cipher = options.cipher;
|
||||
this.blockSize = options.blockSize || 16;
|
||||
this._ints = this.blockSize / 4;
|
||||
this._inBlock = null;
|
||||
this._outBlock = new Array(this._ints);
|
||||
this._partialOutput = forge.util.createBuffer();
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.ctr.prototype.start = function(options) {
|
||||
if(!('iv' in options)) {
|
||||
throw new Error('Invalid IV parameter.');
|
||||
}
|
||||
// use IV as first input
|
||||
this._iv = transformIV(options.iv, this.blockSize);
|
||||
this._inBlock = this._iv.slice(0);
|
||||
this._partialBytes = 0;
|
||||
};
|
||||
|
||||
modes.ctr.prototype.encrypt = function(input, output, finish) {
|
||||
// not enough input to encrypt
|
||||
var inputLength = input.length();
|
||||
if(inputLength === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// encrypt block (CTR always uses encryption mode)
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// handle full block
|
||||
if(this._partialBytes === 0 && inputLength >= this.blockSize) {
|
||||
// XOR input with output
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(input.getInt32() ^ this._outBlock[i]);
|
||||
}
|
||||
} else {
|
||||
// handle partial block
|
||||
var partialBytes = (this.blockSize - inputLength) % this.blockSize;
|
||||
if(partialBytes > 0) {
|
||||
partialBytes = this.blockSize - partialBytes;
|
||||
}
|
||||
|
||||
// XOR input with output
|
||||
this._partialOutput.clear();
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);
|
||||
}
|
||||
|
||||
if(partialBytes > 0) {
|
||||
// block still incomplete, restore input buffer
|
||||
input.read -= this.blockSize;
|
||||
}
|
||||
|
||||
// skip any previous partial bytes
|
||||
if(this._partialBytes > 0) {
|
||||
this._partialOutput.getBytes(this._partialBytes);
|
||||
}
|
||||
|
||||
if(partialBytes > 0 && !finish) {
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
partialBytes - this._partialBytes));
|
||||
this._partialBytes = partialBytes;
|
||||
return true;
|
||||
}
|
||||
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
inputLength - this._partialBytes));
|
||||
this._partialBytes = 0;
|
||||
}
|
||||
|
||||
// block complete, increment counter (input block)
|
||||
inc32(this._inBlock);
|
||||
};
|
||||
|
||||
modes.ctr.prototype.decrypt = modes.ctr.prototype.encrypt;
|
||||
|
||||
/** Galois/Counter Mode (GCM) **/
|
||||
|
||||
modes.gcm = function(options) {
|
||||
options = options || {};
|
||||
this.name = 'GCM';
|
||||
this.cipher = options.cipher;
|
||||
this.blockSize = options.blockSize || 16;
|
||||
this._ints = this.blockSize / 4;
|
||||
this._inBlock = new Array(this._ints);
|
||||
this._outBlock = new Array(this._ints);
|
||||
this._partialOutput = forge.util.createBuffer();
|
||||
this._partialBytes = 0;
|
||||
|
||||
// R is actually this value concatenated with 120 more zero bits, but
|
||||
// we only XOR against R so the other zeros have no effect -- we just
|
||||
// apply this value to the first integer in a block
|
||||
this._R = 0xE1000000;
|
||||
};
|
||||
|
||||
modes.gcm.prototype.start = function(options) {
|
||||
if(!('iv' in options)) {
|
||||
throw new Error('Invalid IV parameter.');
|
||||
}
|
||||
// ensure IV is a byte buffer
|
||||
var iv = forge.util.createBuffer(options.iv);
|
||||
|
||||
// no ciphered data processed yet
|
||||
this._cipherLength = 0;
|
||||
|
||||
// default additional data is none
|
||||
var additionalData;
|
||||
if('additionalData' in options) {
|
||||
additionalData = forge.util.createBuffer(options.additionalData);
|
||||
} else {
|
||||
additionalData = forge.util.createBuffer();
|
||||
}
|
||||
|
||||
// default tag length is 128 bits
|
||||
if('tagLength' in options) {
|
||||
this._tagLength = options.tagLength;
|
||||
} else {
|
||||
this._tagLength = 128;
|
||||
}
|
||||
|
||||
// if tag is given, ensure tag matches tag length
|
||||
this._tag = null;
|
||||
if(options.decrypt) {
|
||||
// save tag to check later
|
||||
this._tag = forge.util.createBuffer(options.tag).getBytes();
|
||||
if(this._tag.length !== (this._tagLength / 8)) {
|
||||
throw new Error('Authentication tag does not match tag length.');
|
||||
}
|
||||
}
|
||||
|
||||
// create tmp storage for hash calculation
|
||||
this._hashBlock = new Array(this._ints);
|
||||
|
||||
// no tag generated yet
|
||||
this.tag = null;
|
||||
|
||||
// generate hash subkey
|
||||
// (apply block cipher to "zero" block)
|
||||
this._hashSubkey = new Array(this._ints);
|
||||
this.cipher.encrypt([0, 0, 0, 0], this._hashSubkey);
|
||||
|
||||
// generate table M
|
||||
// use 4-bit tables (32 component decomposition of a 16 byte value)
|
||||
// 8-bit tables take more space and are known to have security
|
||||
// vulnerabilities (in native implementations)
|
||||
this.componentBits = 4;
|
||||
this._m = this.generateHashTable(this._hashSubkey, this.componentBits);
|
||||
|
||||
// Note: support IV length different from 96 bits? (only supporting
|
||||
// 96 bits is recommended by NIST SP-800-38D)
|
||||
// generate J_0
|
||||
var ivLength = iv.length();
|
||||
if(ivLength === 12) {
|
||||
// 96-bit IV
|
||||
this._j0 = [iv.getInt32(), iv.getInt32(), iv.getInt32(), 1];
|
||||
} else {
|
||||
// IV is NOT 96-bits
|
||||
this._j0 = [0, 0, 0, 0];
|
||||
while(iv.length() > 0) {
|
||||
this._j0 = this.ghash(
|
||||
this._hashSubkey, this._j0,
|
||||
[iv.getInt32(), iv.getInt32(), iv.getInt32(), iv.getInt32()]);
|
||||
}
|
||||
this._j0 = this.ghash(
|
||||
this._hashSubkey, this._j0, [0, 0].concat(from64To32(ivLength * 8)));
|
||||
}
|
||||
|
||||
// generate ICB (initial counter block)
|
||||
this._inBlock = this._j0.slice(0);
|
||||
inc32(this._inBlock);
|
||||
this._partialBytes = 0;
|
||||
|
||||
// consume authentication data
|
||||
additionalData = forge.util.createBuffer(additionalData);
|
||||
// save additional data length as a BE 64-bit number
|
||||
this._aDataLength = from64To32(additionalData.length() * 8);
|
||||
// pad additional data to 128 bit (16 byte) block size
|
||||
var overflow = additionalData.length() % this.blockSize;
|
||||
if(overflow) {
|
||||
additionalData.fillWithByte(0, this.blockSize - overflow);
|
||||
}
|
||||
this._s = [0, 0, 0, 0];
|
||||
while(additionalData.length() > 0) {
|
||||
this._s = this.ghash(this._hashSubkey, this._s, [
|
||||
additionalData.getInt32(),
|
||||
additionalData.getInt32(),
|
||||
additionalData.getInt32(),
|
||||
additionalData.getInt32()
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
modes.gcm.prototype.encrypt = function(input, output, finish) {
|
||||
// not enough input to encrypt
|
||||
var inputLength = input.length();
|
||||
if(inputLength === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// encrypt block
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// handle full block
|
||||
if(this._partialBytes === 0 && inputLength >= this.blockSize) {
|
||||
// XOR input with output
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(this._outBlock[i] ^= input.getInt32());
|
||||
}
|
||||
this._cipherLength += this.blockSize;
|
||||
} else {
|
||||
// handle partial block
|
||||
var partialBytes = (this.blockSize - inputLength) % this.blockSize;
|
||||
if(partialBytes > 0) {
|
||||
partialBytes = this.blockSize - partialBytes;
|
||||
}
|
||||
|
||||
// XOR input with output
|
||||
this._partialOutput.clear();
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]);
|
||||
}
|
||||
|
||||
if(partialBytes <= 0 || finish) {
|
||||
// handle overflow prior to hashing
|
||||
if(finish) {
|
||||
// get block overflow
|
||||
var overflow = inputLength % this.blockSize;
|
||||
this._cipherLength += overflow;
|
||||
// truncate for hash function
|
||||
this._partialOutput.truncate(this.blockSize - overflow);
|
||||
} else {
|
||||
this._cipherLength += this.blockSize;
|
||||
}
|
||||
|
||||
// get output block for hashing
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this._outBlock[i] = this._partialOutput.getInt32();
|
||||
}
|
||||
this._partialOutput.read -= this.blockSize;
|
||||
}
|
||||
|
||||
// skip any previous partial bytes
|
||||
if(this._partialBytes > 0) {
|
||||
this._partialOutput.getBytes(this._partialBytes);
|
||||
}
|
||||
|
||||
if(partialBytes > 0 && !finish) {
|
||||
// block still incomplete, restore input buffer, get partial output,
|
||||
// and return early
|
||||
input.read -= this.blockSize;
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
partialBytes - this._partialBytes));
|
||||
this._partialBytes = partialBytes;
|
||||
return true;
|
||||
}
|
||||
|
||||
output.putBytes(this._partialOutput.getBytes(
|
||||
inputLength - this._partialBytes));
|
||||
this._partialBytes = 0;
|
||||
}
|
||||
|
||||
// update hash block S
|
||||
this._s = this.ghash(this._hashSubkey, this._s, this._outBlock);
|
||||
|
||||
// increment counter (input block)
|
||||
inc32(this._inBlock);
|
||||
};
|
||||
|
||||
modes.gcm.prototype.decrypt = function(input, output, finish) {
|
||||
// not enough input to decrypt
|
||||
var inputLength = input.length();
|
||||
if(inputLength < this.blockSize && !(finish && inputLength > 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// encrypt block (GCM always uses encryption mode)
|
||||
this.cipher.encrypt(this._inBlock, this._outBlock);
|
||||
|
||||
// increment counter (input block)
|
||||
inc32(this._inBlock);
|
||||
|
||||
// update hash block S
|
||||
this._hashBlock[0] = input.getInt32();
|
||||
this._hashBlock[1] = input.getInt32();
|
||||
this._hashBlock[2] = input.getInt32();
|
||||
this._hashBlock[3] = input.getInt32();
|
||||
this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock);
|
||||
|
||||
// XOR hash input with output
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
output.putInt32(this._outBlock[i] ^ this._hashBlock[i]);
|
||||
}
|
||||
|
||||
// increment cipher data length
|
||||
if(inputLength < this.blockSize) {
|
||||
this._cipherLength += inputLength % this.blockSize;
|
||||
} else {
|
||||
this._cipherLength += this.blockSize;
|
||||
}
|
||||
};
|
||||
|
||||
modes.gcm.prototype.afterFinish = function(output, options) {
|
||||
var rval = true;
|
||||
|
||||
// handle overflow
|
||||
if(options.decrypt && options.overflow) {
|
||||
output.truncate(this.blockSize - options.overflow);
|
||||
}
|
||||
|
||||
// handle authentication tag
|
||||
this.tag = forge.util.createBuffer();
|
||||
|
||||
// concatenate additional data length with cipher length
|
||||
var lengths = this._aDataLength.concat(from64To32(this._cipherLength * 8));
|
||||
|
||||
// include lengths in hash
|
||||
this._s = this.ghash(this._hashSubkey, this._s, lengths);
|
||||
|
||||
// do GCTR(J_0, S)
|
||||
var tag = [];
|
||||
this.cipher.encrypt(this._j0, tag);
|
||||
for(var i = 0; i < this._ints; ++i) {
|
||||
this.tag.putInt32(this._s[i] ^ tag[i]);
|
||||
}
|
||||
|
||||
// trim tag to length
|
||||
this.tag.truncate(this.tag.length() % (this._tagLength / 8));
|
||||
|
||||
// check authentication tag
|
||||
if(options.decrypt && this.tag.bytes() !== this._tag) {
|
||||
rval = false;
|
||||
}
|
||||
|
||||
return rval;
|
||||
};
|
||||
|
||||
/**
|
||||
* See NIST SP-800-38D 6.3 (Algorithm 1). This function performs Galois
|
||||
* field multiplication. The field, GF(2^128), is defined by the polynomial:
|
||||
*
|
||||
* x^128 + x^7 + x^2 + x + 1
|
||||
*
|
||||
* Which is represented in little-endian binary form as: 11100001 (0xe1). When
|
||||
* the value of a coefficient is 1, a bit is set. The value R, is the
|
||||
* concatenation of this value and 120 zero bits, yielding a 128-bit value
|
||||
* which matches the block size.
|
||||
*
|
||||
* This function will multiply two elements (vectors of bytes), X and Y, in
|
||||
* the field GF(2^128). The result is initialized to zero. For each bit of
|
||||
* X (out of 128), x_i, if x_i is set, then the result is multiplied (XOR'd)
|
||||
* by the current value of Y. For each bit, the value of Y will be raised by
|
||||
* a power of x (multiplied by the polynomial x). This can be achieved by
|
||||
* shifting Y once to the right. If the current value of Y, prior to being
|
||||
* multiplied by x, has 0 as its LSB, then it is a 127th degree polynomial.
|
||||
* Otherwise, we must divide by R after shifting to find the remainder.
|
||||
*
|
||||
* @param x the first block to multiply by the second.
|
||||
* @param y the second block to multiply by the first.
|
||||
*
|
||||
* @return the block result of the multiplication.
|
||||
*/
|
||||
modes.gcm.prototype.multiply = function(x, y) {
|
||||
var z_i = [0, 0, 0, 0];
|
||||
var v_i = y.slice(0);
|
||||
|
||||
// calculate Z_128 (block has 128 bits)
|
||||
for(var i = 0; i < 128; ++i) {
|
||||
// if x_i is 0, Z_{i+1} = Z_i (unchanged)
|
||||
// else Z_{i+1} = Z_i ^ V_i
|
||||
// get x_i by finding 32-bit int position, then left shift 1 by remainder
|
||||
var x_i = x[(i / 32) | 0] & (1 << (31 - i % 32));
|
||||
if(x_i) {
|
||||
z_i[0] ^= v_i[0];
|
||||
z_i[1] ^= v_i[1];
|
||||
z_i[2] ^= v_i[2];
|
||||
z_i[3] ^= v_i[3];
|
||||
}
|
||||
|
||||
// if LSB(V_i) is 1, V_i = V_i >> 1
|
||||
// else V_i = (V_i >> 1) ^ R
|
||||
this.pow(v_i, v_i);
|
||||
}
|
||||
|
||||
return z_i;
|
||||
};
|
||||
|
||||
modes.gcm.prototype.pow = function(x, out) {
|
||||
// if LSB(x) is 1, x = x >>> 1
|
||||
// else x = (x >>> 1) ^ R
|
||||
var lsb = x[3] & 1;
|
||||
|
||||
// always do x >>> 1:
|
||||
// starting with the rightmost integer, shift each integer to the right
|
||||
// one bit, pulling in the bit from the integer to the left as its top
|
||||
// most bit (do this for the last 3 integers)
|
||||
for(var i = 3; i > 0; --i) {
|
||||
out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31);
|
||||
}
|
||||
// shift the first integer normally
|
||||
out[0] = x[0] >>> 1;
|
||||
|
||||
// if lsb was not set, then polynomial had a degree of 127 and doesn't
|
||||
// need to divided; otherwise, XOR with R to find the remainder; we only
|
||||
// need to XOR the first integer since R technically ends w/120 zero bits
|
||||
if(lsb) {
|
||||
out[0] ^= this._R;
|
||||
}
|
||||
};
|
||||
|
||||
modes.gcm.prototype.tableMultiply = function(x) {
|
||||
// assumes 4-bit tables are used
|
||||
var z = [0, 0, 0, 0];
|
||||
for(var i = 0; i < 32; ++i) {
|
||||
var idx = (i / 8) | 0;
|
||||
var x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF;
|
||||
var ah = this._m[i][x_i];
|
||||
z[0] ^= ah[0];
|
||||
z[1] ^= ah[1];
|
||||
z[2] ^= ah[2];
|
||||
z[3] ^= ah[3];
|
||||
}
|
||||
return z;
|
||||
};
|
||||
|
||||
/**
|
||||
* A continuing version of the GHASH algorithm that operates on a single
|
||||
* block. The hash block, last hash value (Ym) and the new block to hash
|
||||
* are given.
|
||||
*
|
||||
* @param h the hash block.
|
||||
* @param y the previous value for Ym, use [0, 0, 0, 0] for a new hash.
|
||||
* @param x the block to hash.
|
||||
*
|
||||
* @return the hashed value (Ym).
|
||||
*/
|
||||
modes.gcm.prototype.ghash = function(h, y, x) {
|
||||
y[0] ^= x[0];
|
||||
y[1] ^= x[1];
|
||||
y[2] ^= x[2];
|
||||
y[3] ^= x[3];
|
||||
return this.tableMultiply(y);
|
||||
//return this.multiply(y, h);
|
||||
};
|
||||
|
||||
/**
|
||||
* Precomputes a table for multiplying against the hash subkey. This
|
||||
* mechanism provides a substantial speed increase over multiplication
|
||||
* performed without a table. The table-based multiplication this table is
|
||||
* for solves X * H by multiplying each component of X by H and then
|
||||
* composing the results together using XOR.
|
||||
*
|
||||
* This function can be used to generate tables with different bit sizes
|
||||
* for the components, however, this implementation assumes there are
|
||||
* 32 components of X (which is a 16 byte vector), therefore each component
|
||||
* takes 4-bits (so the table is constructed with bits=4).
|
||||
*
|
||||
* @param h the hash subkey.
|
||||
* @param bits the bit size for a component.
|
||||
*/
|
||||
modes.gcm.prototype.generateHashTable = function(h, bits) {
|
||||
// TODO: There are further optimizations that would use only the
|
||||
// first table M_0 (or some variant) along with a remainder table;
|
||||
// this can be explored in the future
|
||||
var multiplier = 8 / bits;
|
||||
var perInt = 4 * multiplier;
|
||||
var size = 16 * multiplier;
|
||||
var m = new Array(size);
|
||||
for(var i = 0; i < size; ++i) {
|
||||
var tmp = [0, 0, 0, 0];
|
||||
var idx = (i / perInt) | 0;
|
||||
var shft = ((perInt - 1 - (i % perInt)) * bits);
|
||||
tmp[idx] = (1 << (bits - 1)) << shft;
|
||||
m[i] = this.generateSubHashTable(this.multiply(tmp, h), bits);
|
||||
}
|
||||
return m;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates a table for multiplying against the hash subkey for one
|
||||
* particular component (out of all possible component values).
|
||||
*
|
||||
* @param mid the pre-multiplied value for the middle key of the table.
|
||||
* @param bits the bit size for a component.
|
||||
*/
|
||||
modes.gcm.prototype.generateSubHashTable = function(mid, bits) {
|
||||
// compute the table quickly by minimizing the number of
|
||||
// POW operations -- they only need to be performed for powers of 2,
|
||||
// all other entries can be composed from those powers using XOR
|
||||
var size = 1 << bits;
|
||||
var half = size >>> 1;
|
||||
var m = new Array(size);
|
||||
m[half] = mid.slice(0);
|
||||
var i = half >>> 1;
|
||||
while(i > 0) {
|
||||
// raise m0[2 * i] and store in m0[i]
|
||||
this.pow(m[2 * i], m[i] = []);
|
||||
i >>= 1;
|
||||
}
|
||||
i = 2;
|
||||
while(i < half) {
|
||||
for(var j = 1; j < i; ++j) {
|
||||
var m_i = m[i];
|
||||
var m_j = m[j];
|
||||
m[i + j] = [
|
||||
m_i[0] ^ m_j[0],
|
||||
m_i[1] ^ m_j[1],
|
||||
m_i[2] ^ m_j[2],
|
||||
m_i[3] ^ m_j[3]
|
||||
];
|
||||
}
|
||||
i *= 2;
|
||||
}
|
||||
m[0] = [0, 0, 0, 0];
|
||||
/* Note: We could avoid storing these by doing composition during multiply
|
||||
calculate top half using composition by speed is preferred. */
|
||||
for(i = half + 1; i < size; ++i) {
|
||||
var c = m[i ^ half];
|
||||
m[i] = [mid[0] ^ c[0], mid[1] ^ c[1], mid[2] ^ c[2], mid[3] ^ c[3]];
|
||||
}
|
||||
return m;
|
||||
};
|
||||
|
||||
/** Utility functions */
|
||||
|
||||
function transformIV(iv, blockSize) {
|
||||
if(typeof iv === 'string') {
|
||||
// convert iv string into byte buffer
|
||||
iv = forge.util.createBuffer(iv);
|
||||
}
|
||||
|
||||
if(forge.util.isArray(iv) && iv.length > 4) {
|
||||
// convert iv byte array into byte buffer
|
||||
var tmp = iv;
|
||||
iv = forge.util.createBuffer();
|
||||
for(var i = 0; i < tmp.length; ++i) {
|
||||
iv.putByte(tmp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(iv.length() < blockSize) {
|
||||
throw new Error(
|
||||
'Invalid IV length; got ' + iv.length() +
|
||||
' bytes and expected ' + blockSize + ' bytes.');
|
||||
}
|
||||
|
||||
if(!forge.util.isArray(iv)) {
|
||||
// convert iv byte buffer into 32-bit integer array
|
||||
var ints = [];
|
||||
var blocks = blockSize / 4;
|
||||
for(var i = 0; i < blocks; ++i) {
|
||||
ints.push(iv.getInt32());
|
||||
}
|
||||
iv = ints;
|
||||
}
|
||||
|
||||
return iv;
|
||||
}
|
||||
|
||||
function inc32(block) {
|
||||
// increment last 32 bits of block only
|
||||
block[block.length - 1] = (block[block.length - 1] + 1) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
function from64To32(num) {
|
||||
// convert 64-bit number to two BE Int32s
|
||||
return [(num / 0x100000000) | 0, num & 0xFFFFFFFF];
|
||||
}
|
||||
@@ -1,496 +0,0 @@
|
||||
/**
|
||||
* DES (Data Encryption Standard) implementation.
|
||||
*
|
||||
* This implementation supports DES as well as 3DES-EDE in ECB and CBC mode.
|
||||
* It is based on the BSD-licensed implementation by Paul Tero:
|
||||
*
|
||||
* Paul Tero, July 2001
|
||||
* http://www.tero.co.uk/des/
|
||||
*
|
||||
* Optimised for performance with large blocks by
|
||||
* Michael Hayworth, November 2001
|
||||
* http://www.netdealing.com
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @author Stefan Siegl
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
|
||||
* Copyright (c) 2012-2014 Digital Bazaar, Inc.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./cipher');
|
||||
require('./cipherModes');
|
||||
require('./util');
|
||||
|
||||
/* DES API */
|
||||
module.exports = forge.des = forge.des || {};
|
||||
|
||||
/**
|
||||
* Deprecated. Instead, use:
|
||||
*
|
||||
* var cipher = forge.cipher.createCipher('DES-<mode>', key);
|
||||
* cipher.start({iv: iv});
|
||||
*
|
||||
* Creates an DES cipher object to encrypt data using the given symmetric key.
|
||||
* The output will be stored in the 'output' member of the returned cipher.
|
||||
*
|
||||
* The key and iv may be given as binary-encoded strings of bytes or
|
||||
* byte buffers.
|
||||
*
|
||||
* @param key the symmetric key to use (64 or 192 bits).
|
||||
* @param iv the initialization vector to use.
|
||||
* @param output the buffer to write to, null to create one.
|
||||
* @param mode the cipher mode to use (default: 'CBC' if IV is
|
||||
* given, 'ECB' if null).
|
||||
*
|
||||
* @return the cipher.
|
||||
*/
|
||||
forge.des.startEncrypting = function(key, iv, output, mode) {
|
||||
var cipher = _createCipher({
|
||||
key: key,
|
||||
output: output,
|
||||
decrypt: false,
|
||||
mode: mode || (iv === null ? 'ECB' : 'CBC')
|
||||
});
|
||||
cipher.start(iv);
|
||||
return cipher;
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated. Instead, use:
|
||||
*
|
||||
* var cipher = forge.cipher.createCipher('DES-<mode>', key);
|
||||
*
|
||||
* Creates an DES cipher object to encrypt data using the given symmetric key.
|
||||
*
|
||||
* The key may be given as a binary-encoded string of bytes or a byte buffer.
|
||||
*
|
||||
* @param key the symmetric key to use (64 or 192 bits).
|
||||
* @param mode the cipher mode to use (default: 'CBC').
|
||||
*
|
||||
* @return the cipher.
|
||||
*/
|
||||
forge.des.createEncryptionCipher = function(key, mode) {
|
||||
return _createCipher({
|
||||
key: key,
|
||||
output: null,
|
||||
decrypt: false,
|
||||
mode: mode
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated. Instead, use:
|
||||
*
|
||||
* var decipher = forge.cipher.createDecipher('DES-<mode>', key);
|
||||
* decipher.start({iv: iv});
|
||||
*
|
||||
* Creates an DES cipher object to decrypt data using the given symmetric key.
|
||||
* The output will be stored in the 'output' member of the returned cipher.
|
||||
*
|
||||
* The key and iv may be given as binary-encoded strings of bytes or
|
||||
* byte buffers.
|
||||
*
|
||||
* @param key the symmetric key to use (64 or 192 bits).
|
||||
* @param iv the initialization vector to use.
|
||||
* @param output the buffer to write to, null to create one.
|
||||
* @param mode the cipher mode to use (default: 'CBC' if IV is
|
||||
* given, 'ECB' if null).
|
||||
*
|
||||
* @return the cipher.
|
||||
*/
|
||||
forge.des.startDecrypting = function(key, iv, output, mode) {
|
||||
var cipher = _createCipher({
|
||||
key: key,
|
||||
output: output,
|
||||
decrypt: true,
|
||||
mode: mode || (iv === null ? 'ECB' : 'CBC')
|
||||
});
|
||||
cipher.start(iv);
|
||||
return cipher;
|
||||
};
|
||||
|
||||
/**
|
||||
* Deprecated. Instead, use:
|
||||
*
|
||||
* var decipher = forge.cipher.createDecipher('DES-<mode>', key);
|
||||
*
|
||||
* Creates an DES cipher object to decrypt data using the given symmetric key.
|
||||
*
|
||||
* The key may be given as a binary-encoded string of bytes or a byte buffer.
|
||||
*
|
||||
* @param key the symmetric key to use (64 or 192 bits).
|
||||
* @param mode the cipher mode to use (default: 'CBC').
|
||||
*
|
||||
* @return the cipher.
|
||||
*/
|
||||
forge.des.createDecryptionCipher = function(key, mode) {
|
||||
return _createCipher({
|
||||
key: key,
|
||||
output: null,
|
||||
decrypt: true,
|
||||
mode: mode
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new DES cipher algorithm object.
|
||||
*
|
||||
* @param name the name of the algorithm.
|
||||
* @param mode the mode factory function.
|
||||
*
|
||||
* @return the DES algorithm object.
|
||||
*/
|
||||
forge.des.Algorithm = function(name, mode) {
|
||||
var self = this;
|
||||
self.name = name;
|
||||
self.mode = new mode({
|
||||
blockSize: 8,
|
||||
cipher: {
|
||||
encrypt: function(inBlock, outBlock) {
|
||||
return _updateBlock(self._keys, inBlock, outBlock, false);
|
||||
},
|
||||
decrypt: function(inBlock, outBlock) {
|
||||
return _updateBlock(self._keys, inBlock, outBlock, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
self._init = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes this DES algorithm by expanding its key.
|
||||
*
|
||||
* @param options the options to use.
|
||||
* key the key to use with this algorithm.
|
||||
* decrypt true if the algorithm should be initialized for decryption,
|
||||
* false for encryption.
|
||||
*/
|
||||
forge.des.Algorithm.prototype.initialize = function(options) {
|
||||
if(this._init) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = forge.util.createBuffer(options.key);
|
||||
if(this.name.indexOf('3DES') === 0) {
|
||||
if(key.length() !== 24) {
|
||||
throw new Error('Invalid Triple-DES key size: ' + key.length() * 8);
|
||||
}
|
||||
}
|
||||
|
||||
// do key expansion to 16 or 48 subkeys (single or triple DES)
|
||||
this._keys = _createKeys(key);
|
||||
this._init = true;
|
||||
};
|
||||
|
||||
/** Register DES algorithms **/
|
||||
|
||||
registerAlgorithm('DES-ECB', forge.cipher.modes.ecb);
|
||||
registerAlgorithm('DES-CBC', forge.cipher.modes.cbc);
|
||||
registerAlgorithm('DES-CFB', forge.cipher.modes.cfb);
|
||||
registerAlgorithm('DES-OFB', forge.cipher.modes.ofb);
|
||||
registerAlgorithm('DES-CTR', forge.cipher.modes.ctr);
|
||||
|
||||
registerAlgorithm('3DES-ECB', forge.cipher.modes.ecb);
|
||||
registerAlgorithm('3DES-CBC', forge.cipher.modes.cbc);
|
||||
registerAlgorithm('3DES-CFB', forge.cipher.modes.cfb);
|
||||
registerAlgorithm('3DES-OFB', forge.cipher.modes.ofb);
|
||||
registerAlgorithm('3DES-CTR', forge.cipher.modes.ctr);
|
||||
|
||||
function registerAlgorithm(name, mode) {
|
||||
var factory = function() {
|
||||
return new forge.des.Algorithm(name, mode);
|
||||
};
|
||||
forge.cipher.registerAlgorithm(name, factory);
|
||||
}
|
||||
|
||||
/** DES implementation **/
|
||||
|
||||
var spfunction1 = [0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004];
|
||||
var spfunction2 = [-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000];
|
||||
var spfunction3 = [0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200];
|
||||
var spfunction4 = [0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080];
|
||||
var spfunction5 = [0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100];
|
||||
var spfunction6 = [0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010];
|
||||
var spfunction7 = [0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002];
|
||||
var spfunction8 = [0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000];
|
||||
|
||||
/**
|
||||
* Create necessary sub keys.
|
||||
*
|
||||
* @param key the 64-bit or 192-bit key.
|
||||
*
|
||||
* @return the expanded keys.
|
||||
*/
|
||||
function _createKeys(key) {
|
||||
var pc2bytes0 = [0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204],
|
||||
pc2bytes1 = [0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101],
|
||||
pc2bytes2 = [0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808],
|
||||
pc2bytes3 = [0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000],
|
||||
pc2bytes4 = [0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010],
|
||||
pc2bytes5 = [0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420],
|
||||
pc2bytes6 = [0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002],
|
||||
pc2bytes7 = [0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800],
|
||||
pc2bytes8 = [0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002],
|
||||
pc2bytes9 = [0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408],
|
||||
pc2bytes10 = [0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020],
|
||||
pc2bytes11 = [0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200],
|
||||
pc2bytes12 = [0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010],
|
||||
pc2bytes13 = [0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105];
|
||||
|
||||
// how many iterations (1 for des, 3 for triple des)
|
||||
// changed by Paul 16/6/2007 to use Triple DES for 9+ byte keys
|
||||
var iterations = key.length() > 8 ? 3 : 1;
|
||||
|
||||
// stores the return keys
|
||||
var keys = [];
|
||||
|
||||
// now define the left shifts which need to be done
|
||||
var shifts = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0];
|
||||
|
||||
var n = 0, tmp;
|
||||
for(var j = 0; j < iterations; j++) {
|
||||
var left = key.getInt32();
|
||||
var right = key.getInt32();
|
||||
|
||||
tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 4);
|
||||
|
||||
tmp = ((right >>> -16) ^ left) & 0x0000ffff;
|
||||
left ^= tmp;
|
||||
right ^= (tmp << -16);
|
||||
|
||||
tmp = ((left >>> 2) ^ right) & 0x33333333;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 2);
|
||||
|
||||
tmp = ((right >>> -16) ^ left) & 0x0000ffff;
|
||||
left ^= tmp;
|
||||
right ^= (tmp << -16);
|
||||
|
||||
tmp = ((left >>> 1) ^ right) & 0x55555555;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 1);
|
||||
|
||||
tmp = ((right >>> 8) ^ left) & 0x00ff00ff;
|
||||
left ^= tmp;
|
||||
right ^= (tmp << 8);
|
||||
|
||||
tmp = ((left >>> 1) ^ right) & 0x55555555;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 1);
|
||||
|
||||
// right needs to be shifted and OR'd with last four bits of left
|
||||
tmp = (left << 8) | ((right >>> 20) & 0x000000f0);
|
||||
|
||||
// left needs to be put upside down
|
||||
left = ((right << 24) | ((right << 8) & 0xff0000) |
|
||||
((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0));
|
||||
right = tmp;
|
||||
|
||||
// now go through and perform these shifts on the left and right keys
|
||||
for(var i = 0; i < shifts.length; ++i) {
|
||||
//shift the keys either one or two bits to the left
|
||||
if(shifts[i]) {
|
||||
left = (left << 2) | (left >>> 26);
|
||||
right = (right << 2) | (right >>> 26);
|
||||
} else {
|
||||
left = (left << 1) | (left >>> 27);
|
||||
right = (right << 1) | (right >>> 27);
|
||||
}
|
||||
left &= -0xf;
|
||||
right &= -0xf;
|
||||
|
||||
// now apply PC-2, in such a way that E is easier when encrypting or
|
||||
// decrypting this conversion will look like PC-2 except only the last 6
|
||||
// bits of each byte are used rather than 48 consecutive bits and the
|
||||
// order of lines will be according to how the S selection functions will
|
||||
// be applied: S2, S4, S6, S8, S1, S3, S5, S7
|
||||
var lefttmp = (
|
||||
pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf] |
|
||||
pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf] |
|
||||
pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf] |
|
||||
pc2bytes6[(left >>> 4) & 0xf]);
|
||||
var righttmp = (
|
||||
pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf] |
|
||||
pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf] |
|
||||
pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf] |
|
||||
pc2bytes13[(right >>> 4) & 0xf]);
|
||||
tmp = ((righttmp >>> 16) ^ lefttmp) & 0x0000ffff;
|
||||
keys[n++] = lefttmp ^ tmp;
|
||||
keys[n++] = righttmp ^ (tmp << 16);
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a single block (1 byte) using DES. The update will either
|
||||
* encrypt or decrypt the block.
|
||||
*
|
||||
* @param keys the expanded keys.
|
||||
* @param input the input block (an array of 32-bit words).
|
||||
* @param output the updated output block.
|
||||
* @param decrypt true to decrypt the block, false to encrypt it.
|
||||
*/
|
||||
function _updateBlock(keys, input, output, decrypt) {
|
||||
// set up loops for single or triple DES
|
||||
var iterations = keys.length === 32 ? 3 : 9;
|
||||
var looping;
|
||||
if(iterations === 3) {
|
||||
looping = decrypt ? [30, -2, -2] : [0, 32, 2];
|
||||
} else {
|
||||
looping = (decrypt ?
|
||||
[94, 62, -2, 32, 64, 2, 30, -2, -2] :
|
||||
[0, 32, 2, 62, 30, -2, 64, 96, 2]);
|
||||
}
|
||||
|
||||
var tmp;
|
||||
|
||||
var left = input[0];
|
||||
var right = input[1];
|
||||
|
||||
// first each 64 bit chunk of the message must be permuted according to IP
|
||||
tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 4);
|
||||
|
||||
tmp = ((left >>> 16) ^ right) & 0x0000ffff;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 16);
|
||||
|
||||
tmp = ((right >>> 2) ^ left) & 0x33333333;
|
||||
left ^= tmp;
|
||||
right ^= (tmp << 2);
|
||||
|
||||
tmp = ((right >>> 8) ^ left) & 0x00ff00ff;
|
||||
left ^= tmp;
|
||||
right ^= (tmp << 8);
|
||||
|
||||
tmp = ((left >>> 1) ^ right) & 0x55555555;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 1);
|
||||
|
||||
// rotate left 1 bit
|
||||
left = ((left << 1) | (left >>> 31));
|
||||
right = ((right << 1) | (right >>> 31));
|
||||
|
||||
for(var j = 0; j < iterations; j += 3) {
|
||||
var endloop = looping[j + 1];
|
||||
var loopinc = looping[j + 2];
|
||||
|
||||
// now go through and perform the encryption or decryption
|
||||
for(var i = looping[j]; i != endloop; i += loopinc) {
|
||||
var right1 = right ^ keys[i];
|
||||
var right2 = ((right >>> 4) | (right << 28)) ^ keys[i + 1];
|
||||
|
||||
// passing these bytes through the S selection functions
|
||||
tmp = left;
|
||||
left = right;
|
||||
right = tmp ^ (
|
||||
spfunction2[(right1 >>> 24) & 0x3f] |
|
||||
spfunction4[(right1 >>> 16) & 0x3f] |
|
||||
spfunction6[(right1 >>> 8) & 0x3f] |
|
||||
spfunction8[right1 & 0x3f] |
|
||||
spfunction1[(right2 >>> 24) & 0x3f] |
|
||||
spfunction3[(right2 >>> 16) & 0x3f] |
|
||||
spfunction5[(right2 >>> 8) & 0x3f] |
|
||||
spfunction7[right2 & 0x3f]);
|
||||
}
|
||||
// unreverse left and right
|
||||
tmp = left;
|
||||
left = right;
|
||||
right = tmp;
|
||||
}
|
||||
|
||||
// rotate right 1 bit
|
||||
left = ((left >>> 1) | (left << 31));
|
||||
right = ((right >>> 1) | (right << 31));
|
||||
|
||||
// now perform IP-1, which is IP in the opposite direction
|
||||
tmp = ((left >>> 1) ^ right) & 0x55555555;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 1);
|
||||
|
||||
tmp = ((right >>> 8) ^ left) & 0x00ff00ff;
|
||||
left ^= tmp;
|
||||
right ^= (tmp << 8);
|
||||
|
||||
tmp = ((right >>> 2) ^ left) & 0x33333333;
|
||||
left ^= tmp;
|
||||
right ^= (tmp << 2);
|
||||
|
||||
tmp = ((left >>> 16) ^ right) & 0x0000ffff;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 16);
|
||||
|
||||
tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f;
|
||||
right ^= tmp;
|
||||
left ^= (tmp << 4);
|
||||
|
||||
output[0] = left;
|
||||
output[1] = right;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated. Instead, use:
|
||||
*
|
||||
* forge.cipher.createCipher('DES-<mode>', key);
|
||||
* forge.cipher.createDecipher('DES-<mode>', key);
|
||||
*
|
||||
* Creates a deprecated DES cipher object. This object's mode will default to
|
||||
* CBC (cipher-block-chaining).
|
||||
*
|
||||
* The key may be given as a binary-encoded string of bytes or a byte buffer.
|
||||
*
|
||||
* @param options the options to use.
|
||||
* key the symmetric key to use (64 or 192 bits).
|
||||
* output the buffer to write to.
|
||||
* decrypt true for decryption, false for encryption.
|
||||
* mode the cipher mode to use (default: 'CBC').
|
||||
*
|
||||
* @return the cipher.
|
||||
*/
|
||||
function _createCipher(options) {
|
||||
options = options || {};
|
||||
var mode = (options.mode || 'CBC').toUpperCase();
|
||||
var algorithm = 'DES-' + mode;
|
||||
|
||||
var cipher;
|
||||
if(options.decrypt) {
|
||||
cipher = forge.cipher.createDecipher(algorithm, options.key);
|
||||
} else {
|
||||
cipher = forge.cipher.createCipher(algorithm, options.key);
|
||||
}
|
||||
|
||||
// backwards compatible start API
|
||||
var start = cipher.start;
|
||||
cipher.start = function(iv, options) {
|
||||
// backwards compatibility: support second arg as output buffer
|
||||
var output = null;
|
||||
if(options instanceof forge.util.ByteBuffer) {
|
||||
output = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
options.output = output;
|
||||
options.iv = iv;
|
||||
start.call(cipher, options);
|
||||
};
|
||||
|
||||
return cipher;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Node.js module for Forge.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright 2011-2016 Digital Bazaar, Inc.
|
||||
*/
|
||||
module.exports = {
|
||||
// default options
|
||||
options: {
|
||||
usePureJavaScript: false
|
||||
}
|
||||
};
|
||||
@@ -1,149 +0,0 @@
|
||||
/**
|
||||
* Functions for manipulating web forms.
|
||||
*
|
||||
* @author David I. Lehn <dlehn@digitalbazaar.com>
|
||||
* @author Dave Longley
|
||||
* @author Mike Johnson
|
||||
*
|
||||
* Copyright (c) 2011-2014 Digital Bazaar, Inc. All rights reserved.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
|
||||
/* Form API */
|
||||
var form = module.exports = forge.form = forge.form || {};
|
||||
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* Regex for parsing a single name property (handles array brackets).
|
||||
*/
|
||||
var _regex = /([^\[]*?)\[(.*?)\]/g;
|
||||
|
||||
/**
|
||||
* Parses a single name property into an array with the name and any
|
||||
* array indices.
|
||||
*
|
||||
* @param name the name to parse.
|
||||
*
|
||||
* @return the array of the name and its array indices in order.
|
||||
*/
|
||||
var _parseName = function(name) {
|
||||
var rval = [];
|
||||
|
||||
var matches;
|
||||
while(!!(matches = _regex.exec(name))) {
|
||||
if(matches[1].length > 0) {
|
||||
rval.push(matches[1]);
|
||||
}
|
||||
if(matches.length >= 2) {
|
||||
rval.push(matches[2]);
|
||||
}
|
||||
}
|
||||
if(rval.length === 0) {
|
||||
rval.push(name);
|
||||
}
|
||||
|
||||
return rval;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a field from the given form to the given object.
|
||||
*
|
||||
* @param obj the object.
|
||||
* @param names the field as an array of object property names.
|
||||
* @param value the value of the field.
|
||||
* @param dict a dictionary of names to replace.
|
||||
*/
|
||||
var _addField = function(obj, names, value, dict) {
|
||||
// combine array names that fall within square brackets
|
||||
var tmp = [];
|
||||
for(var i = 0; i < names.length; ++i) {
|
||||
// check name for starting square bracket but no ending one
|
||||
var name = names[i];
|
||||
if(name.indexOf('[') !== -1 && name.indexOf(']') === -1 &&
|
||||
i < names.length - 1) {
|
||||
do {
|
||||
name += '.' + names[++i];
|
||||
} while(i < names.length - 1 && names[i].indexOf(']') === -1);
|
||||
}
|
||||
tmp.push(name);
|
||||
}
|
||||
names = tmp;
|
||||
|
||||
// split out array indexes
|
||||
var tmp = [];
|
||||
$.each(names, function(n, name) {
|
||||
tmp = tmp.concat(_parseName(name));
|
||||
});
|
||||
names = tmp;
|
||||
|
||||
// iterate over object property names until value is set
|
||||
$.each(names, function(n, name) {
|
||||
// do dictionary name replacement
|
||||
if(dict && name.length !== 0 && name in dict) {
|
||||
name = dict[name];
|
||||
}
|
||||
|
||||
// blank name indicates appending to an array, set name to
|
||||
// new last index of array
|
||||
if(name.length === 0) {
|
||||
name = obj.length;
|
||||
}
|
||||
|
||||
// value already exists, append value
|
||||
if(obj[name]) {
|
||||
// last name in the field
|
||||
if(n == names.length - 1) {
|
||||
// more than one value, so convert into an array
|
||||
if(!$.isArray(obj[name])) {
|
||||
obj[name] = [obj[name]];
|
||||
}
|
||||
obj[name].push(value);
|
||||
} else {
|
||||
// not last name, go deeper into object
|
||||
obj = obj[name];
|
||||
}
|
||||
} else if(n == names.length - 1) {
|
||||
// new value, last name in the field, set value
|
||||
obj[name] = value;
|
||||
} else {
|
||||
// new value, not last name, go deeper
|
||||
// get next name
|
||||
var next = names[n + 1];
|
||||
|
||||
// blank next value indicates array-appending, so create array
|
||||
if(next.length === 0) {
|
||||
obj[name] = [];
|
||||
} else {
|
||||
// if next name is a number create an array, otherwise a map
|
||||
var isNum = ((next - 0) == next && next.length > 0);
|
||||
obj[name] = isNum ? [] : {};
|
||||
}
|
||||
obj = obj[name];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes a form to a JSON object. Object properties will be separated
|
||||
* using the given separator (defaults to '.') and by square brackets.
|
||||
*
|
||||
* @param input the jquery form to serialize.
|
||||
* @param sep the object-property separator (defaults to '.').
|
||||
* @param dict a dictionary of names to replace (name=replace).
|
||||
*
|
||||
* @return the JSON-serialized form.
|
||||
*/
|
||||
form.serialize = function(input, sep, dict) {
|
||||
var rval = {};
|
||||
|
||||
// add all fields in the form to the object
|
||||
sep = sep || '.';
|
||||
$.each(input.serializeArray(), function() {
|
||||
_addField(rval, this.name.split(sep), this.value || '', dict);
|
||||
});
|
||||
|
||||
return rval;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -1,146 +0,0 @@
|
||||
/**
|
||||
* Hash-based Message Authentication Code implementation. Requires a message
|
||||
* digest object that can be obtained, for example, from forge.md.sha1 or
|
||||
* forge.md.md5.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright (c) 2010-2012 Digital Bazaar, Inc. All rights reserved.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./md');
|
||||
require('./util');
|
||||
|
||||
/* HMAC API */
|
||||
var hmac = module.exports = forge.hmac = forge.hmac || {};
|
||||
|
||||
/**
|
||||
* Creates an HMAC object that uses the given message digest object.
|
||||
*
|
||||
* @return an HMAC object.
|
||||
*/
|
||||
hmac.create = function() {
|
||||
// the hmac key to use
|
||||
var _key = null;
|
||||
|
||||
// the message digest to use
|
||||
var _md = null;
|
||||
|
||||
// the inner padding
|
||||
var _ipadding = null;
|
||||
|
||||
// the outer padding
|
||||
var _opadding = null;
|
||||
|
||||
// hmac context
|
||||
var ctx = {};
|
||||
|
||||
/**
|
||||
* Starts or restarts the HMAC with the given key and message digest.
|
||||
*
|
||||
* @param md the message digest to use, null to reuse the previous one,
|
||||
* a string to use builtin 'sha1', 'md5', 'sha256'.
|
||||
* @param key the key to use as a string, array of bytes, byte buffer,
|
||||
* or null to reuse the previous key.
|
||||
*/
|
||||
ctx.start = function(md, key) {
|
||||
if(md !== null) {
|
||||
if(typeof md === 'string') {
|
||||
// create builtin message digest
|
||||
md = md.toLowerCase();
|
||||
if(md in forge.md.algorithms) {
|
||||
_md = forge.md.algorithms[md].create();
|
||||
} else {
|
||||
throw new Error('Unknown hash algorithm "' + md + '"');
|
||||
}
|
||||
} else {
|
||||
// store message digest
|
||||
_md = md;
|
||||
}
|
||||
}
|
||||
|
||||
if(key === null) {
|
||||
// reuse previous key
|
||||
key = _key;
|
||||
} else {
|
||||
if(typeof key === 'string') {
|
||||
// convert string into byte buffer
|
||||
key = forge.util.createBuffer(key);
|
||||
} else if(forge.util.isArray(key)) {
|
||||
// convert byte array into byte buffer
|
||||
var tmp = key;
|
||||
key = forge.util.createBuffer();
|
||||
for(var i = 0; i < tmp.length; ++i) {
|
||||
key.putByte(tmp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// if key is longer than blocksize, hash it
|
||||
var keylen = key.length();
|
||||
if(keylen > _md.blockLength) {
|
||||
_md.start();
|
||||
_md.update(key.bytes());
|
||||
key = _md.digest();
|
||||
}
|
||||
|
||||
// mix key into inner and outer padding
|
||||
// ipadding = [0x36 * blocksize] ^ key
|
||||
// opadding = [0x5C * blocksize] ^ key
|
||||
_ipadding = forge.util.createBuffer();
|
||||
_opadding = forge.util.createBuffer();
|
||||
keylen = key.length();
|
||||
for(var i = 0; i < keylen; ++i) {
|
||||
var tmp = key.at(i);
|
||||
_ipadding.putByte(0x36 ^ tmp);
|
||||
_opadding.putByte(0x5C ^ tmp);
|
||||
}
|
||||
|
||||
// if key is shorter than blocksize, add additional padding
|
||||
if(keylen < _md.blockLength) {
|
||||
var tmp = _md.blockLength - keylen;
|
||||
for(var i = 0; i < tmp; ++i) {
|
||||
_ipadding.putByte(0x36);
|
||||
_opadding.putByte(0x5C);
|
||||
}
|
||||
}
|
||||
_key = key;
|
||||
_ipadding = _ipadding.bytes();
|
||||
_opadding = _opadding.bytes();
|
||||
}
|
||||
|
||||
// digest is done like so: hash(opadding | hash(ipadding | message))
|
||||
|
||||
// prepare to do inner hash
|
||||
// hash(ipadding | message)
|
||||
_md.start();
|
||||
_md.update(_ipadding);
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the HMAC with the given message bytes.
|
||||
*
|
||||
* @param bytes the bytes to update with.
|
||||
*/
|
||||
ctx.update = function(bytes) {
|
||||
_md.update(bytes);
|
||||
};
|
||||
|
||||
/**
|
||||
* Produces the Message Authentication Code (MAC).
|
||||
*
|
||||
* @return a byte buffer containing the digest value.
|
||||
*/
|
||||
ctx.getMac = function() {
|
||||
// digest is done like so: hash(opadding | hash(ipadding | message))
|
||||
// here we do the outer hashing
|
||||
var inner = _md.digest().bytes();
|
||||
_md.start();
|
||||
_md.update(_opadding);
|
||||
_md.update(inner);
|
||||
return _md.digest();
|
||||
};
|
||||
// alias for getMac
|
||||
ctx.digest = ctx.getMac;
|
||||
|
||||
return ctx;
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Node.js module for Forge with extra utils and networking.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright 2011-2016 Digital Bazaar, Inc.
|
||||
*/
|
||||
module.exports = require('./forge');
|
||||
// require core forge
|
||||
require('./index');
|
||||
// additional utils and networking support
|
||||
require('./form');
|
||||
require('./socket');
|
||||
require('./tlssocket');
|
||||
require('./http');
|
||||
require('./xhr');
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Node.js module for Forge.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright 2011-2016 Digital Bazaar, Inc.
|
||||
*/
|
||||
module.exports = require('./forge');
|
||||
require('./aes');
|
||||
require('./aesCipherSuites');
|
||||
require('./asn1');
|
||||
require('./cipher');
|
||||
require('./des');
|
||||
require('./ed25519');
|
||||
require('./hmac');
|
||||
require('./kem');
|
||||
require('./log');
|
||||
require('./md.all');
|
||||
require('./mgf1');
|
||||
require('./pbkdf2');
|
||||
require('./pem');
|
||||
require('./pkcs1');
|
||||
require('./pkcs12');
|
||||
require('./pkcs7');
|
||||
require('./pki');
|
||||
require('./prime');
|
||||
require('./prng');
|
||||
require('./pss');
|
||||
require('./random');
|
||||
require('./rc2');
|
||||
require('./ssh');
|
||||
require('./tls');
|
||||
require('./util');
|
||||
@@ -1,168 +0,0 @@
|
||||
/**
|
||||
* Javascript implementation of RSA-KEM.
|
||||
*
|
||||
* @author Lautaro Cozzani Rodriguez
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright (c) 2014 Lautaro Cozzani <lautaro.cozzani@scytl.com>
|
||||
* Copyright (c) 2014 Digital Bazaar, Inc.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./util');
|
||||
require('./random');
|
||||
require('./jsbn');
|
||||
|
||||
module.exports = forge.kem = forge.kem || {};
|
||||
|
||||
var BigInteger = forge.jsbn.BigInteger;
|
||||
|
||||
/**
|
||||
* The API for the RSA Key Encapsulation Mechanism (RSA-KEM) from ISO 18033-2.
|
||||
*/
|
||||
forge.kem.rsa = {};
|
||||
|
||||
/**
|
||||
* Creates an RSA KEM API object for generating a secret asymmetric key.
|
||||
*
|
||||
* The symmetric key may be generated via a call to 'encrypt', which will
|
||||
* produce a ciphertext to be transmitted to the recipient and a key to be
|
||||
* kept secret. The ciphertext is a parameter to be passed to 'decrypt' which
|
||||
* will produce the same secret key for the recipient to use to decrypt a
|
||||
* message that was encrypted with the secret key.
|
||||
*
|
||||
* @param kdf the KDF API to use (eg: new forge.kem.kdf1()).
|
||||
* @param options the options to use.
|
||||
* [prng] a custom crypto-secure pseudo-random number generator to use,
|
||||
* that must define "getBytesSync".
|
||||
*/
|
||||
forge.kem.rsa.create = function(kdf, options) {
|
||||
options = options || {};
|
||||
var prng = options.prng || forge.random;
|
||||
|
||||
var kem = {};
|
||||
|
||||
/**
|
||||
* Generates a secret key and its encapsulation.
|
||||
*
|
||||
* @param publicKey the RSA public key to encrypt with.
|
||||
* @param keyLength the length, in bytes, of the secret key to generate.
|
||||
*
|
||||
* @return an object with:
|
||||
* encapsulation: the ciphertext for generating the secret key, as a
|
||||
* binary-encoded string of bytes.
|
||||
* key: the secret key to use for encrypting a message.
|
||||
*/
|
||||
kem.encrypt = function(publicKey, keyLength) {
|
||||
// generate a random r where 1 < r < n
|
||||
var byteLength = Math.ceil(publicKey.n.bitLength() / 8);
|
||||
var r;
|
||||
do {
|
||||
r = new BigInteger(
|
||||
forge.util.bytesToHex(prng.getBytesSync(byteLength)),
|
||||
16).mod(publicKey.n);
|
||||
} while(r.compareTo(BigInteger.ONE) <= 0);
|
||||
|
||||
// prepend r with zeros
|
||||
r = forge.util.hexToBytes(r.toString(16));
|
||||
var zeros = byteLength - r.length;
|
||||
if(zeros > 0) {
|
||||
r = forge.util.fillString(String.fromCharCode(0), zeros) + r;
|
||||
}
|
||||
|
||||
// encrypt the random
|
||||
var encapsulation = publicKey.encrypt(r, 'NONE');
|
||||
|
||||
// generate the secret key
|
||||
var key = kdf.generate(r, keyLength);
|
||||
|
||||
return {encapsulation: encapsulation, key: key};
|
||||
};
|
||||
|
||||
/**
|
||||
* Decrypts an encapsulated secret key.
|
||||
*
|
||||
* @param privateKey the RSA private key to decrypt with.
|
||||
* @param encapsulation the ciphertext for generating the secret key, as
|
||||
* a binary-encoded string of bytes.
|
||||
* @param keyLength the length, in bytes, of the secret key to generate.
|
||||
*
|
||||
* @return the secret key as a binary-encoded string of bytes.
|
||||
*/
|
||||
kem.decrypt = function(privateKey, encapsulation, keyLength) {
|
||||
// decrypt the encapsulation and generate the secret key
|
||||
var r = privateKey.decrypt(encapsulation, 'NONE');
|
||||
return kdf.generate(r, keyLength);
|
||||
};
|
||||
|
||||
return kem;
|
||||
};
|
||||
|
||||
// TODO: add forge.kem.kdf.create('KDF1', {md: ..., ...}) API?
|
||||
|
||||
/**
|
||||
* Creates a key derivation API object that implements KDF1 per ISO 18033-2.
|
||||
*
|
||||
* @param md the hash API to use.
|
||||
* @param [digestLength] an optional digest length that must be positive and
|
||||
* less than or equal to md.digestLength.
|
||||
*
|
||||
* @return a KDF1 API object.
|
||||
*/
|
||||
forge.kem.kdf1 = function(md, digestLength) {
|
||||
_createKDF(this, md, 0, digestLength || md.digestLength);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a key derivation API object that implements KDF2 per ISO 18033-2.
|
||||
*
|
||||
* @param md the hash API to use.
|
||||
* @param [digestLength] an optional digest length that must be positive and
|
||||
* less than or equal to md.digestLength.
|
||||
*
|
||||
* @return a KDF2 API object.
|
||||
*/
|
||||
forge.kem.kdf2 = function(md, digestLength) {
|
||||
_createKDF(this, md, 1, digestLength || md.digestLength);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a KDF1 or KDF2 API object.
|
||||
*
|
||||
* @param md the hash API to use.
|
||||
* @param counterStart the starting index for the counter.
|
||||
* @param digestLength the digest length to use.
|
||||
*
|
||||
* @return the KDF API object.
|
||||
*/
|
||||
function _createKDF(kdf, md, counterStart, digestLength) {
|
||||
/**
|
||||
* Generate a key of the specified length.
|
||||
*
|
||||
* @param x the binary-encoded byte string to generate a key from.
|
||||
* @param length the number of bytes to generate (the size of the key).
|
||||
*
|
||||
* @return the key as a binary-encoded string.
|
||||
*/
|
||||
kdf.generate = function(x, length) {
|
||||
var key = new forge.util.ByteBuffer();
|
||||
|
||||
// run counter from counterStart to ceil(length / Hash.len)
|
||||
var k = Math.ceil(length / digestLength) + counterStart;
|
||||
|
||||
var c = new forge.util.ByteBuffer();
|
||||
for(var i = counterStart; i < k; ++i) {
|
||||
// I2OSP(i, 4): convert counter to an octet string of 4 octets
|
||||
c.putInt32(i);
|
||||
|
||||
// digest 'x' and the counter and add the result to the key
|
||||
md.start();
|
||||
md.update(x + c.getBytes());
|
||||
var hash = md.digest();
|
||||
key.putBytes(hash.getBytes(digestLength));
|
||||
}
|
||||
|
||||
// truncate to the correct key length
|
||||
key.truncate(key.length() - length);
|
||||
return key.getBytes();
|
||||
};
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
/**
|
||||
* Cross-browser support for logging in a web application.
|
||||
*
|
||||
* @author David I. Lehn <dlehn@digitalbazaar.com>
|
||||
*
|
||||
* Copyright (c) 2008-2013 Digital Bazaar, Inc.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./util');
|
||||
|
||||
/* LOG API */
|
||||
module.exports = forge.log = forge.log || {};
|
||||
|
||||
/**
|
||||
* Application logging system.
|
||||
*
|
||||
* Each logger level available as it's own function of the form:
|
||||
* forge.log.level(category, args...)
|
||||
* The category is an arbitrary string, and the args are the same as
|
||||
* Firebug's console.log API. By default the call will be output as:
|
||||
* 'LEVEL [category] <args[0]>, args[1], ...'
|
||||
* This enables proper % formatting via the first argument.
|
||||
* Each category is enabled by default but can be enabled or disabled with
|
||||
* the setCategoryEnabled() function.
|
||||
*/
|
||||
// list of known levels
|
||||
forge.log.levels = [
|
||||
'none', 'error', 'warning', 'info', 'debug', 'verbose', 'max'];
|
||||
// info on the levels indexed by name:
|
||||
// index: level index
|
||||
// name: uppercased display name
|
||||
var sLevelInfo = {};
|
||||
// list of loggers
|
||||
var sLoggers = [];
|
||||
/**
|
||||
* Standard console logger. If no console support is enabled this will
|
||||
* remain null. Check before using.
|
||||
*/
|
||||
var sConsoleLogger = null;
|
||||
|
||||
// logger flags
|
||||
/**
|
||||
* Lock the level at the current value. Used in cases where user config may
|
||||
* set the level such that only critical messages are seen but more verbose
|
||||
* messages are needed for debugging or other purposes.
|
||||
*/
|
||||
forge.log.LEVEL_LOCKED = (1 << 1);
|
||||
/**
|
||||
* Always call log function. By default, the logging system will check the
|
||||
* message level against logger.level before calling the log function. This
|
||||
* flag allows the function to do its own check.
|
||||
*/
|
||||
forge.log.NO_LEVEL_CHECK = (1 << 2);
|
||||
/**
|
||||
* Perform message interpolation with the passed arguments. "%" style
|
||||
* fields in log messages will be replaced by arguments as needed. Some
|
||||
* loggers, such as Firebug, may do this automatically. The original log
|
||||
* message will be available as 'message' and the interpolated version will
|
||||
* be available as 'fullMessage'.
|
||||
*/
|
||||
forge.log.INTERPOLATE = (1 << 3);
|
||||
|
||||
// setup each log level
|
||||
for(var i = 0; i < forge.log.levels.length; ++i) {
|
||||
var level = forge.log.levels[i];
|
||||
sLevelInfo[level] = {
|
||||
index: i,
|
||||
name: level.toUpperCase()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Message logger. Will dispatch a message to registered loggers as needed.
|
||||
*
|
||||
* @param message message object
|
||||
*/
|
||||
forge.log.logMessage = function(message) {
|
||||
var messageLevelIndex = sLevelInfo[message.level].index;
|
||||
for(var i = 0; i < sLoggers.length; ++i) {
|
||||
var logger = sLoggers[i];
|
||||
if(logger.flags & forge.log.NO_LEVEL_CHECK) {
|
||||
logger.f(message);
|
||||
} else {
|
||||
// get logger level
|
||||
var loggerLevelIndex = sLevelInfo[logger.level].index;
|
||||
// check level
|
||||
if(messageLevelIndex <= loggerLevelIndex) {
|
||||
// message critical enough, call logger
|
||||
logger.f(logger, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the 'standard' key on a message object to:
|
||||
* "LEVEL [category] " + message
|
||||
*
|
||||
* @param message a message log object
|
||||
*/
|
||||
forge.log.prepareStandard = function(message) {
|
||||
if(!('standard' in message)) {
|
||||
message.standard =
|
||||
sLevelInfo[message.level].name +
|
||||
//' ' + +message.timestamp +
|
||||
' [' + message.category + '] ' +
|
||||
message.message;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the 'full' key on a message object to the original message
|
||||
* interpolated via % formatting with the message arguments.
|
||||
*
|
||||
* @param message a message log object.
|
||||
*/
|
||||
forge.log.prepareFull = function(message) {
|
||||
if(!('full' in message)) {
|
||||
// copy args and insert message at the front
|
||||
var args = [message.message];
|
||||
args = args.concat([] || message['arguments']);
|
||||
// format the message
|
||||
message.full = forge.util.format.apply(this, args);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Applies both preparseStandard() and prepareFull() to a message object and
|
||||
* store result in 'standardFull'.
|
||||
*
|
||||
* @param message a message log object.
|
||||
*/
|
||||
forge.log.prepareStandardFull = function(message) {
|
||||
if(!('standardFull' in message)) {
|
||||
// FIXME implement 'standardFull' logging
|
||||
forge.log.prepareStandard(message);
|
||||
message.standardFull = message.standard;
|
||||
}
|
||||
};
|
||||
|
||||
// create log level functions
|
||||
if(true) {
|
||||
// levels for which we want functions
|
||||
var levels = ['error', 'warning', 'info', 'debug', 'verbose'];
|
||||
for(var i = 0; i < levels.length; ++i) {
|
||||
// wrap in a function to ensure proper level var is passed
|
||||
(function(level) {
|
||||
// create function for this level
|
||||
forge.log[level] = function(category, message/*, args...*/) {
|
||||
// convert arguments to real array, remove category and message
|
||||
var args = Array.prototype.slice.call(arguments).slice(2);
|
||||
// create message object
|
||||
// Note: interpolation and standard formatting is done lazily
|
||||
var msg = {
|
||||
timestamp: new Date(),
|
||||
level: level,
|
||||
category: category,
|
||||
message: message,
|
||||
'arguments': args
|
||||
/*standard*/
|
||||
/*full*/
|
||||
/*fullMessage*/
|
||||
};
|
||||
// process this message
|
||||
forge.log.logMessage(msg);
|
||||
};
|
||||
})(levels[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new logger with specified custom logging function.
|
||||
*
|
||||
* The logging function has a signature of:
|
||||
* function(logger, message)
|
||||
* logger: current logger
|
||||
* message: object:
|
||||
* level: level id
|
||||
* category: category
|
||||
* message: string message
|
||||
* arguments: Array of extra arguments
|
||||
* fullMessage: interpolated message and arguments if INTERPOLATE flag set
|
||||
*
|
||||
* @param logFunction a logging function which takes a log message object
|
||||
* as a parameter.
|
||||
*
|
||||
* @return a logger object.
|
||||
*/
|
||||
forge.log.makeLogger = function(logFunction) {
|
||||
var logger = {
|
||||
flags: 0,
|
||||
f: logFunction
|
||||
};
|
||||
forge.log.setLevel(logger, 'none');
|
||||
return logger;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current log level on a logger.
|
||||
*
|
||||
* @param logger the target logger.
|
||||
* @param level the new maximum log level as a string.
|
||||
*
|
||||
* @return true if set, false if not.
|
||||
*/
|
||||
forge.log.setLevel = function(logger, level) {
|
||||
var rval = false;
|
||||
if(logger && !(logger.flags & forge.log.LEVEL_LOCKED)) {
|
||||
for(var i = 0; i < forge.log.levels.length; ++i) {
|
||||
var aValidLevel = forge.log.levels[i];
|
||||
if(level == aValidLevel) {
|
||||
// set level
|
||||
logger.level = level;
|
||||
rval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
};
|
||||
|
||||
/**
|
||||
* Locks the log level at its current value.
|
||||
*
|
||||
* @param logger the target logger.
|
||||
* @param lock boolean lock value, default to true.
|
||||
*/
|
||||
forge.log.lock = function(logger, lock) {
|
||||
if(typeof lock === 'undefined' || lock) {
|
||||
logger.flags |= forge.log.LEVEL_LOCKED;
|
||||
} else {
|
||||
logger.flags &= ~forge.log.LEVEL_LOCKED;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a logger.
|
||||
*
|
||||
* @param logger the logger object.
|
||||
*/
|
||||
forge.log.addLogger = function(logger) {
|
||||
sLoggers.push(logger);
|
||||
};
|
||||
|
||||
// setup the console logger if possible, else create fake console.log
|
||||
if(typeof(console) !== 'undefined' && 'log' in console) {
|
||||
var logger;
|
||||
if(console.error && console.warn && console.info && console.debug) {
|
||||
// looks like Firebug-style logging is available
|
||||
// level handlers map
|
||||
var levelHandlers = {
|
||||
error: console.error,
|
||||
warning: console.warn,
|
||||
info: console.info,
|
||||
debug: console.debug,
|
||||
verbose: console.debug
|
||||
};
|
||||
var f = function(logger, message) {
|
||||
forge.log.prepareStandard(message);
|
||||
var handler = levelHandlers[message.level];
|
||||
// prepend standard message and concat args
|
||||
var args = [message.standard];
|
||||
args = args.concat(message['arguments'].slice());
|
||||
// apply to low-level console function
|
||||
handler.apply(console, args);
|
||||
};
|
||||
logger = forge.log.makeLogger(f);
|
||||
} else {
|
||||
// only appear to have basic console.log
|
||||
var f = function(logger, message) {
|
||||
forge.log.prepareStandardFull(message);
|
||||
console.log(message.standardFull);
|
||||
};
|
||||
logger = forge.log.makeLogger(f);
|
||||
}
|
||||
forge.log.setLevel(logger, 'debug');
|
||||
forge.log.addLogger(logger);
|
||||
sConsoleLogger = logger;
|
||||
} else {
|
||||
// define fake console.log to avoid potential script errors on
|
||||
// browsers that do not have console logging
|
||||
console = {
|
||||
log: function() {}
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for logging control query vars in current URL.
|
||||
*
|
||||
* console.level=<level-name>
|
||||
* Set's the console log level by name. Useful to override defaults and
|
||||
* allow more verbose logging before a user config is loaded.
|
||||
*
|
||||
* console.lock=<true|false>
|
||||
* Lock the console log level at whatever level it is set at. This is run
|
||||
* after console.level is processed. Useful to force a level of verbosity
|
||||
* that could otherwise be limited by a user config.
|
||||
*/
|
||||
if(sConsoleLogger !== null &&
|
||||
typeof window !== 'undefined' && window.location
|
||||
) {
|
||||
var query = new URL(window.location.href).searchParams;
|
||||
if(query.has('console.level')) {
|
||||
// set with last value
|
||||
forge.log.setLevel(
|
||||
sConsoleLogger, query.get('console.level').slice(-1)[0]);
|
||||
}
|
||||
if(query.has('console.lock')) {
|
||||
// set with last value
|
||||
var lock = query.get('console.lock').slice(-1)[0];
|
||||
if(lock == 'true') {
|
||||
forge.log.lock(sConsoleLogger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// provide public access to console logger
|
||||
forge.log.consoleLogger = sConsoleLogger;
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Node.js module for all known Forge message digests.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright 2011-2017 Digital Bazaar, Inc.
|
||||
*/
|
||||
module.exports = require('./md');
|
||||
|
||||
require('./md5');
|
||||
require('./sha1');
|
||||
require('./sha256');
|
||||
require('./sha512');
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Node.js module for Forge message digests.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright 2011-2017 Digital Bazaar, Inc.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
|
||||
module.exports = forge.md = forge.md || {};
|
||||
forge.md.algorithms = forge.md.algorithms || {};
|
||||
@@ -1,289 +0,0 @@
|
||||
/**
|
||||
* Message Digest Algorithm 5 with 128-bit digest (MD5) implementation.
|
||||
*
|
||||
* @author Dave Longley
|
||||
*
|
||||
* Copyright (c) 2010-2014 Digital Bazaar, Inc.
|
||||
*/
|
||||
var forge = require('./forge');
|
||||
require('./md');
|
||||
require('./util');
|
||||
|
||||
var md5 = module.exports = forge.md5 = forge.md5 || {};
|
||||
forge.md.md5 = forge.md.algorithms.md5 = md5;
|
||||
|
||||
/**
|
||||
* Creates an MD5 message digest object.
|
||||
*
|
||||
* @return a message digest object.
|
||||
*/
|
||||
md5.create = function() {
|
||||
// do initialization as necessary
|
||||
if(!_initialized) {
|
||||
_init();
|
||||
}
|
||||
|
||||
// MD5 state contains four 32-bit integers
|
||||
var _state = null;
|
||||
|
||||
// input buffer
|
||||
var _input = forge.util.createBuffer();
|
||||
|
||||
// used for word storage
|
||||
var _w = new Array(16);
|
||||
|
||||
// message digest object
|
||||
var md = {
|
||||
algorithm: 'md5',
|
||||
blockLength: 64,
|
||||
digestLength: 16,
|
||||
// 56-bit length of message so far (does not including padding)
|
||||
messageLength: 0,
|
||||
// true message length
|
||||
fullMessageLength: null,
|
||||
// size of message length in bytes
|
||||
messageLengthSize: 8
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts the digest.
|
||||
*
|
||||
* @return this digest object.
|
||||
*/
|
||||
md.start = function() {
|
||||
// up to 56-bit message length for convenience
|
||||
md.messageLength = 0;
|
||||
|
||||
// full message length (set md.messageLength64 for backwards-compatibility)
|
||||
md.fullMessageLength = md.messageLength64 = [];
|
||||
var int32s = md.messageLengthSize / 4;
|
||||
for(var i = 0; i < int32s; ++i) {
|
||||
md.fullMessageLength.push(0);
|
||||
}
|
||||
_input = forge.util.createBuffer();
|
||||
_state = {
|
||||
h0: 0x67452301,
|
||||
h1: 0xEFCDAB89,
|
||||
h2: 0x98BADCFE,
|
||||
h3: 0x10325476
|
||||
};
|
||||
return md;
|
||||
};
|
||||
// start digest automatically for first time
|
||||
md.start();
|
||||
|
||||
/**
|
||||
* Updates the digest with the given message input. The given input can
|
||||
* treated as raw input (no encoding will be applied) or an encoding of
|
||||
* 'utf8' maybe given to encode the input using UTF-8.
|
||||
*
|
||||
* @param msg the message input to update with.
|
||||
* @param encoding the encoding to use (default: 'raw', other: 'utf8').
|
||||
*
|
||||
* @return this digest object.
|
||||
*/
|
||||
md.update = function(msg, encoding) {
|
||||
if(encoding === 'utf8') {
|
||||
msg = forge.util.encodeUtf8(msg);
|
||||
}
|
||||
|
||||
// update message length
|
||||
var len = msg.length;
|
||||
md.messageLength += len;
|
||||
len = [(len / 0x100000000) >>> 0, len >>> 0];
|
||||
for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {
|
||||
md.fullMessageLength[i] += len[1];
|
||||
len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0);
|
||||
md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0;
|
||||
len[0] = (len[1] / 0x100000000) >>> 0;
|
||||
}
|
||||
|
||||
// add bytes to input buffer
|
||||
_input.putBytes(msg);
|
||||
|
||||
// process bytes
|
||||
_update(_state, _w, _input);
|
||||
|
||||
// compact input buffer every 2K or if empty
|
||||
if(_input.read > 2048 || _input.length() === 0) {
|
||||
_input.compact();
|
||||
}
|
||||
|
||||
return md;
|
||||
};
|
||||
|
||||
/**
|
||||
* Produces the digest.
|
||||
*
|
||||
* @return a byte buffer containing the digest value.
|
||||
*/
|
||||
md.digest = function() {
|
||||
/* Note: Here we copy the remaining bytes in the input buffer and
|
||||
add the appropriate MD5 padding. Then we do the final update
|
||||
on a copy of the state so that if the user wants to get
|
||||
intermediate digests they can do so. */
|
||||
|
||||
/* Determine the number of bytes that must be added to the message
|
||||
to ensure its length is congruent to 448 mod 512. In other words,
|
||||
the data to be digested must be a multiple of 512 bits (or 128 bytes).
|
||||
This data includes the message, some padding, and the length of the
|
||||
message. Since the length of the message will be encoded as 8 bytes (64
|
||||
bits), that means that the last segment of the data must have 56 bytes
|
||||
(448 bits) of message and padding. Therefore, the length of the message
|
||||
plus the padding must be congruent to 448 mod 512 because
|
||||
512 - 128 = 448.
|
||||
|
||||
In order to fill up the message length it must be filled with
|
||||
padding that begins with 1 bit followed by all 0 bits. Padding
|
||||
must *always* be present, so if the message length is already
|
||||
congruent to 448 mod 512, then 512 padding bits must be added. */
|
||||
|
||||
var finalBlock = forge.util.createBuffer();
|
||||
finalBlock.putBytes(_input.bytes());
|
||||
|
||||
// compute remaining size to be digested (include message length size)
|
||||
var remaining = (
|
||||
md.fullMessageLength[md.fullMessageLength.length - 1] +
|
||||
md.messageLengthSize);
|
||||
|
||||
// add padding for overflow blockSize - overflow
|
||||
// _padding starts with 1 byte with first bit is set (byte value 128), then
|
||||
// there may be up to (blockSize - 1) other pad bytes
|
||||
var overflow = remaining & (md.blockLength - 1);
|
||||
finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow));
|
||||
|
||||
// serialize message length in bits in little-endian order; since length
|
||||
// is stored in bytes we multiply by 8 and add carry
|
||||
var bits, carry = 0;
|
||||
for(var i = md.fullMessageLength.length - 1; i >= 0; --i) {
|
||||
bits = md.fullMessageLength[i] * 8 + carry;
|
||||
carry = (bits / 0x100000000) >>> 0;
|
||||
finalBlock.putInt32Le(bits >>> 0);
|
||||
}
|
||||
|
||||
var s2 = {
|
||||
h0: _state.h0,
|
||||
h1: _state.h1,
|
||||
h2: _state.h2,
|
||||
h3: _state.h3
|
||||
};
|
||||
_update(s2, _w, finalBlock);
|
||||
var rval = forge.util.createBuffer();
|
||||
rval.putInt32Le(s2.h0);
|
||||
rval.putInt32Le(s2.h1);
|
||||
rval.putInt32Le(s2.h2);
|
||||
rval.putInt32Le(s2.h3);
|
||||
return rval;
|
||||
};
|
||||
|
||||
return md;
|
||||
};
|
||||
|
||||
// padding, constant tables for calculating md5
|
||||
var _padding = null;
|
||||
var _g = null;
|
||||
var _r = null;
|
||||
var _k = null;
|
||||
var _initialized = false;
|
||||
|
||||
/**
|
||||
* Initializes the constant tables.
|
||||
*/
|
||||
function _init() {
|
||||
// create padding
|
||||
_padding = String.fromCharCode(128);
|
||||
_padding += forge.util.fillString(String.fromCharCode(0x00), 64);
|
||||
|
||||
// g values
|
||||
_g = [
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12,
|
||||
5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2,
|
||||
0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9];
|
||||
|
||||
// rounds table
|
||||
_r = [
|
||||
7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
|
||||
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
|
||||
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
|
||||
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21];
|
||||
|
||||
// get the result of abs(sin(i + 1)) as a 32-bit integer
|
||||
_k = new Array(64);
|
||||
for(var i = 0; i < 64; ++i) {
|
||||
_k[i] = Math.floor(Math.abs(Math.sin(i + 1)) * 0x100000000);
|
||||
}
|
||||
|
||||
// now initialized
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an MD5 state with the given byte buffer.
|
||||
*
|
||||
* @param s the MD5 state to update.
|
||||
* @param w the array to use to store words.
|
||||
* @param bytes the byte buffer to update with.
|
||||
*/
|
||||
function _update(s, w, bytes) {
|
||||
// consume 512 bit (64 byte) chunks
|
||||
var t, a, b, c, d, f, r, i;
|
||||
var len = bytes.length();
|
||||
while(len >= 64) {
|
||||
// initialize hash value for this chunk
|
||||
a = s.h0;
|
||||
b = s.h1;
|
||||
c = s.h2;
|
||||
d = s.h3;
|
||||
|
||||
// round 1
|
||||
for(i = 0; i < 16; ++i) {
|
||||
w[i] = bytes.getInt32Le();
|
||||
f = d ^ (b & (c ^ d));
|
||||
t = (a + f + _k[i] + w[i]);
|
||||
r = _r[i];
|
||||
a = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b += (t << r) | (t >>> (32 - r));
|
||||
}
|
||||
// round 2
|
||||
for(; i < 32; ++i) {
|
||||
f = c ^ (d & (b ^ c));
|
||||
t = (a + f + _k[i] + w[_g[i]]);
|
||||
r = _r[i];
|
||||
a = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b += (t << r) | (t >>> (32 - r));
|
||||
}
|
||||
// round 3
|
||||
for(; i < 48; ++i) {
|
||||
f = b ^ c ^ d;
|
||||
t = (a + f + _k[i] + w[_g[i]]);
|
||||
r = _r[i];
|
||||
a = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b += (t << r) | (t >>> (32 - r));
|
||||
}
|
||||
// round 4
|
||||
for(; i < 64; ++i) {
|
||||
f = c ^ (b | ~d);
|
||||
t = (a + f + _k[i] + w[_g[i]]);
|
||||
r = _r[i];
|
||||
a = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b += (t << r) | (t >>> (32 - r));
|
||||
}
|
||||
|
||||
// update hash state
|
||||
s.h0 = (s.h0 + a) | 0;
|
||||
s.h1 = (s.h1 + b) | 0;
|
||||
s.h2 = (s.h2 + c) | 0;
|
||||
s.h3 = (s.h3 + d) | 0;
|
||||
|
||||
len -= 64;
|
||||
}
|
||||
}
|
||||