Fp (X9.62 s 4.2.1 pg 17).
- -- @return The decoded point.
- require
- first_byte_indicator: encoded [0] = 0x02 or encoded [0] = 0x3 or encoded [0] = 0x4
- do
- inspect
- encoded [0]
- when 0x02 then
- decodeCompressedPoint (encoded, 0, curve)
- when 0x03 then
- decodeCompressedPoint (encoded, 1, curve)
- when 0x04 then
- decodeUncompressedPoint (encoded)
- end
- end
-
-feature
- x: EC_FIELD_ELEMENT_FP
- y: EC_FIELD_ELEMENT_FP
-
- copy (other: like Current)
- do
- x.copy (other.x)
- y.copy (other.y)
- end
-
-feature
-
- set_infinity
- do
- create x.make_p_x (create {INTEGER_X}.default_create)
- create y.make_p_x (create {INTEGER_X}.default_create)
- infinity := True
- end
-
- to_byte_array_compressed (curve: EC_CURVE_FP): SPECIAL [NATURAL_8]
- -- Return a compressed encoded version of this point
- local
- x_array: SPECIAL [NATURAL_8]
- do
- x_array := x.x.as_fixed_width_byte_array (x.encoded_field_size (curve))
- create result.make_filled (0, x_array.count + 1)
- result.copy_data (x_array, 0, 1, x_array.count)
- result [0] := compressed_PC_byte (y.x)
- end
-
- to_byte_array_uncompressed (curve: EC_CURVE_FP): SPECIAL [NATURAL_8]
- -- Return an uncompressed encoded version of this point
- local
- x_array: SPECIAL [NATURAL_8]
- y_array: SPECIAL [NATURAL_8]
- p0: SPECIAL [NATURAL_8]
- qLength: INTEGER_32
- do
- qLength := x.encoded_field_size (curve)
- x_array := x.x.as_fixed_width_byte_array (qlength)
- y_array := y.x.as_fixed_width_byte_array (qLength)
- check
- x_array.capacity = qlength
- y_array.capacity = qlength
- end
- create p0.make_filled (0, x_array.capacity + y_array.capacity + 1)
- p0.copy_data (x_array, 0, x_array.upper, 1)
- p0.copy_data (y_array, 0, y_array.upper, x_array.capacity + 1)
- p0.put (0x04, 0)
- result := p0
- end
-
- plus_value (other: like Current; curve: EC_CURVE_FP): EC_POINT_FP
- do
- Result := Precursor (other, curve)
- end
-
- plus (other: like Current; curve: EC_CURVE_FP)
- -- Addition over FP
- local
- gamma: EC_FIELD_ELEMENT_FP
- x3: EC_FIELD_ELEMENT_FP
- y3: EC_FIELD_ELEMENT_FP
- do
- if
- infinity
- then
- copy (other)
- elseif
- other.infinity
- then
- elseif
- x ~ other.x
- then
- if
- y ~ other.y
- then
- copy (twice_value (curve))
- else
- set_infinity
- end
- else
- gamma := (other.y.minus_value (y, curve)).quotient_value (other.x.minus_value (x, curve), curve)
- x3 := (gamma.product_value (gamma, curve)).minus_value (x, curve).minus_value (other.x, curve)
- y3 := (gamma.product_value (x.minus_value (x3, curve), curve)).minus_value (y, curve)
- x := x3
- y := y3
- end
- end
-
- twice_value (curve: EC_CURVE_FP): EC_POINT_FP
- do
- Result := Precursor (curve)
- end
-
- twice (curve: EC_CURVE_FP)
- -- Return current * current over FP
- local
- two_element: EC_FIELD_ELEMENT_FP
- three_element: EC_FIELD_ELEMENT_FP
- gamma: EC_FIELD_ELEMENT_FP
- x3: EC_FIELD_ELEMENT_FP
- y3: EC_FIELD_ELEMENT_FP
- do
- if
- infinity
- then
- elseif
- y.x.is_zero
- then
- set_infinity
- else
- create two_element.make_p_x (two)
- create three_element.make_p_x (three)
- gamma := (((x.product_value (x, curve)).product_value (three_element, curve)).plus_value (curve.a, curve)).quotient_value (y.product_value (two_element, curve), curve)
- x3 := (gamma.product_value (gamma, curve)).minus_value (x.product_value (two_element, curve), curve)
- y3 := (gamma.product_value (x.minus_value (x3, curve), curve)).minus_value (y, curve)
- x := x3
- y := y3
- end
- end
-
- minus_value (other: like Current; curve: EC_CURVE_FP): EC_POINT_FP
- do
- Result := Precursor (other, curve)
- end
-
- minus (other: like Current; curve: EC_CURVE_FP)
- do
- if
- other.infinity
- then
- else
- plus (other.opposite_value (curve), curve)
- end
- end
-
- product_value (other: INTEGER_X; curve: EC_CURVE_FP): EC_POINT_FP
- do
- Result := Precursor (other, curve)
- end
-
- product (other: INTEGER_X; curve: EC_CURVE_FP)
- -- return current * k over FP
- local
- e: INTEGER_X
- h: INTEGER_X
- R: like Current
- i: INTEGER_32
- do
- if
- infinity
- then
- elseif
- other.is_zero
- then
- set_infinity
- else
- e := other
- h := e * three
- R := deep_twin
- from
- i := (h.bits - 2)
- until
- i <= 0
- loop
- R := r.twice_value (curve)
- if
- h.bit_test (i) and not e.bit_test (i)
- then
- r := r.plus_value (Current, curve)
- elseif
- not h.bit_test (i) and e.bit_test (i)
- then
- r := r.minus_value (Current, curve)
- end
- i := i - 1
- end
- copy (r)
- end
- end
-
- opposite_value (curve: EC_CURVE_FP): like Current
- do
- Result := Precursor (curve)
- end
-
- opposite (curve: EC_CURVE_FP)
- do
- y.opposite (curve)
- end
-
-feature {NONE} -- support features
- ytilde_set (source: INTEGER_X): BOOLEAN
- -- Test the least significant bit, this is ytilde
- -- X9.62 4.2.1
- do
- result := source.bit_test (0)
- end
-
- compressed_PC_byte (source: INTEGER_X): NATURAL_8
- -- Return the PC byte depending on if ytilde is set
- -- X9.62 4.3.6
- do
- if
- ytilde_set (source)
- then
- result := 0x03
- else
- result := 0x02
- end
- end
-
-feature {NONE}
- decodeCompressedPoint (encoded: SPECIAL [NATURAL_8] ytilde: INTEGER curve: EC_CURVE_FP)
- -- Decode a compressed point
- require
- encoded.lower = 0
- local
- i: SPECIAL [NATURAL_8]
- x_new: EC_FIELD_ELEMENT_FP
- alpha: EC_FIELD_ELEMENT_FP
- beta: EC_FIELD_ELEMENT_FP
- x_int: INTEGER_X
- bit0: INTEGER
- q_minus_beta: EC_FIELD_ELEMENT_FP
- do
- create i.make_filled (0, encoded.count - 1)
- i.copy_data (encoded, 1, 0, i.count)
- create x_int.make_from_bytes (i, i.lower, i.upper)
- create x_new.make_p_x (x_int)
- alpha := (x_new.product_value (x_new.square_value (curve).plus_value (curve.a, curve), curve)).plus_value (curve.b, curve)
- beta := alpha.sqrt (curve)
- if
- beta.x.bit_test (0)
- then
- bit0 := 1
- else
- bit0 := 0
- end
- if
- bit0 = ytilde
- then
- make_curve_x_y (x_new, beta)
- else
- create q_minus_beta.make_p_x (curve.q - beta.x)
- make_curve_x_y (x_new, q_minus_beta)
- end
- end
-
- decodeUncompressedPoint (encoded: SPECIAL [NATURAL_8])
- -- Decode an uncompressed point
- require
- encoded_not_split_even: (encoded.count \\ 2) = 1
- local
- xEnc: SPECIAL [NATURAL_8]
- yEnc: SPECIAL [NATURAL_8]
- x_new: EC_FIELD_ELEMENT_FP
- y_new: EC_FIELD_ELEMENT_FP
- do
- create xEnc.make_filled (0, (encoded.capacity - 1) // 2)
- create yEnc.make_filled (0, (encoded.capacity - 1) // 2)
- encoded.copy_data (xEnc, 1, 0, xEnc.capacity)
- encoded.copy_data (yEnc, xEnc.capacity, 0, yEnc.capacity)
- create x_new.make_p_x (create {INTEGER_X}.make_from_bytes (xEnc, xEnc.lower, xEnc.upper))
- create y_new.make_p_x (create {INTEGER_X}.make_from_bytes (yEnc, yEnc.lower, yEnc.upper))
- x := x_new
- y := y_new
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/ec/ec_private_key.e b/contrib/ise_library/text/encryption/eel/src/ec/ec_private_key.e
deleted file mode 100644
index 7d58a8ef..00000000
--- a/contrib/ise_library/text/encryption/eel/src/ec/ec_private_key.e
+++ /dev/null
@@ -1,89 +0,0 @@
-note
- description: "Objects that ..."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Liberty is always dangerous, but it is the safest thing we have. - Harry Emerson Fosdick"
-
-class
- EC_PRIVATE_KEY
-
-inherit
- EC_KEY_PARAMETERS
- DEBUG_OUTPUT
- EC_CONSTANTS
-
-create
- make_d_params
-
-feature
- make_d_params (d_new: INTEGER_X params_new: EC_DOMAIN_PARAMETERS)
- do
- params := params_new
- d := d_new
- end
-
- agreement (other: EC_PUBLIC_KEY): INTEGER_X
- do
- result := (other.q.product_value (d, params.curve)).x.x
- ensure
- symmetric: result ~ other.agreement (current)
- end
-
- sign (e: INTEGER_X): TUPLE [r: INTEGER_X s: INTEGER_X]
- require
- message_too_big: e < params.n
- local
- r: INTEGER_X
- s: INTEGER_X
- k: INTEGER_X
- nBitLength: INTEGER_32
- p: EC_POINT
- x: INTEGER_X
- n: INTEGER_X
- do
- n := params.n
- create s.default_create
- create r.default_create
- create k.default_create
- nBitLength := params.n.bits
- from
- until
- s /~ s.zero
- loop
- from
- until
- r /~ r.zero
- loop
- from
- until
- k /~ k.zero
- loop
- create k.make_random (nBitLength)
- end
- p := params.g.product_value (k, params.curve)
- x := p.x.x
- r := x \\ params.n
- end
- --s := ((k.inverse_value (params.n) * (e + d * r))) \\ params.n
- s := d.identity
- s.product (r)
- s.plus (e)
- k.inverse (n)
- s.product (k)
- s.modulo (n)
- end
- create result
- result.r := r
- result.s := s
- end
-
-feature
- d: INTEGER_X
-
-feature {DEBUG_OUTPUT} -- {DEBUG_OUTPUT}
- debug_output: STRING
- do
- result := "0x" + d.out_hex
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/ec/ec_public_key.e b/contrib/ise_library/text/encryption/eel/src/ec/ec_public_key.e
deleted file mode 100644
index 1977a82d..00000000
--- a/contrib/ise_library/text/encryption/eel/src/ec/ec_public_key.e
+++ /dev/null
@@ -1,74 +0,0 @@
-note
- description: "Objects that ..."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "It is much more important to kill bad bills than to pass good ones. - Calvin Coolidge"
-
-class
- EC_PUBLIC_KEY
-
-inherit
- EC_KEY_PARAMETERS
- DEBUG_OUTPUT
- EC_CONSTANTS
-
-create
- make_q_parameters
-
-feature -- Creation procedures
- make_q_parameters (q_new: EC_POINT params_new: EC_DOMAIN_PARAMETERS)
- do
- params := params_new
- q := q_new
- end
-
- agreement (other: EC_PRIVATE_KEY): INTEGER_X
- do
- Result := (q.product_value (other.d, params.curve)).x.x
- ensure
- symmetric: Result ~ other.agreement (Current)
- end
-
- verify (message: INTEGER_X signature: TUPLE [r: INTEGER_X s: INTEGER_X]): BOOLEAN
- do
- result := verify_r_s (message, signature.r, signature.s, params.curve)
- end
-
- verify_r_s (e: INTEGER_X r: INTEGER_X s: INTEGER_X curve: EC_CURVE): BOOLEAN
- require
- message_small_enough: e < params.n
- local
- c: INTEGER_X
- u1: INTEGER_X
- u2: INTEGER_X
- point: EC_POINT
- v: INTEGER_X
- do
- if
- (r < r.one) or (r >= params.n)
- then
- result := false
- elseif
- (s < s.one) or (s >= params.n)
- then
- result := false
- else
- c := s.inverse_value (params.n)
- u1 := e * c \\ params.n
- u2 := r * c \\ params.n
- point := (params.g.product_value (u1, params.curve)).plus_value (q.product_value (u2, params.curve), params.curve)
- v := point.x.x \\ params.n
- result := v ~ r
- end
- end
-
-feature
- q: EC_POINT
-
-feature {DEBUG_OUTPUT} -- {DEBUG_OUTPUT}
- debug_output: STRING
- do
- result := q.debug_output
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/ec/f2m_representations.e b/contrib/ise_library/text/encryption/eel/src/ec/f2m_representations.e
deleted file mode 100644
index c40dc022..00000000
--- a/contrib/ise_library/text/encryption/eel/src/ec/f2m_representations.e
+++ /dev/null
@@ -1,18 +0,0 @@
-note
- description: "Summary description for {F2M_REPRESENTATIONS}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "To compel a man to furnish contributions of money for the propagation of opinions which he disbelieves and abhors, is sinful and tyrannical. - Thomas Jefferson"
-
-deferred class
- F2M_REPRESENTATIONS
-
-feature -- Field element representations
- GNB: INTEGER = 1
-
- TPB: INTEGER = 2
-
- PPB: INTEGER = 3
-
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/ec/standard_curves.e b/contrib/ise_library/text/encryption/eel/src/ec/standard_curves.e
deleted file mode 100644
index 56c114c7..00000000
--- a/contrib/ise_library/text/encryption/eel/src/ec/standard_curves.e
+++ /dev/null
@@ -1,1807 +0,0 @@
-note
- description: "Objects that ..."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "It is dangerous to be right when the government is wrong. - Voltaire"
-
-deferred class
- STANDARD_CURVES
-
-inherit
- EC_CONSTANTS
-
-feature -- SEC p112r1
- sec_p112r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("0000DB7C 2ABF62E3 5E668076 BEAD208B")
- end
-
- sec_p112r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("0000DB7C 2ABF62E3 5E7628DF AC6561C5")
- end
-
- sec_p112r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("0000DB7C 2ABF62E3 5E668076 BEAD2088")
- end
-
- sec_p112r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("0000659E F8BA0439 16EEDE89 11702B22")
- end
-
- sec_p112r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("00000948 7239995A 5EE76B55 F9C2F098")
- end
-
- sec_p112r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("0000A89C E5AF8724 C0A23E0E 0FF77500")
- end
-
- sec_p112r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p112r2
- sec_p112r2_p: INTEGER_X
- do
- create Result.make_from_hex_string ("0000DB7C 2ABF62E3 5E668076 BEAD208B")
- end
-
- sec_p112r2_r: INTEGER_X
- do
- create Result.make_from_hex_string ("000036DF 0AAFD8B8 D7597CA1 0520D04B")
- end
-
- sec_p112r2_a: INTEGER_X
- do
- create Result.make_from_hex_string ("00006127 C24C05F3 8A0AAAF6 5C0EF02C")
- end
-
- sec_p112r2_b: INTEGER_X
- do
- create Result.make_from_hex_string ("000051DE F1815DB5 ED74FCC3 4C85D709")
- end
-
- sec_p112r2_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("00004BA3 0AB5E892 B4E1649D D0928643")
- end
-
- sec_p112r2_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("0000ADCD 46F5882E 3747DEF3 6E956E97")
- end
-
- sec_p112r2_h: INTEGER_X
- do
- result := four
- end
-
-feature -- SEC p128r1
- sec_p128r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFD FFFFFFFF FFFFFFFF FFFFFFFF")
- end
-
- sec_p128r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFE 00000000 75A30D1B 9038A115")
- end
-
- sec_p128r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFD FFFFFFFF FFFFFFFF FFFFFFFC")
- end
-
- sec_p128r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("E87579C1 1079F43D D824993C 2CEE5ED3")
- end
-
- sec_p128r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("161FF752 8B899B2D 0C28607C A52C5B86")
- end
-
- sec_p128r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("CF5AC839 5BAFEB13 C02DA292 DDED7A83")
- end
-
- sec_p128r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p128r2
- sec_p128r2_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFD FFFFFFFF FFFFFFFF FFFFFFFF")
- end
-
- sec_p128r2_r: INTEGER_X
- do
- create Result.make_from_hex_string ("3FFFFFFF 7FFFFFFF BE002472 0613B5A3")
- end
-
- sec_p128r2_a: INTEGER_X
- do
- create Result.make_from_hex_string ("D6031998 D1B3BBFE BF59CC9B BFF9AEE1")
- end
-
- sec_p128r2_b: INTEGER_X
- do
- create Result.make_from_hex_string ("5EEEFCA3 80D02919 DC2C6558 BB6D8A5D")
- end
-
- sec_p128r2_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("7B6AA5D8 5E572983 E6FB32A7 CDEBC140")
- end
-
- sec_p128r2_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("27B6916A 894D3AEE 7106FE80 5FC34B44")
- end
-
- sec_p128r2_h: INTEGER_X
- do
- result := four
- end
-
-feature -- SEC p160k1
- sec_p160k1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFAC73")
- end
-
- sec_p160k1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("01 00000000 00000000 0001B8FA 16DFAB9A CA16B6B3")
- end
-
- sec_p160k1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_p160k1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000007")
- end
-
- sec_p160k1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("3B4C382C E37AA192 A4019E76 3036F4F5 DD4D7EBB")
- end
-
- sec_p160k1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("938CF935 318FDCED 6BC28286 531733C3 F03C4FEE")
- end
-
- sec_p160k1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p160r1
- sec_p160r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 7FFFFFFF")
- end
-
- sec_p160r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("01 00000000 00000000 0001F4C8 F927AED3 CA752257")
- end
-
- sec_p160r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 7FFFFFFC")
- end
-
- sec_p160r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("1C97BEFC 54BD7A8B 65ACF89F 81D4D4AD C565FA45")
- end
-
- sec_p160r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("4A96B568 8EF57328 46646989 68C38BB9 13CBFC82")
- end
-
- sec_p160r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("23A62855 3168947D 59DCC912 04235137 7AC5FB32")
- end
-
- sec_p160r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p160r2
- sec_p160r2_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFAC73")
- end
-
- sec_p160r2_r: INTEGER_X
- do
- create Result.make_from_hex_string ("01 00000000 00000000 0000351E E786A818 F3A1A16B")
- end
-
- sec_p160r2_a: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFAC70")
- end
-
- sec_p160r2_b: INTEGER_X
- do
- create Result.make_from_hex_string ("B4E134D3 FB59EB8B AB572749 04664D5A F50388BA")
- end
-
- sec_p160r2_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("52DCB034 293A117E 1F4FF11B 30F7199D 3144CE6D")
- end
-
- sec_p160r2_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("FEAFFEF2 E331F296 E071FA0D F9982CFE A7D43F2E")
- end
-
- sec_p160r2_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p192k1
- sec_p192k1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFEE37")
- end
-
- sec_p192k1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFE 26F2FC17 0F69466A 74DEFD8D")
- end
-
- sec_p192k1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_p192k1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000003")
- end
-
- sec_p192k1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("DB4FF10E C057E9AE 26B07D02 80B7F434 1DA5D1B1 EAE06C7D")
- end
-
- sec_p192k1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("9B2F2F6D 9C5628A7 844163D0 15BE8634 4082AA88 D95E2F9D")
- end
-
- sec_p192k1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p192r1
- sec_p192r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFFFF FFFFFFFF")
- end
-
- sec_p192r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF 99DEF836 146BC9B1 B4D22831")
- end
-
- sec_p192r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFFFF FFFFFFFC")
- end
-
- sec_p192r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("64210519 E59C80E7 0FA7E9AB 72243049 FEB8DEEC C146B9B1")
- end
-
- sec_p192r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("188DA80E B03090F6 7CBF20EB 43A18800 F4FF0AFD 82FF1012")
- end
-
- sec_p192r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("07192B95 FFC8DA78 631011ED 6B24CDD5 73F977A1 1E794811")
- end
-
- sec_p192r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p224k1
- sec_p224k1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFE56D")
- end
-
- sec_p224k1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("01 00000000 00000000 00000000 0001DCE8 D2EC6184 CAF0A971 769FB1F7")
- end
-
- sec_p224k1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_p224k1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000005")
- end
-
- sec_p224k1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("A1455B33 4DF099DF 30FC28A1 69A467E9 E47075A9 0F7E650E B6B7A45C")
- end
-
- sec_p224k1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("7E089FED 7FBA3442 82CAFBD6 F7E319F7 C0B0BD59 E2CA4BDB 556D61A5")
- end
-
- sec_p224k1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p224r1
- sec_p224r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 00000000 00000000 00000001")
- end
-
- sec_p224r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFF16A2 E0B8F03E 13DD2945 5C5C2A3D")
- end
-
- sec_p224r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFE")
- end
-
- sec_p224r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("B4050A85 0C04B3AB F5413256 5044B0B7 D7BFD8BA 270B3943 2355FFB4")
- end
-
- sec_p224r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("B70E0CBD 6BB4BF7F 321390B9 4A03C1D3 56C21122 343280D6 115C1D21")
- end
-
- sec_p224r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("BD376388 B5F723FB 4C22DFE6 CD4375A0 5A074764 44D58199 85007E34")
- end
-
- sec_p224r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p256k1
- sec_p256k1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F")
- end
-
- sec_p256k1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141")
- end
-
- sec_p256k1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_p256k1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000007")
- end
-
- sec_p256k1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798")
- end
-
- sec_p256k1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8")
- end
-
- sec_p256k1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p256r1
- sec_p256r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF 00000001 00000000 00000000 00000000 FFFFFFFF FFFFFFFF FFFFFFFF")
- end
-
- sec_p256r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF 00000000 FFFFFFFF FFFFFFFF BCE6FAAD A7179E84 F3B9CAC2 FC632551")
- end
-
- sec_p256r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF 00000001 00000000 00000000 00000000 FFFFFFFF FFFFFFFF FFFFFFFC")
- end
-
- sec_p256r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("5AC635D8 AA3A93E7 B3EBBD55 769886BC 651D06B0 CC53B0F6 3BCE3C3E 27D2604B")
- end
-
- sec_p256r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("6B17D1F2 E12C4247 F8BCE6E5 63A440F2 77037D81 2DEB33A0 F4A13945 D898C296")
- end
-
- sec_p256r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("4FE342E2 FE1A7F9B 8EE7EB4A 7C0F9E16 2BCE3357 6B315ECE CBB64068 37BF51F5")
- end
-
- sec_p256r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p384r1
- sec_p384r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFFFF 00000000 00000000 FFFFFFFF")
- end
-
- sec_p384r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF C7634D81 F4372DDF 581A0DB2 48B0A77A ECEC196A CCC52973")
- end
-
- sec_p384r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFFFF 00000000 00000000 FFFFFFFC")
- end
-
- sec_p384r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("B3312FA7 E23EE7E4 988E056B E3F82D19 181D9C6E FE814112 0314088F 5013875A C656398D 8A2ED19D 2A85C8ED D3EC2AEF")
- end
-
- sec_p384r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("AA87CA22 BE8B0537 8EB1C71E F320AD74 6E1D3B62 8BA79B98 59F741E0 82542A38 5502F25D BF55296C 3A545E38 72760AB7")
- end
-
- sec_p384r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("3617DE4A 96262C6F 5D9E98BF 9292DC29 F8F41DBD 289A147C E9DA3113 B5F0B8C0 0A60B1CE 1D7E819D 7A431D7C 90EA0E5F")
- end
-
- sec_p384r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC p521r1
- sec_p521r1_p: INTEGER_X
- do
- create Result.make_from_hex_string ("000001FF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF")
- end
-
- sec_p521r1_r: INTEGER_X
- do
- create Result.make_from_hex_string ("000001FF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFA 51868783 BF2F966B 7FCC0148 F709A5D0 3BB5C9B8 899C47AE BB6FB71E 91386409")
- end
-
- sec_p521r1_a: INTEGER_X
- do
- create Result.make_from_hex_string ("000001FF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC")
- end
-
- sec_p521r1_b: INTEGER_X
- do
- create Result.make_from_hex_string ("00000051 953EB961 8E1C9A1F 929A21A0 B68540EE A2DA725B 99B315F3 B8B48991 8EF109E1 56194951 EC7A937B 1652C0BD 3BB1BF07 3573DF88 3D2C34F1 EF451FD4 6B503F00")
- end
-
- sec_p521r1_gx: INTEGER_X
- do
- create Result.make_from_hex_string ("000000C6 858E06B7 0404E9CD 9E3ECB66 2395B442 9C648139 053FB521 F828AF60 6B4D3DBA A14B5E77 EFE75928 FE1DC127 A2FFA8DE 3348B3C1 856A429B F97E7E31 C2E5BD66")
- end
-
- sec_p521r1_gy: INTEGER_X
- do
- create Result.make_from_hex_string ("00000118 39296A78 9A3BC004 5C8A5FB4 2C7D1BD9 98F54449 579B4468 17AFBD17 273E662C 97EE7299 5EF42640 C550B901 3FAD0761 353C7086 A272C240 88BE9476 9FD16650")
- end
-
- sec_p521r1_h: INTEGER_X
- do
- result := one
- end
-
-feature -- SEC t113r1
- sec_t113r1_m: INTEGER_32 = 113
-
- sec_t113r1_k1: INTEGER_32 = 9
-
- sec_t113r1_k2: INTEGER_32 = 0
-
- sec_t113r1_k3: INTEGER_32 = 0
-
- sec_t113r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00003088 250CA6E7 C7FE649C E85820F7")
- end
-
- sec_t113r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("0000E8BE E4D3E226 0744188B E0E9C723")
- end
-
- sec_t113r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00010000 00000000 00D9CCEC 8A39E56F")
- end
-
- sec_t113r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t113r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00009D73 616F35F4 AB1407D7 3562C10F")
- end
-
- sec_t113r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("0000A528 30277958 EE84D131 5ED31886")
- end
-
-feature -- SEC t113r2
- sec_t113r2_m: INTEGER_32 = 113
-
- sec_t113r2_k1: INTEGER_32 = 9
-
- sec_t113r2_k2: INTEGER_32 = 0
-
- sec_t113r2_k3: INTEGER_32 = 0
-
- sec_t113r2_a: INTEGER_X
- do
- create result.make_from_hex_string ("00006899 18DBEC7E 5A0DD6DF C0AA55C7")
- end
-
- sec_t113r2_b: INTEGER_X
- do
- create result.make_from_hex_string ("000095E9 A9EC9B29 7BD4BF36 E059184F")
- end
-
- sec_t113r2_r: INTEGER_X
- do
- create result.make_from_hex_string ("00010000 00000000 0108789B 2496AF93")
- end
-
- sec_t113r2_h: INTEGER_X
- do
- result := two
- end
-
- sec_t113r2_gx: INTEGER_X
- do
- create result.make_from_hex_string ("0001A57A 6A7B26CA 5EF52FCD B8164797")
- end
-
- sec_t113r2_gy: INTEGER_X
- do
- create result.make_from_hex_string ("0000B3AD C94ED1FE 674C06E6 95BABA1D")
- end
-
-feature -- SEC t131r1
- sec_t131r1_m: INTEGER_32 = 131
-
- sec_t131r1_k1: INTEGER_32 = 2
-
- sec_t131r1_k2: INTEGER_32 = 3
-
- sec_t131r1_k3: INTEGER_32 = 8
-
- sec_t131r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000007 A11B09A7 6B562144 418FF3FF 8C2570B8")
- end
-
- sec_t131r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000002 17C05610 884B63B9 C6C72916 78F9D341")
- end
-
- sec_t131r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000004 00000000 00000002 3123953A 9464B54D")
- end
-
- sec_t131r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t131r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 81BAF91F DF9833C4 0F9C1813 43638399")
- end
-
- sec_t131r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000007 8C6E7EA3 8C001F73 C8134B1B 4EF9E150")
- end
-
-feature -- SEC t131r2
- sec_t131r2_m: INTEGER_32 = 131
-
- sec_t131r2_k1: INTEGER_32 = 2
-
- sec_t131r2_k2: INTEGER_32 = 3
-
- sec_t131r2_k3: INTEGER_32 = 8
-
- sec_t131r2_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000003 E5A88919 D7CAFCBF 415F07C2 176573B2")
- end
-
- sec_t131r2_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000004 B8266A46 C55657AC 734CE38F 018F2192")
- end
-
- sec_t131r2_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000004 00000000 00000001 6954A233 049BA98F")
- end
-
- sec_t131r2_h: INTEGER_X
- do
- result := two
- end
-
- sec_t131r2_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000003 56DCD8F2 F95031AD 652D2395 1BB366A8")
- end
-
- sec_t131r2_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000006 48F06D86 7940A536 6D9E265D E9EB240F")
- end
-
-feature --SEC t163k1
- sec_t163k1_m: INTEGER_32 = 163
-
- sec_t163k1_k1: INTEGER_32 = 3
-
- sec_t163k1_k2: INTEGER_32 = 6
-
- sec_t163k1_k3: INTEGER_32 = 7
-
- sec_t163k1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t163k1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t163k1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000004 00000000 00000000 00020108 A2E0CC0D 99F8A5EF")
- end
-
- sec_t163k1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t163k1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000002 FE13C053 7BBC11AC AA07D793 DE4E6D5E 5C94EEE8")
- end
-
- sec_t163k1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000002 89070FB0 5D38FF58 321F2E80 0536D538 CCDAA3D9")
- end
-
-feature --SEC t163r1
- sec_t163r1_m: INTEGER_32 = 163
-
- sec_t163r1_k1: INTEGER_32 = 3
-
- sec_t163r1_k2: INTEGER_32 = 6
-
- sec_t163r1_k3: INTEGER_32 = 7
-
- sec_t163r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000007 B6882CAA EFA84F95 54FF8428 BD88E246 D2782AE2")
- end
-
- sec_t163r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000007 13612DCD DCB40AAB 946BDA29 CA91F73A F958AFD9")
- end
-
- sec_t163r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000003 FFFFFFFF FFFFFFFF FFFF48AA B689C29C A710279B")
- end
-
- sec_t163r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t163r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000003 69979697 AB438977 89566789 567F787A 7876A654")
- end
-
- sec_t163r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 435EDB42 EFAFB298 9D51FEFC E3C80988 F41FF883")
- end
-
-feature --SEC t163r2
- sec_t163r2_m: INTEGER_32 = 163
-
- sec_t163r2_k1: INTEGER_32 = 3
-
- sec_t163r2_k2: INTEGER_32 = 6
-
- sec_t163r2_k3: INTEGER_32 = 7
-
- sec_t163r2_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t163r2_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000002 0A601907 B8C953CA 1481EB10 512F7874 4A3205FD")
- end
-
- sec_t163r2_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000004 00000000 00000000 000292FE 77E70C12 A4234C33")
- end
-
- sec_t163r2_h: INTEGER_X
- do
- result := two
- end
-
- sec_t163r2_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000003 F0EBA162 86A2D57E A0991168 D4994637 E8343E36")
- end
-
- sec_t163r2_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 D51FBC6C 71A0094F A2CDD545 B11C5C0C 797324F1")
- end
-
-feature --SEC t193r1
- sec_t193r1_m: INTEGER_32 = 193
-
- sec_t193r1_k1: INTEGER_32 = 15
-
- sec_t193r1_k2: INTEGER_32 = 0
-
- sec_t193r1_k3: INTEGER_32 = 0
-
- sec_t193r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 17858FEB 7A989751 69E171F7 7B4087DE 098AC8A9 11DF7B01")
- end
-
- sec_t193r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 FDFB49BF E6C3A89F ACADAA7A 1E5BBC7C C1C2E5D8 31478814")
- end
-
- sec_t193r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000001 00000000 00000000 00000000 C7F34A77 8F443ACC 920EBA49")
- end
-
- sec_t193r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t193r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000001 F481BC5F 0FF84A74 AD6CDF6F DEF4BF61 79625372 D8C0C5E1")
- end
-
- sec_t193r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 25E399F2 903712CC F3EA9E3A 1AD17FB0 B3201B6A F7CE1B05")
- end
-
-feature --SEC t193r2
- sec_t193r2_m: INTEGER_32 = 193
-
- sec_t193r2_k1: INTEGER_32 = 15
-
- sec_t193r2_k2: INTEGER_32 = 0
-
- sec_t193r2_k3: INTEGER_32 = 0
-
- sec_t193r2_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000001 63F35A51 37C2CE3E A6ED8667 190B0BC4 3ECD6997 7702709B")
- end
-
- sec_t193r2_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 C9BB9E89 27D4D64C 377E2AB2 856A5B16 E3EFB7F6 1D4316AE")
- end
-
- sec_t193r2_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000001 00000000 00000000 00000001 5AAB561B 005413CC D4EE99D5")
- end
-
- sec_t193r2_h: INTEGER_X
- do
- result := two
- end
-
- sec_t193r2_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 D9B67D19 2E0367C8 03F39E1A 7E82CA14 A651350A AE617E8F")
- end
-
- sec_t193r2_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000001 CE943356 07C304AC 29E7DEFB D9CA01F5 96F92722 4CDECF6C")
- end
-
-feature --SEC t233k1
- sec_t233k1_m: INTEGER_32 = 233
-
- sec_t233k1_k1: INTEGER_32 = 74
-
- sec_t233k1_k2: INTEGER_32 = 0
-
- sec_t233k1_k3: INTEGER_32 = 0
-
- sec_t233k1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_t233k1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t233k1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000080 00000000 00000000 00000000 00069D5B B915BCD4 6EFB1AD5 F173ABDF")
- end
-
- sec_t233k1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t233k1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000172 32BA853A 7E731AF1 29F22FF4 149563A4 19C26BF5 0A4C9D6E EFAD6126")
- end
-
- sec_t233k1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("0000001D B537DECE 819B7F70 F555A67C 427A8CD9 BF18AEB9 B56E0C11 056FAE6A3")
- end
-
-feature --SEC t233r1
- sec_t233r1_m: INTEGER_32 = 233
-
- sec_t233r1_k1: INTEGER_32 = 74
-
- sec_t233r1_k2: INTEGER_32 = 0
-
- sec_t233r1_k3: INTEGER_32 = 0
-
- sec_t233r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t233r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000066 647EDE6C 332C7F8C 0923BB58 213B333B 20E9CE42 81FE115F 7D8F90AD")
- end
-
- sec_t233r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00000100 00000000 00000000 00000000 0013E974 E72F8A69 22031D26 03CFE0D7")
- end
-
- sec_t233r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t233r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("000000FA C9DFCBAC 8313BB21 39F1BB75 5FEF65BC 391F8B36 F8F8EB73 71FD558B")
- end
-
- sec_t233r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000100 6A08A419 03350678 E58528BE BF8A0BEF F867A7CA 36716F7E 01F81052")
- end
-
-feature --SEC t239k1
- sec_t239k1_m: INTEGER_32 = 239
-
- sec_t239k1_k1: INTEGER_32 = 158
-
- sec_t239k1_k2: INTEGER_32 = 0
-
- sec_t239k1_k3: INTEGER_32 = 0
-
- sec_t239k1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_t239k1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t239k1_r: INTEGER_X
- do
- create result.make_from_hex_string ("00002000 00000000 00000000 00000000 005A79FE C67CB6E9 1F1C1DA8 00E478A5")
- end
-
- sec_t239k1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t239k1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("000029A0 B6A887A9 83E97309 88A68727 A8B2D126 C44CC2CC 7B2A6555 193035DC")
- end
-
- sec_t239k1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00007631 0804F12E 549BDB01 1C103089 E73510AC B275FC31 2A5DC6B7 6553F0CA")
- end
-
-feature --SEC t283k1
- sec_t283k1_m: INTEGER_32 = 283
-
- sec_t283k1_k1: INTEGER_32 = 5
-
- sec_t283k1_k2: INTEGER_32 = 7
-
- sec_t283k1_k3: INTEGER_32 = 12
-
- sec_t283k1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_t283k1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t283k1_r: INTEGER_X
- do
- create result.make_from_hex_string ("01FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFE9AE 2ED07577 265DFF7F 94451E06 1E163C61")
- end
-
- sec_t283k1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t283k1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("0503213F 78CA4488 3F1A3B81 62F188E5 53CD265F 23C1567A 16876913 B0C2AC24 58492836")
- end
-
- sec_t283k1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("01CCDA38 0F1C9E31 8D90F95D 07E5426F E87E45C0 E8184698 E4596236 4E341161 77DD2259")
- end
-
-feature --SEC t283r1
- sec_t283r1_m: INTEGER_32 = 283
-
- sec_t283r1_k1: INTEGER_32 = 5
-
- sec_t283r1_k2: INTEGER_32 = 7
-
- sec_t283r1_k3: INTEGER_32 = 12
-
- sec_t283r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t283r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("027B680A C8B8596D A5A4AF8A 19A0303F CA97FD76 45309FA2 A581485A F6263E31 3B79A2F5")
- end
-
- sec_t283r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("03FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFEF90 399660FC 938A9016 5B042A7C EFADB307")
- end
-
- sec_t283r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t283r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("05F93925 8DB7DD90 E1934F8C 70B0DFEC 2EED25B8 557EAC9C 80E2E198 F8CDBECD 86B12053")
- end
-
- sec_t283r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("03676854 FE24141C B98FE6D4 B20D02B4 516FF702 350EDDB0 826779C8 13F0DF45 BE8112F4")
- end
-
-feature --SEC t409k1
- sec_t409k1_m: INTEGER_32 = 409
-
- sec_t409k1_k1: INTEGER_32 = 87
-
- sec_t409k1_k2: INTEGER_32 = 0
-
- sec_t409k1_k3: INTEGER_32 = 0
-
- sec_t409k1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_t409k1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t409k1_r: INTEGER_X
- do
- create result.make_from_hex_string ("007FFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFE5F 83B2D4EA 20400EC4 557D5ED3 E3E7CA5B 4B5C83B8 E01E5FCF")
- end
-
- sec_t409k1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t409k1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("0060F05F 658F49C1 AD3AB189 0F718421 0EFD0987 E307C84C 27ACCFB8 F9F67CC2 C460189E B5AAAA62 EE222EB1 B35540CF E9023746")
- end
-
- sec_t409k1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("01E36905 0B7C4E42 ACBA1DAC BF04299C 3460782F 918EA427 E6325165 E9EA10E3 DA5F6C42 E9C55215 AA9CA27A 5863EC48 D8E0286B")
- end
-
-feature --SEC t409r1
- sec_t409r1_m: INTEGER_32 = 409
-
- sec_t409r1_k1: INTEGER_32 = 87
-
- sec_t409r1_k2: INTEGER_32 = 0
-
- sec_t409r1_k3: INTEGER_32 = 0
-
- sec_t409r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t409r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("0021A5C2 C8EE9FEB 5C4B9A75 3B7B476B 7FD6422E F1F3DD67 4761FA99 D6AC27C8 A9A197B2 72822F6C D57A55AA 4F50AE31 7B13545F")
- end
-
- sec_t409r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("01000000 00000000 00000000 00000000 00000000 00000000 000001E2 AAD6A612 F33307BE 5FA47C3C 9E052F83 8164CD37 D9A21173")
- end
-
- sec_t409r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t409r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("015D4860 D088DDB3 496B0C60 64756260 441CDE4A F1771D4D B01FFE5B 34E59703 DC255A86 8A118051 5603AEAB 60794E54 BB7996A7")
- end
-
- sec_t409r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("0061B1CF AB6BE5F3 2BBFA783 24ED106A 7636B9C5 A7BD198D 0158AA4F 5488D08F 38514F1F DF4B4F40 D2181B36 81C364BA 0273C706")
- end
-
-feature --SEC t571k1
- sec_t571k1_m: INTEGER_32 = 571
-
- sec_t571k1_k1: INTEGER_32 = 2
-
- sec_t571k1_k2: INTEGER_32 = 5
-
- sec_t571k1_k3: INTEGER_32 = 10
-
- sec_t571k1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
- end
-
- sec_t571k1_b: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t571k1_r: INTEGER_X
- do
- create result.make_from_hex_string ("02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850E1 F19A63E4 B391A8DB 917F4138 B630D84B E5D63938 1E91DEB4 5CFE778F 637C1001")
- end
-
- sec_t571k1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t571k1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("026EB7A8 59923FBC 82189631 F8103FE4 AC9CA297 0012D5D4 60248048 01841CA4 43709584 93B205E6 47DA304D B4CEB08C BBD1BA39 494776FB 988B4717 4DCA88C7 E2945283 A01C8972")
- end
-
- sec_t571k1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("0349DC80 7F4FBF37 4F4AEADE 3BCA9531 4DD58CEC 9F307A54 FFC61EFC 006D8A2C 9D4979C0 AC44AEA7 4FBEBBB9 F772AEDC B620B01A 7BA7AF1B 320430C8 591984F6 01CD4C14 3EF1C7A3")
- end
-
-feature --SEC t571r1
- sec_t571r1_m: INTEGER_32 = 571
-
- sec_t571r1_k1: INTEGER_32 = 2
-
- sec_t571r1_k2: INTEGER_32 = 5
-
- sec_t571r1_k3: INTEGER_32 = 10
-
- sec_t571r1_a: INTEGER_X
- do
- create result.make_from_hex_string ("00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001")
- end
-
- sec_t571r1_b: INTEGER_X
- do
- create result.make_from_hex_string ("02F40E7E 2221F295 DE297117 B7F3D62F 5C6A97FF CB8CEFF1 CD6BA8CE 4A9A18AD 84FFABBD 8EFA5933 2BE7AD67 56A66E29 4AFD185A 78FF12AA 520E4DE7 39BACA0C 7FFEFF7F 2955727A")
- end
-
- sec_t571r1_r: INTEGER_X
- do
- create result.make_from_hex_string ("03FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF E661CE18 FF559873 08059B18 6823851E C7DD9CA1 161DE93D 5174D66E 8382E9BB 2FE84E47")
- end
-
- sec_t571r1_h: INTEGER_X
- do
- result := two
- end
-
- sec_t571r1_gx: INTEGER_X
- do
- create result.make_from_hex_string ("0303001D 34B85629 6C16C0D4 0D3CD775 0A93D1D2 955FA80A A5F40FC8 DB7B2ABD BDE53950 F4C0D293 CDD711A3 5B67FB14 99AE6003 8614F139 4ABFA3B4 C850D927 E1E7769C 8EEC2D19")
- end
-
- sec_t571r1_gy: INTEGER_X
- do
- create result.make_from_hex_string ("037BF273 42DA639B 6DCCFFFE B73D69D7 8C6C27A6 009CBBCA 1980F853 3921E8A6 84423E43 BAB08A57 6291AF8F 461BB2A8 B3531D2F 0485C19B 16E2F151 6E23DD3C 1A4827AF 1B8AC15B")
- end
-
---SEC uses different names than FIPS
---FIPS p is called q
---FIPS s is called seed and is the input to the SHA-1 hash algorithm
---FIPS c is the output of the SHA-1 hash algorithm
---FIPS a is lcrypto_q - lcrypto_a
---FIPS Gx is x
---FIPS Gy is y
---FIPS f, which is always 1, is h
---FIPS r is n
-
-feature -- FIPS P-192
- p192_p: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF")
- end
-
- p192_r: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831")
- end
-
- p192_a: INTEGER_X
- do
- create result.make_from_hex_string ("fffffffffffffffffffffffffffffffefffffffffffffffc")
- end
-
- p192_b: INTEGER_X
- do
- create result.make_from_hex_string ("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1")
- end
-
- p192_gx: INTEGER_X
- do
- create result.make_from_hex_string ("188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")
- end
-
- p192_gy: INTEGER_X
- do
- create result.make_from_hex_string ("07192b95ffc8da78631011ed6b24cdd573f977a11e794811")
- end
-
- p192_h: INTEGER_X
- do
- result := one
- end
-
-feature -- FIPS P-224
- p224_p: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001")
- end
-
- p224_r: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D")
- end
-
- p224_a: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE")
- end
-
- p224_b: INTEGER_X
- do
- create result.make_from_hex_string ("b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4")
- end
-
- p224_gx: INTEGER_X
- do
- create result.make_from_hex_string ("b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21")
- end
-
- p224_gy: INTEGER_X
- do
- create result.make_from_hex_string ("bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34")
- end
-
- p224_h: INTEGER_X
- do
- result := one
- end
-
-feature -- FIPS P-256
- p256_p: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF")
- end
-
- p256_r: INTEGER_X
- do
- create result.make_from_hex_string ("ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551")
- end
-
- p256_a: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC")
- ensure
- result ~ (p256_p - create {INTEGER_X}.make_from_integer (3))
- end
-
- p256_b: INTEGER_X
- do
- create result.make_from_hex_string ("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b")
- end
-
- p256_gx: INTEGER_X
- do
- create result.make_from_hex_string ("6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296")
- end
-
- p256_gy: INTEGER_X
- do
- create result.make_from_hex_string ("4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")
- end
-
- p256_h: INTEGER_X
- do
- result := one
- end
-
-feature -- FIPS p-384
- p384_p: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF")
- end
-
- p384_r: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973")
- end
-
- p384_a: INTEGER_X
- do
- create result.make_from_hex_string ("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC")
- end
-
- p384_b: INTEGER_X
- do
- create result.make_from_hex_string ("B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF")
- end
-
- p384_gx: INTEGER_X
- do
- create result.make_from_hex_string ("AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7")
- end
-
- p384_gy: INTEGER_X
- do
- create result.make_from_hex_string ("3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F")
- end
-
- p384_h: INTEGER_X
- do
- result := one
- end
-
-feature -- FIPS p-521
- p521_p: INTEGER_X
- do
- create result.make_from_string ("6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151")
- end
-
- p521_r: INTEGER_X
- do
- create result.make_from_hex_string ("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409")
- end
-
- p521_a: INTEGER_X
- do
- create result.make_from_string ("6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057148")
- end
-
- p521_b: INTEGER_X
- do
- create result.make_from_hex_string ("051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00")
- end
-
- p521_gx: INTEGER_X
- do
- create result.make_from_hex_string ("c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66")
- end
-
- p521_gy: INTEGER_X
- do
- create result.make_from_hex_string ("11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")
- end
-
- p521_h: INTEGER_X
- do
- result := one
- end
-
-feature -- FIPS K-163
- k163_m: INTEGER = 163
- k163_k1: INTEGER = 3
- k163_k2: INTEGER = 6
- k163_k3: INTEGER = 7
-
- k163_a: INTEGER_X
- do
- result := one
- end
-
- k163_b: INTEGER_X
- do
- result := one
- end
-
- k163_r: INTEGER_X
- do
- create result.make_from_hex_string ("5846006549323611672814741753598448348329118574063")
- end
-
- k163_h: INTEGER_X
- do
- result := two
- end
-
- k163_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00000002 FE13C053 7BBC11AC AA07D793 DE4E6D5E 5C94EEE8")
- end
-
- k163_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00000002 89070FB0 5D38FF58 321F2E80 0536D538 CCDAA3D9")
- end
-
-feature -- FIPS K-233
- k233_m: INTEGER = 233
- k233_k1: INTEGER = 0
- k233_k2: INTEGER = 0
- k233_k3: INTEGER = 71
-
- k233_a: INTEGER_X
- do
- result := zero
- end
-
- k233_b: INTEGER_X
- do
- result := one
- end
-
- k233_r: INTEGER_X
- do
- create result.make_from_hex_string ("8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF")
- end
-
- k233_h: INTEGER_X
- do
- result := four
- end
-
- k233_gx: INTEGER_X
- do
- create result.make_from_hex_string ("17232ba853a7e731af129f22ff4149563a419c26bf50a4c9d6eefad6126")
- end
-
- k233_gy: INTEGER_X
- do
- create result.make_from_hex_string ("1db537dece819b7f70f555a67c427a8cd9bf18aeb9b56e0c11056fae6a3")
- end
-
-feature -- FIPS K-283
- k283_m: INTEGER = 283
- k283_k1: INTEGER = 5
- k283_k2: INTEGER = 7
- k283_k3: INTEGER = 12
-
- k283_a: INTEGER_X
- do
- result := zero
- end
-
- k283_b: INTEGER_X
- do
- result := one
- end
-
- k283_r: INTEGER_X
- do
- create result.make_from_hex_string ("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61")
- end
-
- k283_h: INTEGER_X
- do
- result := four
- end
-
- k283_gx: INTEGER_X
- do
- create result.make_from_hex_string ("503213f78ca44883f1a3b8162f188e553cd265f23c1567a16876913b0c2ac2458492836")
- end
-
- k283_gy: INTEGER_X
- do
- create result.make_from_hex_string ("1ccda380f1c9e318d90f95d07e5426fe87e45c0e8184698e45962364e34116177dd2259")
- end
-
-feature -- FIPS K-409
- k409_m: INTEGER = 409
- k409_k1: INTEGER = 0
- k409_k2: INTEGER = 0
- k409_k3: INTEGER = 87
-
- k409_a: INTEGER_X
- do
- result := zero
- end
-
- k409_b: INTEGER_X
- do
- result := one
- end
-
- k409_r: INTEGER_X
- do
- create result.make_from_hex_string ("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF")
- end
-
- k409_h: INTEGER_X
- do
- result := four
- end
-
- k409_gx: INTEGER_X
- do
- create result.make_from_hex_string ("0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746")
- end
-
- k409_gy: INTEGER_X
- do
- create result.make_from_hex_string ("01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B")
- end
-
-feature -- FIPS K-571
- k571_m: INTEGER = 571
- k571_k1: INTEGER = 2
- k571_k2: INTEGER = 5
- k571_k3: INTEGER = 10
-
- k571_a: INTEGER_X
- do
- result := zero
- end
-
- k571_b: INTEGER_X
- do
- result := one
- end
-
- k571_r: INTEGER_X
- do
- create result.make_from_hex_string ("020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001")
- end
-
- k571_h: INTEGER_X
- do
- result := four
- end
-
- k571_gx: INTEGER_X
- do
- create result.make_from_hex_string ("026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972")
- end
-
- k571_gy: INTEGER_X
- do
- create result.make_from_hex_string ("0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3")
- end
-
-feature -- FIPS B-163
- b163_m: INTEGER = 163
- b163_k1: INTEGER = 3
- b163_k2: INTEGER = 6
- b163_k3: INTEGER = 7
-
- b163_a: INTEGER_X
- do
- result := one
- end
-
- b163_b: INTEGER_X
- do
- create result.make_from_hex_string ("020A601907B8C953CA1481EB10512F78744A3205FD")
- end
-
- b163_r: INTEGER_X
- do
- create result.make_from_hex_string ("040000000000000000000292FE77E70C12A4234C33")
- end
-
- b163_h: INTEGER_X
- do
- result := two
- end
-
- b163_gx: INTEGER_X
- do
- create result.make_from_hex_string ("03F0EBA16286A2D57EA0991168D4994637E8343E36")
- end
-
- b163_gy: INTEGER_X
- do
- create result.make_from_hex_string ("00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1")
- end
-
-feature -- FIPS B-233
- b233_m: INTEGER = 233
- b233_k1: INTEGER = 0
- b233_k2: INTEGER = 0
- b233_k3: INTEGER = 71
-
- b233_a: INTEGER_X
- do
- result := one
- end
-
- b233_b: INTEGER_X
- do
- create result.make_from_hex_string ("0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD")
- end
-
- b233_r: INTEGER_X
- do
- create result.make_from_hex_string ("01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7")
- end
-
- b233_h: INTEGER_X
- do
- result := two
- end
-
- b233_gx: INTEGER_X
- do
- create result.make_from_hex_string ("00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B")
- end
-
- b233_gy: INTEGER_X
- do
- create result.make_from_hex_string ("01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052")
- end
-
-feature -- FIPS B-283
- b283_m: INTEGER = 283
- b283_k1: INTEGER = 5
- b283_k2: INTEGER = 7
- b283_k3: INTEGER = 12
-
- b283_a: INTEGER_X
- do
- result := one
- end
-
- b283_b: INTEGER_X
- do
- result := one
- end
-
- b283_r: INTEGER_X
- do
- create result.make_from_hex_string ("03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307")
- end
-
- b283_h: INTEGER_X
- do
- result := two
- end
-
- b283_gx: INTEGER_X
- do
- create result.make_from_hex_string ("05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053")
- end
-
- b283_gy: INTEGER_X
- do
- create result.make_from_hex_string ("03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4")
- end
-
-feature -- FIPS B-409
- b409_m: INTEGER = 409
- b409_k1: INTEGER = 0
- b409_k2: INTEGER = 0
- b409_k3: INTEGER = 87
-
- b409_a: INTEGER_X
- do
- result := one
- end
-
- b409_b: INTEGER_X
- do
- create result.make_from_hex_string ("0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F")
- end
-
- b409_r: INTEGER_X
- do
- create result.make_from_hex_string ("010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173")
- end
-
- b409_h: INTEGER_X
- do
- result := two
- end
-
- b409_gx: INTEGER_X
- do
- create result.make_from_hex_string ("015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7")
- end
-
- b409_gy: INTEGER_X
- do
- create result.make_from_hex_string ("0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706")
- end
-
-feature -- FIPS B-571
- b571_m: INTEGER = 571
- b571_k1: INTEGER = 2
- b571_k2: INTEGER = 5
- b571_k3: INTEGER = 10
-
- b571_a: INTEGER_X
- do
- result := one
- end
-
- b571_b: INTEGER_X
- do
- create result.make_from_hex_string ("2f40e7e2221f295de297117b7f3d62f5c6a97ffcb8ceff1cd6ba8ce4a9a18ad84ffabbd8efa59332be7ad6756a66e294afd185a78ff12aa520e4de739baca0c7ffeff7f2955727a")
- end
-
- b571_r: INTEGER_X
- do
- create result.make_from_hex_string ("03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47")
- end
-
- b571_h: INTEGER_X
- do
- result := two
- end
-
- b571_gx: INTEGER_X
- do
- create result.make_from_hex_string ("303001d34b856296c16c0d40d3cd7750a93d1d2955fa80aa5f40fc8db7b2abdbde53950f4c0d293cdd711a35b67fb1499ae60038614f1394abfa3b4c850d927e1e7769c8eec2d19")
- end
-
- b571_gy: INTEGER_X
- do
- create result.make_from_hex_string ("037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B")
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/hmac/hmac_sha256.e b/contrib/ise_library/text/encryption/eel/src/hmac/hmac_sha256.e
deleted file mode 100644
index 1984b71f..00000000
--- a/contrib/ise_library/text/encryption/eel/src/hmac/hmac_sha256.e
+++ /dev/null
@@ -1,133 +0,0 @@
-note
- description: "Summary description for {HMAC_SHA256}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The bureaucracy is expanding to meet the needs of an expanding bureaucracy."
-
-class
- HMAC_SHA256
-
-inherit
- BYTE_FACILITIES
-
-create
-
- make,
- make_ascii_key
-
-feature {NONE}
-
- make (key_a: READABLE_INTEGER_X)
- local
- reduced_key: READABLE_INTEGER_X
- do
- if key_a.bytes <= 64 then
- reduced_key := pad_key (key_a)
- else
- reduced_key := reduce_key (key_a)
- end
- ipad := (reduced_key.bit_xor_value (create {INTEGER_X}.make_from_hex_string ("36363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636"))).as_fixed_width_byte_array (64)
- opad := (reduced_key.bit_xor_value (create {INTEGER_X}.make_from_hex_string ("5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c"))).as_fixed_width_byte_array (64)
- create hmac.default_create
- create message_hash.make
- feed_inner_mix
- end
-
- make_ascii_key (key_a: READABLE_STRING_8)
- local
- key_bytes: SPECIAL [NATURAL_8]
- i: INTEGER
- do
- create key_bytes.make_filled (0, key_a.count)
- from
- i := 1
- until
- i > key_a.count
- loop
- key_bytes [i - 1] := key_a [i].code.to_natural_8
- i := i + 1
- end
- make (create {INTEGER_X}.make_from_bytes (key_bytes, 0, key_bytes.count - 1))
- end
-
-feature
-
- finish
- local
- hash_inner: SPECIAL [NATURAL_8]
- hash_outer: SPECIAL [NATURAL_8]
- hmac_hash: SHA256
- do
- create hash_inner.make_filled (0, 32)
- message_hash.do_final (hash_inner, 0)
- create hmac_hash.make
- hmac_hash.sink_special_lsb (opad, 0, 63)
- hmac_hash.sink_special_lsb (hash_inner, 0, 31)
- create hash_outer.make_filled (0, 32)
- hmac_hash.do_final (hash_outer, 0)
- create hmac.make_from_bytes (hash_outer, 0, 31)
- finished := True
- ensure
- finished
- end
-
- finished: BOOLEAN
-
- hmac: INTEGER_X
--- require
--- finished
--- attribute
--- end
-
- reset
- do
- message_hash.reset
- finished := False
- ensure
- not finished
- end
-
-feature {NONE}
-
- reduce_key (key_a: READABLE_INTEGER_X): INTEGER_X
- require
--- key_a.bytes <= 64
- local
- hash: SHA256
- result_bytes: SPECIAL [NATURAL_8]
- key_bytes: SPECIAL [NATURAL_8]
- do
- create hash.make
- key_bytes := key_a.as_bytes
- hash.sink_special (key_bytes, key_bytes.lower, key_bytes.upper)
- create result_bytes.make_filled (0, 64)
- hash.do_final (result_bytes, 0)
- create Result.make_from_bytes (result_bytes, 0, 63)
- end
-
- pad_key (key_a: READABLE_INTEGER_X): INTEGER_X
- local
- key_bytes: SPECIAL [NATURAL_8]
- result_bytes: SPECIAL [NATURAL_8]
- do
- create result_bytes.make_filled (0, 64)
- key_bytes := key_a.as_bytes
- result_bytes.copy_data (key_bytes, 0, 0, key_bytes.count)
- create Result.make_from_bytes (result_bytes, 0, 63)
- end
-
- feed_inner_mix
- do
- sink_special_lsb (ipad, 0, 63)
- end
-
- byte_sink (in: NATURAL_8)
- do
- message_hash.update (in)
- end
-
- message_hash: SHA256
- ipad: SPECIAL [NATURAL_8]
- opad: SPECIAL [NATURAL_8]
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/cbc_decryption.e b/contrib/ise_library/text/encryption/eel/src/modes/cbc_decryption.e
deleted file mode 100644
index 41c2d080..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/cbc_decryption.e
+++ /dev/null
@@ -1,58 +0,0 @@
-note
- description: "Cipher Block Chaining mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Just because you do not take an interest in politics doesn't mean politics won't take an interest in you. - Pericles (430 BC)"
-
-class
- CBC_DECRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: CBC_TARGET iv: SPECIAL [NATURAL_8] iv_offset: INTEGER_32)
- require
- iv.valid_index (iv_offset)
- iv.valid_index (iv_offset + target_a.block_size - 1)
- do
- target := target_a
- create last.make_filled (0, iv.count)
- last.copy_data (iv, iv_offset, 0, last.count)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- decrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- cbc_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- target.decrypt_block (in, in_offset, out_array, out_offset)
- array_xor (last, 0, out_array, out_offset, out_array, out_offset, block_size)
- last.copy_data (in, in_offset, 0, block_size)
- end
-
- cbc_ready: BOOLEAN
- do
- result := target.cbc_ready
- end
-
-feature {NONE}
- last: SPECIAL [NATURAL_8]
- target: CBC_TARGET
-
-invariant
- last.count = target.block_size
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/cbc_encryption.e b/contrib/ise_library/text/encryption/eel/src/modes/cbc_encryption.e
deleted file mode 100644
index bf469c75..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/cbc_encryption.e
+++ /dev/null
@@ -1,57 +0,0 @@
-note
- description: "Cipher Block Chaining mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Nothing is so permanent as a temporary government program. - Milton Friedman"
-
-class
- CBC_ENCRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: CBC_TARGET iv: SPECIAL [NATURAL_8] iv_offset: INTEGER_32)
- require
- iv.count = target_a.block_size
- do
- target := target_a
- create last.make_filled (0, iv.count)
- last.copy_data (iv, iv_offset, 0, last.count)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- cbc_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- array_xor (last, 0, in, in_offset, last, 0, block_size)
- target.encrypt_block (last, 0, out_array, out_offset)
- last.copy_data (out_array, out_offset, 0, block_size)
- end
-
- cbc_ready: BOOLEAN
- do
- result := target.cbc_ready
- end
-
-feature {NONE}
- last: SPECIAL [NATURAL_8]
- target: CBC_TARGET
-
-invariant
- last.count = target.block_size
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/cbc_target.e b/contrib/ise_library/text/encryption/eel/src/modes/cbc_target.e
deleted file mode 100644
index c37a1a73..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/cbc_target.e
+++ /dev/null
@@ -1,41 +0,0 @@
-note
- description: "A block cipher that can be the target of CBC mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "I don't make jokes. I just watch the government and report the facts. - Will Rogers"
-
-deferred class
- CBC_TARGET
-
-feature
- block_size: INTEGER_32
- deferred
- ensure
- Result > 0
- end
-
- cbc_ready: BOOLEAN
- deferred
- end
-
- decrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- cbc_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- deferred
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- cbc_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- deferred
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/cfb_decryption.e b/contrib/ise_library/text/encryption/eel/src/modes/cfb_decryption.e
deleted file mode 100644
index 6f228b8a..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/cfb_decryption.e
+++ /dev/null
@@ -1,69 +0,0 @@
-note
- description: "Cipher Feedback decryption mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The strongest reason for the people to retain the right to bear arms is, as a last resort, to protect themselves against tyranny in government. - Thomas Jefferson"
-
-class
- CFB_DECRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: CFB_TARGET iv: SPECIAL [NATURAL_8] iv_offset: INTEGER_32 select_block_size_a: INTEGER_32)
- require
- iv.valid_index (iv_offset)
- iv.valid_index (iv_offset + target_a.block_size - 1)
- select_block_size_a > 0
- select_block_size_a <= target_a.block_size
- do
- select_block_size := select_block_size_a
- target := target_a
- create last.make_filled (0, block_size)
- last.copy_data (iv, iv_offset, 0, last.count)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- select_block_size: INTEGER_32
- attribute
- ensure
- Result > 0
- Result <= block_size
- end
-
- decrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- cfb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + select_block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + select_block_size - 1)
- do
- target.encrypt_block (last, 0, out_array, out_offset)
- last.overlapping_move (select_block_size, 0, block_size - select_block_size)
- last.copy_data (in, in_offset, block_size - select_block_size, select_block_size)
- array_xor (out_array, out_offset, in, in_offset, out_array, out_offset, select_block_size)
- end
-
- cfb_ready: BOOLEAN
- do
- result := target.cfb_ready
- end
-
-feature {NONE}
- last: SPECIAL [NATURAL_8]
- target: CFB_TARGET
-
-invariant
- last.count = block_size
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/cfb_encryption.e b/contrib/ise_library/text/encryption/eel/src/modes/cfb_encryption.e
deleted file mode 100644
index 4cdf9214..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/cfb_encryption.e
+++ /dev/null
@@ -1,69 +0,0 @@
-note
- description: "Summary description for {CFB_ENCRYPTION}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The era of resisting big government is never over. - Paul Gigot (1998)"
-
-class
- CFB_ENCRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: CFB_TARGET iv: SPECIAL [NATURAL_8] iv_offset: INTEGER_32 select_block_size_a: INTEGER_32)
- require
- iv.valid_index (iv_offset)
- iv.valid_index (iv_offset + target_a.block_size - 1)
- select_block_size_a > 0
- select_block_size_a <= target_a.block_size
- do
- select_block_size := select_block_size_a
- target := target_a
- create last.make_filled (0, block_size)
- last.copy_data (iv, iv_offset, 0, last.count)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- select_block_size: INTEGER_32
- attribute
- ensure
- Result > 0
- Result <= block_size
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- cfb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + select_block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + select_block_size - 1)
- do
- target.encrypt_block (last, 0, out_array, out_offset)
- array_xor (out_array, out_offset, in, in_offset, out_array, out_offset, select_block_size)
- last.overlapping_move (select_block_size, 0, block_size - select_block_size)
- last.copy_data (out_array, out_offset, block_size - select_block_size, select_block_size)
- end
-
- cfb_ready: BOOLEAN
- do
- result := target.cfb_ready
- end
-
-feature {NONE}
- last: SPECIAL [NATURAL_8]
- target: CFB_TARGET
-
-invariant
- last.count = block_size
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/cfb_target.e b/contrib/ise_library/text/encryption/eel/src/modes/cfb_target.e
deleted file mode 100644
index 850908b6..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/cfb_target.e
+++ /dev/null
@@ -1,31 +0,0 @@
-note
- description: "A block cipher that can be the target of CFB mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The ultimate result of shielding men from the effects of folly is to fill the world with fools. - Herbert Spencer (1891)"
-
-deferred class
- CFB_TARGET
-
-feature
- block_size: INTEGER_32
- deferred
- ensure
- Result > 0
- end
-
- cfb_ready: BOOLEAN
- deferred
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- cfb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- deferred
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ctr_decryption.e b/contrib/ise_library/text/encryption/eel/src/modes/ctr_decryption.e
deleted file mode 100644
index ede30142..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ctr_decryption.e
+++ /dev/null
@@ -1,57 +0,0 @@
-note
- description: "Counter decryption mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "If you have been voting for politicians who promise to give you goodies at someone else's expense, then you have no right to complain when they take your money and give it to someone else, including themselves. - Thomas Sowell (1992)"
-
-class
- CTR_DECRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: CTR_TARGET iv: INTEGER_X)
- do
- target := target_a
- create counter
- counter.copy (iv)
- max := counter.one.bit_shift_left_value (block_size * 8)
- create counter_array.make_filled (0, block_size)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- decrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ctr_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- counter.to_fixed_width_byte_array (counter_array, 0, block_size - 1)
- target.encrypt_block (counter_array, 0, out_array, out_offset)
- array_xor (out_array, out_offset, in, in_offset, out_array, out_offset, block_size)
- counter := (counter + counter.one) \\ max
- end
-
- ctr_ready: BOOLEAN
- do
- result := target.ctr_ready
- end
-
-feature {NONE}
- counter_array: SPECIAL [NATURAL_8]
- counter: INTEGER_X
- max: INTEGER_X
- target: CTR_TARGET
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ctr_encryption.e b/contrib/ise_library/text/encryption/eel/src/modes/ctr_encryption.e
deleted file mode 100644
index 272d23cf..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ctr_encryption.e
+++ /dev/null
@@ -1,57 +0,0 @@
-note
- description: "Counter encryption mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "There never was a good war or a bad peace. - Benjamin Franklin (1773) "
-
-class
- CTR_ENCRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: CTR_TARGET iv: INTEGER_X)
- do
- target := target_a
- create counter
- counter.copy (iv)
- max := counter.one.bit_shift_left_value (block_size * 8)
- create counter_array.make_filled (0, block_size)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ctr_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- counter.to_fixed_width_byte_array (counter_array, 0, block_size - 1)
- target.encrypt_block (counter_array, 0, out_array, out_offset)
- array_xor (out_array, out_offset, in, in_offset, out_array, out_offset, block_size)
- counter := (counter + counter.one) \\ max
- end
-
- ctr_ready: BOOLEAN
- do
- result := target.ctr_ready
- end
-
-feature {NONE}
- counter_array: SPECIAL [NATURAL_8]
- counter: INTEGER_X
- max: INTEGER_X
- target: CTR_TARGET
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ctr_target.e b/contrib/ise_library/text/encryption/eel/src/modes/ctr_target.e
deleted file mode 100644
index 0ec12d8a..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ctr_target.e
+++ /dev/null
@@ -1,31 +0,0 @@
-note
- description: "A block cipher that can be the target of CTR mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Everything that is really great and inspiring is created by the individual who can labor in freedom. - Albert Einstein"
-
-deferred class
- CTR_TARGET
-
-feature
- block_size: INTEGER_32
- deferred
- ensure
- Result > 0
- end
-
- ctr_ready: BOOLEAN
- deferred
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ctr_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- deferred
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ecb_decryption.e b/contrib/ise_library/text/encryption/eel/src/modes/ecb_decryption.e
deleted file mode 100644
index a6ee787f..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ecb_decryption.e
+++ /dev/null
@@ -1,44 +0,0 @@
-note
- description: "Electronic Codebook decryption mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "There are just two rules of governance in a free society: Mind your own business. Keep your hands to yourself. - P.J. O'Rourke (1993)"
-
-class
- ECB_DECRYPTION
-
-create
- make
-
-feature
- make (target_a: ECB_TARGET)
- do
- target := target_a
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- decrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ecb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- target.decrypt_block (in, in_offset, out_array, out_offset)
- end
-
- ecb_ready: BOOLEAN
- do
- result := target.ecb_ready
- end
-
-feature {NONE}
- target: ECB_TARGET
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ecb_encryption.e b/contrib/ise_library/text/encryption/eel/src/modes/ecb_encryption.e
deleted file mode 100644
index a8d3cd6c..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ecb_encryption.e
+++ /dev/null
@@ -1,44 +0,0 @@
-note
- description: "Electronic Codebook encryption mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Necessity is the plea for every infringement of human freedom. It is the argument of tyrants; it is the creed of slaves. - William Pitt (1783)"
-
-class
- ECB_ENCRYPTION
-
-create
- make
-
-feature
- make (target_a: ECB_TARGET)
- do
- target := target_a
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ecb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- target.encrypt_block (in, in_offset, out_array, out_offset)
- end
-
- ecb_ready: BOOLEAN
- do
- result := target.ecb_ready
- end
-
-feature {NONE}
- target: ECB_TARGET
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ecb_target.e b/contrib/ise_library/text/encryption/eel/src/modes/ecb_target.e
deleted file mode 100644
index 64cb0348..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ecb_target.e
+++ /dev/null
@@ -1,41 +0,0 @@
-note
- description: "A block cipher that can be the target of ECB mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "A government that is big enough to give you all you want is big enough to take it all away. - Barry Goldwater (1964)"
-
-deferred class
- ECB_TARGET
-
-feature
- block_size: INTEGER_32
- deferred
- ensure
- Result > 0
- end
-
- ecb_ready: BOOLEAN
- deferred
- end
-
- decrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ecb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- deferred
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ecb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- deferred
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/mode_test_data.e b/contrib/ise_library/text/encryption/eel/src/modes/mode_test_data.e
deleted file mode 100644
index 1f80c46f..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/mode_test_data.e
+++ /dev/null
@@ -1,45 +0,0 @@
-note
- description: "Summary description for {MODE_TEST_DATA}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The only thing necessary for evil to triumph is for good men to do nothing. - Edmund Burke"
-
-deferred class
- MODE_TEST_DATA
-
-feature
- make_data
- local
- block_1_text: INTEGER_X
- block_2_text: INTEGER_X
- block_3_text: INTEGER_X
- block_4_text: INTEGER_X
- iv_text: INTEGER_X
- do
- create block_1_text.make_from_hex_string ("6bc1bee22e409f96e93d7e117393172a")
- create block_1.make_filled (0, 16)
- block_1_text.to_fixed_width_byte_array (block_1, 0, 15)
- create block_2_text.make_from_hex_string ("ae2d8a571e03ac9c9eb76fac45af8e51")
- create block_2.make_filled (0, 16)
- block_2_text.to_fixed_width_byte_array (block_2, 0, 15)
- create block_3_text.make_from_hex_string ("30c81c46a35ce411e5fbc1191a0a52ef")
- create block_3.make_filled (0, 16)
- block_3_text.to_fixed_width_byte_array (block_3, 0, 15)
- create block_4_text.make_from_hex_string ("f69f2445df4f9b17ad2b417be66c3710")
- create block_4.make_filled (0, 16)
- block_4_text.to_fixed_width_byte_array (block_4, 0, 15)
- create iv_text.make_from_hex_string ("000102030405060708090a0b0c0d0e0f")
- create iv.make_filled (0, 16)
- iv_text.to_fixed_width_byte_array (iv, 0, 15)
- create iv_counter.make_from_hex_string ("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff")
- end
-
- block_1: SPECIAL [NATURAL_8]
- block_2: SPECIAL [NATURAL_8]
- block_3: SPECIAL [NATURAL_8]
- block_4: SPECIAL [NATURAL_8]
-
- iv: SPECIAL [NATURAL_8]
- iv_counter: INTEGER_X
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ofb_decryption.e b/contrib/ise_library/text/encryption/eel/src/modes/ofb_decryption.e
deleted file mode 100644
index 07e2621c..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ofb_decryption.e
+++ /dev/null
@@ -1,55 +0,0 @@
-note
- description: "Output Feedback decryption mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Sometimes it is said that man cannot be trusted with the government of himself. Can he, then, be trusted with the government of others? - Thomas Jefferson (1801)"
-
-class
- OFB_DECRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: OFB_TARGET iv: SPECIAL [NATURAL_8] iv_offset: INTEGER_32)
- require
- iv.valid_index (iv_offset)
- iv.valid_index (iv_offset + target_a.block_size - 1)
- do
- target := target_a
- create last.make_filled (0, block_size)
- last.copy_data (iv, iv_offset, 0, block_size)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- decrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ofb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- target.encrypt_block (last, 0, out_array, out_offset)
- last.copy_data (out_array, out_offset, 0, block_size)
- array_xor (last, 0, in, in_offset, out_array, out_offset, block_size)
- end
-
- ofb_ready: BOOLEAN
- do
- result := target.ofb_ready
- end
-
-feature {NONE}
- last: SPECIAL [NATURAL_8]
- target: OFB_TARGET
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ofb_encryption.e b/contrib/ise_library/text/encryption/eel/src/modes/ofb_encryption.e
deleted file mode 100644
index c9d32f1d..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ofb_encryption.e
+++ /dev/null
@@ -1,55 +0,0 @@
-note
- description: "Output Feedback encryption mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Power tends to corrupt, and absolute power corrupts absolutely. - Lord Acton (1887)"
-
-class
- OFB_ENCRYPTION
-
-inherit
- ARRAY_FACILITIES
-
-create
- make
-
-feature
- make (target_a: OFB_TARGET iv: SPECIAL [NATURAL_8] iv_offset: INTEGER_32)
- require
- iv.valid_index (iv_offset)
- iv.valid_index (iv_offset + target_a.block_size - 1)
- do
- target := target_a
- create last.make_filled (0, block_size)
- last.copy_data (iv, iv_offset, 0, block_size)
- end
-
-feature
- block_size: INTEGER_32
- do
- result := target.block_size
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ofb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- do
- target.encrypt_block (last, 0, out_array, out_offset)
- last.copy_data (out_array, out_offset, 0, block_size)
- array_xor (last, 0, in, in_offset, out_array, out_offset, block_size)
- end
-
- ofb_ready: BOOLEAN
- do
- result := target.ofb_ready
- end
-
-feature {NONE}
- last: SPECIAL [NATURAL_8]
- target: OFB_TARGET
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/modes/ofb_target.e b/contrib/ise_library/text/encryption/eel/src/modes/ofb_target.e
deleted file mode 100644
index d9102acc..00000000
--- a/contrib/ise_library/text/encryption/eel/src/modes/ofb_target.e
+++ /dev/null
@@ -1,31 +0,0 @@
-note
- description: "A block cipher that can be the target of OFB mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Political power grows out of the barrel of a gun. - Mao Zedong (1938)"
-
-deferred class
- OFB_TARGET
-
-feature
- block_size: INTEGER_32
- deferred
- ensure
- Result > 0
- end
-
- ofb_ready: BOOLEAN
- deferred
- end
-
- encrypt_block (in: SPECIAL [NATURAL_8] in_offset: INTEGER_32 out_array: SPECIAL [NATURAL_8] out_offset: INTEGER_32)
- require
- ofb_ready
- in.valid_index (in_offset)
- in.valid_index (in_offset + block_size - 1)
- out_array.valid_index (out_offset)
- out_array.valid_index (out_offset + block_size - 1)
- deferred
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/rotate_facilities.e b/contrib/ise_library/text/encryption/eel/src/rotate_facilities.e
deleted file mode 100644
index 1c880af5..00000000
--- a/contrib/ise_library/text/encryption/eel/src/rotate_facilities.e
+++ /dev/null
@@ -1,31 +0,0 @@
-note
- description: "Provides facilities to rotate integers"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The more corrupt the state, the more it legislates. - Tacitus"
-
-deferred class
- ROTATE_FACILITIES
-
-feature
- rotate_right_32 (in: NATURAL_32 count: INTEGER_32): NATURAL_32
- require
- count_too_small: count >= 0
- count_too_big: count <= 32
- do
- result := (in |>> count) | (in |<< (32 - count))
- ensure
- rotate_definition: result = (in |>> count) | (in |<< (32 - count))
- end
-
- rotate_left_32 (in: NATURAL_32 count: INTEGER_32): NATURAL_32
- require
- count_too_small: count >= 0
- count_too_big: count <= 32
- do
- result := (in |<< count) | (in |>> (32 - count))
- ensure
- rotate_definition: result = (in |<< count) | (in |>> (32 - count))
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/algorithm_identifier.e b/contrib/ise_library/text/encryption/eel/src/x509/algorithm_identifier.e
deleted file mode 100644
index 504de2cd..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/algorithm_identifier.e
+++ /dev/null
@@ -1,38 +0,0 @@
-note
- description: "x509v3 AlgorithmIdentifier sequence"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "When you subsidize poverty and failure, you get more of both. - James Dale Davidson, National Taxpayers Union"
-
-class
- ALGORITHM_IDENTIFIER
-
-inherit
- ANY
- redefine
- is_equal
- end
-
-create
- make
-
-feature
- make (algorithm_a: OBJECT_IDENTIFIER parameters_a: ALGORITHM_PARAMETERS)
- do
- algorithm := algorithm_a
- parameters := parameters_a
- end
-
- is_equal (other: like Current): BOOLEAN
- do
- result := algorithm ~ other.algorithm and parameters ~ other.parameters
- ensure then
- algorithm ~ other.algorithm
- parameters ~ other.parameters
- end
-
-feature
- algorithm: OBJECT_IDENTIFIER
- parameters: ALGORITHM_PARAMETERS
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/algorithm_parameters.e b/contrib/ise_library/text/encryption/eel/src/x509/algorithm_parameters.e
deleted file mode 100644
index 153309e1..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/algorithm_parameters.e
+++ /dev/null
@@ -1,11 +0,0 @@
-note
- description: "Summary description for {ALGORITHM_PARAMETERS}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "If we have to kill 12 people to save 1 human life it will have been worth it. - Unknown"
-
-class
- ALGORITHM_PARAMETERS
-
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/attribute_type_and_value.e b/contrib/ise_library/text/encryption/eel/src/x509/attribute_type_and_value.e
deleted file mode 100644
index 729b5439..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/attribute_type_and_value.e
+++ /dev/null
@@ -1,24 +0,0 @@
-note
- description: "x509v3 AttributeTypeAndValue sequence"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Truth and news are not the same thing. - Katharine Graham, owner of The Washington Post"
-
-class
- ATTRIBUTE_TYPE_AND_VALUE
-
-create
- make
-
-feature
- make (type_a: OBJECT_IDENTIFIER value_a: SPECIAL [NATURAL_8])
- do
- type := type_a
- value := value_a
- end
-
-feature
- type: OBJECT_IDENTIFIER
- value: SPECIAL [NATURAL_8]
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/certificate.e b/contrib/ise_library/text/encryption/eel/src/x509/certificate.e
deleted file mode 100644
index 19a544a1..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/certificate.e
+++ /dev/null
@@ -1,29 +0,0 @@
-note
- description: "x509v3 Certificate sequence."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Everyone thinks about changing the world, but no one thinks about changing himself. - Leo Tolstoy"
-
-class
- CERTIFICATE
-
-create
- make
-
-feature
- make (tbs_certificate_a: TBS_CERTIFICATE signature_algorithm_a: ALGORITHM_IDENTIFIER signature_value_a: SPECIAL [NATURAL_8])
- do
- tbs_certificate := tbs_certificate_a
- signature_algorithm := signature_algorithm_a
- signature_value := signature_value_a
- end
-
-feature
- tbs_certificate: TBS_CERTIFICATE
- signature_algorithm: ALGORITHM_IDENTIFIER
- signature_value: SPECIAL [NATURAL_8]
-
-invariant
- mismatched_algorithms: signature_algorithm ~ tbs_certificate.signature
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/extension.e b/contrib/ise_library/text/encryption/eel/src/x509/extension.e
deleted file mode 100644
index 27caf192..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/extension.e
+++ /dev/null
@@ -1,26 +0,0 @@
-note
- description: "x509v3 extension sequence"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The Constitution is not an instrument for the government to restrain the people, it is an instrument for the people to restrain the government - lest it come to dominate our lives and interests. - Patrick Henry"
-
-class
- EXTENSION
-
-create
- make
-
-feature
- make (extn_id_a: OBJECT_IDENTIFIER critical_a: BOOLEAN extn_value_a: SPECIAL [NATURAL_8])
- do
- extn_id := extn_id_a
- critical := critical_a
- extn_value := extn_value_a
- end
-
-feature
- extn_id: OBJECT_IDENTIFIER
- critical: BOOLEAN
- extn_value: SPECIAL [NATURAL_8]
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/name.e b/contrib/ise_library/text/encryption/eel/src/x509/name.e
deleted file mode 100644
index c717115c..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/name.e
+++ /dev/null
@@ -1,22 +0,0 @@
-note
- description: "x509v3 Name choice"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "When goods don't cross borders, soldiers will. - Fredric Bastiat, early French economists"
-
-class
- NAME
-
-create
- make
-
-feature
- make (rdn_sequence_a: LIST [ATTRIBUTE_TYPE_AND_VALUE])
- do
- rdn_sequence := rdn_sequence_a
- end
-
-feature
- rdn_sequence: LIST [ATTRIBUTE_TYPE_AND_VALUE]
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/object_identifier.e b/contrib/ise_library/text/encryption/eel/src/x509/object_identifier.e
deleted file mode 100644
index 36b1a546..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/object_identifier.e
+++ /dev/null
@@ -1,108 +0,0 @@
-note
- description: "ASN.1 OIDs"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote:
- "[
- Virtually all reasonable laws are obeyed, not because they are the law, but because reasonable people would do that anyway.
- If you obey a law simply because it is the law, that's a pretty likely sign that it shouldn't be a law. - Unknown
- ]"
-
-class
- OBJECT_IDENTIFIER
-
-inherit
- ANY
- redefine
- is_equal
- end
-
-create
- make_md2,
- make_md5,
- make_id_sha1,
- make_md2_with_rsa_encryption,
- make_md5_with_rsa_encryption,
- make_sha_1_with_rsa_encryption,
- make_id_dsa_with_sha1,
- make_ecdsa_with_sha1,
- make_pkcs_1
-
-feature
- make_md2
- do
- id := "1.2.840.113549.2.2"
- end
-
- make_md5
- do
- id := "1.2.840.113549.2.5"
- end
-
- make_id_sha1
- do
- id := "1.3.14.3.2.26"
- end
-
- make_md2_with_rsa_encryption
- do
- id := "1.2.840.113549.1.1.2"
- end
-
- make_md5_with_rsa_encryption
- do
- id := "1.2.840.113549.1.1.4"
- end
-
- make_sha_1_with_rsa_encryption
- do
- id := "1.2.840.113549.1.1.5"
- end
-
- make_id_dsa_with_sha1
- do
- id := "1.2.840.10040.4.3"
- end
-
- make_ecdsa_with_sha1
- do
- id := "1.2.840.10045.4.1"
- end
-
- make_pkcs_1
- do
- id := "1.2.840.113549.1"
- end
-
- make_sha_224_with_rsa_encryption
- do
- id := "1.2.840.113549.1.14"
- end
-
- make_sha_256_with_rsa_encryption
- do
- id := "1.2.840.113549.1.11"
- end
-
- make_sha_384_with_rsa_encryption
- do
- id := "1.2.840.113549.1.12"
- end
-
- make_sha_512_with_rsa_encryption
- do
- id := "1.2.840.113549.1.13"
- end
-
-feature
- is_equal (other: like Current): BOOLEAN
- do
- result := id ~ other.id
- ensure then
- id ~ other.id
- end
-
-feature
- id: STRING
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/subject_public_key_info.e b/contrib/ise_library/text/encryption/eel/src/x509/subject_public_key_info.e
deleted file mode 100644
index 2050c787..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/subject_public_key_info.e
+++ /dev/null
@@ -1,24 +0,0 @@
-note
- description: "x509v3 SubjectPublicKeyInfo sequence"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "One of the penalties for refusing to participate in politics is that you end up being governed by your inferiors. - Plato"
-
-class
- SUBJECT_PUBLIC_KEY_INFO
-
-create
- make
-
-feature
- make (algorithm_a: STRING subject_public_key_a: STRING)
- do
- algorithm := algorithm_a
- subject_public_key := subject_public_key_a
- end
-
-feature
- algorithm: STRING
- subject_public_key: STRING
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/tbs_certificate.e b/contrib/ise_library/text/encryption/eel/src/x509/tbs_certificate.e
deleted file mode 100644
index 99bf08dc..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/tbs_certificate.e
+++ /dev/null
@@ -1,72 +0,0 @@
-note
- description: "x509v3 TBSCertificate sequence"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Democracy is a pathetic belief in the collective wisdom of individual ignorance. - H.L. Mencken"
-
-class
- TBS_CERTIFICATE
-
-inherit
- DER_ENCODABLE
-
-create
- make
-
-feature
- make ( version_a: INTEGER_32 serial_number_a: INTEGER_X signature_a: ALGORITHM_IDENTIFIER issuer_a: NAME validity_a: VALIDITY
- subject_a: NAME subject_public_key_info_a: SUBJECT_PUBLIC_KEY_INFO issuer_unique_id_a: SPECIAL [NATURAL_8]
- subject_unique_id_a: SPECIAL [NATURAL_8] extensions_a: LIST [EXTENSION])
- require
-
- do
- version := version_a
- serial_number := serial_number_a
- signature := signature_a
- issuer := issuer_a
- validity := validity_a
- subject := subject_a
- subject_public_key_info := subject_public_key_info_a
- issuer_unique_id := issuer_unique_id_a
- subject_unique_id := subject_unique_id_a
- extensions := extensions_a
- end
-
-feature
- der_encode (target: DER_OCTET_SINK)
- do
-
- end
-
-feature
- version: INTEGER_32
- serial_number: INTEGER_X
- signature: ALGORITHM_IDENTIFIER
- issuer: NAME
- validity: VALIDITY
- subject: NAME
- subject_public_key_info: SUBJECT_PUBLIC_KEY_INFO
- issuer_unique_id: SPECIAL [NATURAL_8]
- subject_unique_id: SPECIAL [NATURAL_8]
- extensions: LIST [EXTENSION]
-
-feature
- valid_version (in: INTEGER_32): BOOLEAN
- do
- result := in = 2
- ensure
- result = (in = 2)
- end
-
- valid_serial_number (in: INTEGER_X): BOOLEAN
- do
- result := (in >= in.one) and in.bits <= 20 * 8
- ensure
- result = ((in >= in.one) and in.bits <= 20 * 8)
- end
-
-invariant
- valid_version (version)
- valid_serial_number (serial_number)
-end
diff --git a/contrib/ise_library/text/encryption/eel/src/x509/validity.e b/contrib/ise_library/text/encryption/eel/src/x509/validity.e
deleted file mode 100644
index 1f9a9614..00000000
--- a/contrib/ise_library/text/encryption/eel/src/x509/validity.e
+++ /dev/null
@@ -1,24 +0,0 @@
-note
- description: "x509v3 Validity sequence"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "If we don't believe in freedom of expression for people we despise, we don't believe in it at all. - Noam Chomsky"
-
-class
- VALIDITY
-
-create
- make
-
-feature
- make (not_before_a: TIME; not_after_a: TIME)
- do
- not_before := not_before_a
- not_after := not_after_a
- end
-
-feature
- not_before: TIME
- not_after: TIME
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/aes_test.e b/contrib/ise_library/text/encryption/eel/tests/aes_test.e
deleted file mode 100644
index 16636ff6..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/aes_test.e
+++ /dev/null
@@ -1,250 +0,0 @@
-note
- description: "Objects that ..."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "The best government is the one that charges you the least blackmail for leaving you alone. - Thomas Rudmose-Brown (1996)"
-
-class
- AES_TEST
-
-inherit
- EQA_TEST_SET
-
-feature
- test_vector_256
- local
- key_data: SPECIAL [NATURAL_8]
- key: AES_KEY
- cipher_text: SPECIAL [NATURAL_8]
- plain: SPECIAL [NATURAL_8]
- vector: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create key_data.make_filled (0, 32)
- key_data [0] := 0x00
- key_data [1] := 0x01
- key_data [2] := 0x02
- key_data [3] := 0x03
- key_data [4] := 0x04
- key_data [5] := 0x05
- key_data [6] := 0x06
- key_data [7] := 0x07
- key_data [8] := 0x08
- key_data [9] := 0x09
- key_data [10] := 0x0a
- key_data [11] := 0x0b
- key_data [12] := 0x0c
- key_data [13] := 0x0d
- key_data [14] := 0x0e
- key_data [15] := 0x0f
- key_data [16] := 0x10
- key_data [17] := 0x11
- key_data [18] := 0x12
- key_data [19] := 0x13
- key_data [20] := 0x14
- key_data [21] := 0x15
- key_data [22] := 0x16
- key_data [23] := 0x17
- key_data [24] := 0x18
- key_data [25] := 0x19
- key_data [26] := 0x1a
- key_data [27] := 0x1b
- key_data [28] := 0x1c
- key_data [29] := 0x1d
- key_data [30] := 0x1e
- key_data [31] := 0x1f
- create key.make (key_data)
- create solution.make_filled (0, 16)
- solution [0] := 0x8e
- solution [1] := 0xa2
- solution [2] := 0xb7
- solution [3] := 0xca
- solution [4] := 0x51
- solution [5] := 0x67
- solution [6] := 0x45
- solution [7] := 0xbf
- solution [8] := 0xea
- solution [9] := 0xfc
- solution [10] := 0x49
- solution [11] := 0x90
- solution [12] := 0x4b
- solution [13] := 0x49
- solution [14] := 0x60
- solution [15] := 0x89
- create vector.make_filled (0, 16)
- vector [0] := 0x00
- vector [1] := 0x11
- vector [2] := 0x22
- vector [3] := 0x33
- vector [4] := 0x44
- vector [5] := 0x55
- vector [6] := 0x66
- vector [7] := 0x77
- vector [8] := 0x88
- vector [9] := 0x99
- vector [10] := 0xaa
- vector [11] := 0xbb
- vector [12] := 0xcc
- vector [13] := 0xdd
- vector [14] := 0xee
- vector [15] := 0xff
- create cipher_text.make_filled (0, 16)
- key.encrypt (vector, 0, cipher_text, 0)
- correct := cipher_text.same_items (solution, 0, 0, 16)
- assert ("test vector 256 1", correct)
- create plain.make_filled (0, 16)
- key.decrypt (cipher_text, 0, plain, 0)
- correct := plain.same_items (vector, 0, 0, 16)
- assert ("test vector 256 2", correct)
- end
-
- test_vector_192
- local
- key_data: SPECIAL [NATURAL_8]
- key: AES_KEY
- cipher_text: SPECIAL [NATURAL_8]
- plain: SPECIAL [NATURAL_8]
- vector: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create key_data.make_filled (0, 24)
- key_data [0] := 0x00
- key_data [1] := 0x01
- key_data [2] := 0x02
- key_data [3] := 0x03
- key_data [4] := 0x04
- key_data [5] := 0x05
- key_data [6] := 0x06
- key_data [7] := 0x07
- key_data [8] := 0x08
- key_data [9] := 0x09
- key_data [10] := 0x0a
- key_data [11] := 0x0b
- key_data [12] := 0x0c
- key_data [13] := 0x0d
- key_data [14] := 0x0e
- key_data [15] := 0x0f
- key_data [16] := 0x10
- key_data [17] := 0x11
- key_data [18] := 0x12
- key_data [19] := 0x13
- key_data [20] := 0x14
- key_data [21] := 0x15
- key_data [22] := 0x16
- key_data [23] := 0x17
- create key.make (key_data)
- create solution.make_filled (0, 16)
- solution [0] := 0xdd
- solution [1] := 0xa9
- solution [2] := 0x7c
- solution [3] := 0xa4
- solution [4] := 0x86
- solution [5] := 0x4c
- solution [6] := 0xdf
- solution [7] := 0xe0
- solution [8] := 0x6e
- solution [9] := 0xaf
- solution [10] := 0x70
- solution [11] := 0xa0
- solution [12] := 0xec
- solution [13] := 0x0d
- solution [14] := 0x71
- solution [15] := 0x91
- create vector.make_filled (0, 16)
- vector [0] := 0x00
- vector [1] := 0x11
- vector [2] := 0x22
- vector [3] := 0x33
- vector [4] := 0x44
- vector [5] := 0x55
- vector [6] := 0x66
- vector [7] := 0x77
- vector [8] := 0x88
- vector [9] := 0x99
- vector [10] := 0xaa
- vector [11] := 0xbb
- vector [12] := 0xcc
- vector [13] := 0xdd
- vector [14] := 0xee
- vector [15] := 0xff
- create cipher_text.make_filled (0, 16)
- key.encrypt (vector, 0, cipher_text, 0)
- correct := cipher_text.same_items (solution, 0, 0, 16)
- assert ("test vector 192 1", correct)
- create plain.make_filled (0, 16)
- key.decrypt (cipher_text, 0, plain, 0)
- correct := vector.same_items (plain, 0, 0, 16)
- assert ("test vector 192 2", correct)
- end
-
- test_vector_128
- local
- aes: AES_KEY
- cipher_text: SPECIAL [NATURAL_8]
- plain: SPECIAL [NATURAL_8]
- vector_1: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create solution.make_filled (0, 16)
- solution [0] := 0x39
- solution [1] := 0x25
- solution [2] := 0x84
- solution [3] := 0x1d
- solution [4] := 0x02
- solution [5] := 0xdc
- solution [6] := 0x09
- solution [7] := 0xfb
- solution [8] := 0xdc
- solution [9] := 0x11
- solution [10] := 0x85
- solution [11] := 0x97
- solution [12] := 0x19
- solution [13] := 0x6a
- solution [14] := 0x0b
- solution [15] := 0x32
- create vector_1.make_filled (0, 16)
- vector_1 [0] := 0x32
- vector_1 [1] := 0x43
- vector_1 [2] := 0xf6
- vector_1 [3] := 0xa8
- vector_1 [4] := 0x88
- vector_1 [5] := 0x5a
- vector_1 [6] := 0x30
- vector_1 [7] := 0x8d
- vector_1 [8] := 0x31
- vector_1 [9] := 0x31
- vector_1 [10] := 0x98
- vector_1 [11] := 0xa2
- vector_1 [12] := 0xe0
- vector_1 [13] := 0x37
- vector_1 [14] := 0x07
- vector_1 [15] := 0x34
- create cipher_text.make_filled (0, 16)
- aes.encrypt (vector_1, 0, cipher_text, 0)
- correct := cipher_text.same_items (solution, 0, 0, 16)
- assert ("test vector 128 1", correct)
- create plain.make_filled (0, 16)
- aes.decrypt (cipher_text, 0, plain, 0)
- correct := vector_1.same_items (plain, 0, 0, 16)
- assert ("test vector 128 2", correct)
- end
-
- test_keys
- local
- key1: AES_KEY
- key2: AES_KEY
- key3: AES_KEY
- do
- create key1.make_spec_128
- assert ("test keys 1", key1.spec_128_bit_schedule)
- create key2.make_spec_196
- assert ("test keys 2", key2.spec_196_bit_schedule)
- create key3.make_spec_256
- assert ("test keys 3", key3.spec_256_bit_schedule)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/cbc_test.e b/contrib/ise_library/text/encryption/eel/tests/cbc_test.e
deleted file mode 100644
index d2faab8b..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/cbc_test.e
+++ /dev/null
@@ -1,226 +0,0 @@
-note
- description: "Tests Cipher Block Chaining mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Government is the great fiction, through which everybody endeavors to live at the expense of everybody else. - Frederic Bastiat"
-
-class
- CBC_TEST
-
-inherit
- MODE_TEST_DATA
- undefine
- default_create
- end
- EQA_TEST_SET
- redefine
- on_prepare
- end
-
-feature {NONE}
- on_prepare
- local
- ciphertext: INTEGER_X
- do
- make_data
- create ciphertext.make_from_hex_string ("7649abac8119b246cee98e9b12e9197d")
- create ciphertext_1_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_128, 0, 15)
- create ciphertext.make_from_hex_string ("5086cb9b507219ee95db113a917678b2")
- create ciphertext_2_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_128, 0, 15)
- create ciphertext.make_from_hex_string ("73bed6b8e3c1743b7116e69e22229516")
- create ciphertext_3_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_128, 0, 15)
- create ciphertext.make_from_hex_string ("3ff1caa1681fac09120eca307586e1a7")
- create ciphertext_4_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_128, 0, 15)
-
- create ciphertext.make_from_hex_string ("4f021db243bc633d7178183a9fa071e8")
- create ciphertext_1_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_196, 0, 15)
- create ciphertext.make_from_hex_string ("b4d9ada9ad7dedf4e5e738763f69145a")
- create ciphertext_2_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_196, 0, 15)
- create ciphertext.make_from_hex_string ("571b242012fb7ae07fa9baac3df102e0")
- create ciphertext_3_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_196, 0, 15)
- create ciphertext.make_from_hex_string ("08b0e27988598881d920a9e64f5615cd")
- create ciphertext_4_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_196, 0, 15)
-
- create ciphertext.make_from_hex_string ("f58c4c04d6e5f1ba779eabfb5f7bfbd6")
- create ciphertext_1_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_256, 0, 15)
- create ciphertext.make_from_hex_string ("9cfc4e967edb808d679f777bc6702c7d")
- create ciphertext_2_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_256, 0, 15)
- create ciphertext.make_from_hex_string ("39f23369a9d9bacfa530e26304231461")
- create ciphertext_3_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_256, 0, 15)
- create ciphertext.make_from_hex_string ("b2eb05e2c39be9fcda6c19078c6a9d1b")
- create ciphertext_4_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_256, 0, 15)
- end
-
-feature
- ciphertext_1_128: SPECIAL [NATURAL_8]
- ciphertext_2_128: SPECIAL [NATURAL_8]
- ciphertext_3_128: SPECIAL [NATURAL_8]
- ciphertext_4_128: SPECIAL [NATURAL_8]
-
- ciphertext_1_196: SPECIAL [NATURAL_8]
- ciphertext_2_196: SPECIAL [NATURAL_8]
- ciphertext_3_196: SPECIAL [NATURAL_8]
- ciphertext_4_196: SPECIAL [NATURAL_8]
-
- ciphertext_1_256: SPECIAL [NATURAL_8]
- ciphertext_2_256: SPECIAL [NATURAL_8]
- ciphertext_3_256: SPECIAL [NATURAL_8]
- ciphertext_4_256: SPECIAL [NATURAL_8]
-
- test_encryption_128
- local
- cbc: CBC_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create ciphertext.make_filled (0, 16)
- create cbc.make (aes, iv, 0)
- cbc.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_128, 0, 0, 16)
- assert ("test encryption 128 1", correct)
- cbc.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_128, 0, 0, 16)
- assert ("test encryption 128 2", correct)
- cbc.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_128, 0, 0, 16)
- assert ("test encryption 128 3", correct)
- cbc.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_128, 0, 0, 16)
- assert ("test encryption 128 4", correct)
- end
-
- test_decryption_128
- local
- cbc: CBC_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create plaintext.make_filled (0, 16)
- create cbc.make (aes, iv, 0)
- cbc.decrypt_block (ciphertext_1_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 128 1", correct)
- cbc.decrypt_block (ciphertext_2_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 128 2", correct)
- cbc.decrypt_block (ciphertext_3_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 128 3", correct)
- cbc.decrypt_block (ciphertext_4_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 128 4", correct)
- end
-
- test_encryption_196
- local
- cbc: CBC_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create ciphertext.make_filled (0, 16)
- create cbc.make (aes, iv, 0)
- cbc.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_196, 0, 0, 16)
- assert ("test encryption 196 1", correct)
- cbc.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_196, 0, 0, 16)
- assert ("test encryption 196 2", correct)
- cbc.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_196, 0, 0, 16)
- assert ("test encryption 196 3", correct)
- cbc.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_196, 0, 0, 16)
- assert ("test encryption 196 4", correct)
- end
-
- test_decryption_196
- local
- cbc: CBC_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create plaintext.make_filled (0, 16)
- create cbc.make (aes, iv, 0)
- cbc.decrypt_block (ciphertext_1_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 196 1", correct)
- cbc.decrypt_block (ciphertext_2_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 196 2", correct)
- cbc.decrypt_block (ciphertext_3_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 196 3", correct)
- cbc.decrypt_block (ciphertext_4_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 196 4", correct)
- end
-
- test_encryption_256
- local
- cbc: CBC_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create ciphertext.make_filled (0, 16)
- create cbc.make (aes, iv, 0)
- cbc.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_256, 0, 0, 16)
- assert ("test encryption 256 1", correct)
- cbc.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_256, 0, 0, 16)
- assert ("test encryption 256 2", correct)
- cbc.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_256, 0, 0, 16)
- assert ("test encryption 256 3", correct)
- cbc.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_256, 0, 0, 16)
- assert ("test encryption 256 4", correct)
- end
-
- test_decryption_256
- local
- cbc: CBC_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create plaintext.make_filled (0, 16)
- create cbc.make (aes, iv, 0)
- cbc.decrypt_block (ciphertext_1_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 256 1", correct)
- cbc.decrypt_block (ciphertext_2_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 256 2", correct)
- cbc.decrypt_block (ciphertext_3_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 256 3", correct)
- cbc.decrypt_block (ciphertext_4_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 256 4", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/cfb_test.e b/contrib/ise_library/text/encryption/eel/tests/cfb_test.e
deleted file mode 100644
index 7ec66233..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/cfb_test.e
+++ /dev/null
@@ -1,226 +0,0 @@
-note
- description: "Tests Cipher Feedback mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Liberty is the only thing you cannot have unless you are willing to give it to others. - William Allen White"
-
-class
- CFB_TEST
-
-inherit
- MODE_TEST_DATA
- undefine
- default_create
- end
- EQA_TEST_SET
- redefine
- on_prepare
- end
-
-feature {NONE}
- on_prepare
- local
- ciphertext: INTEGER_X
- do
- make_data
- create ciphertext.make_from_hex_string ("3b3fd92eb72dad20333449f8e83cfb4a")
- create ciphertext_1_128_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_128_128, 0, 15)
- create ciphertext.make_from_hex_string ("c8a64537a0b3a93fcde3cdad9f1ce58b")
- create ciphertext_2_128_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_128_128, 0, 15)
- create ciphertext.make_from_hex_string ("26751f67a3cbb140b1808cf187a4f4df")
- create ciphertext_3_128_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_128_128, 0, 15)
- create ciphertext.make_from_hex_string ("c04b05357c5d1c0eeac4c66f9ff7f2e6")
- create ciphertext_4_128_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_128_128, 0, 15)
-
- create ciphertext.make_from_hex_string ("cdc80d6fddf18cab34c25909c99a4174")
- create ciphertext_1_128_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_128_196, 0, 15)
- create ciphertext.make_from_hex_string ("67ce7f7f81173621961a2b70171d3d7a")
- create ciphertext_2_128_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_128_196, 0, 15)
- create ciphertext.make_from_hex_string ("2e1e8a1dd59b88b1c8e60fed1efac4c9")
- create ciphertext_3_128_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_128_196, 0, 15)
- create ciphertext.make_from_hex_string ("c05f9f9ca9834fa042ae8fba584b09ff")
- create ciphertext_4_128_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_128_196, 0, 15)
-
- create ciphertext.make_from_hex_string ("dc7e84bfda79164b7ecd8486985d3860")
- create ciphertext_1_128_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_128_256, 0, 15)
- create ciphertext.make_from_hex_string ("39ffed143b28b1c832113c6331e5407b")
- create ciphertext_2_128_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_128_256, 0, 15)
- create ciphertext.make_from_hex_string ("df10132415e54b92a13ed0a8267ae2f9")
- create ciphertext_3_128_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_128_256, 0, 15)
- create ciphertext.make_from_hex_string ("75a385741ab9cef82031623d55b1e471")
- create ciphertext_4_128_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_128_256, 0, 15)
- end
-
-feature
- ciphertext_1_128_128: SPECIAL [NATURAL_8]
- ciphertext_2_128_128: SPECIAL [NATURAL_8]
- ciphertext_3_128_128: SPECIAL [NATURAL_8]
- ciphertext_4_128_128: SPECIAL [NATURAL_8]
-
- ciphertext_1_128_196: SPECIAL [NATURAL_8]
- ciphertext_2_128_196: SPECIAL [NATURAL_8]
- ciphertext_3_128_196: SPECIAL [NATURAL_8]
- ciphertext_4_128_196: SPECIAL [NATURAL_8]
-
- ciphertext_1_128_256: SPECIAL [NATURAL_8]
- ciphertext_2_128_256: SPECIAL [NATURAL_8]
- ciphertext_3_128_256: SPECIAL [NATURAL_8]
- ciphertext_4_128_256: SPECIAL [NATURAL_8]
-
- test_encryption_128_128
- local
- cfb: CFB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create ciphertext.make_filled (0, 16)
- create cfb.make (aes, iv, 0, 16)
- cfb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_128_128, 0, 0, 16)
- assert ("test encryption 128 128 1", correct)
- cfb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_128_128, 0, 0, 16)
- assert ("test encryption 128 128 2", correct)
- cfb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_128_128, 0, 0, 16)
- assert ("test encryption 128 128 3", correct)
- cfb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_128_128, 0, 0, 16)
- assert ("test encryption 128 128 4", correct)
- end
-
- test_decryption_128_128
- local
- cfb: CFB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create plaintext.make_filled (0, 16)
- create cfb.make (aes, iv, 0, 16)
- cfb.decrypt_block (ciphertext_1_128_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 128 128 1", correct)
- cfb.decrypt_block (ciphertext_2_128_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 128 128 2", correct)
- cfb.decrypt_block (ciphertext_3_128_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 128 128 3", correct)
- cfb.decrypt_block (ciphertext_4_128_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 128 128 4", correct)
- end
-
- test_encryption_128_196
- local
- cfb: CFB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create ciphertext.make_filled (0, 16)
- create cfb.make (aes, iv, 0, 16)
- cfb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_128_196, 0, 0, 16)
- assert ("test encryption 128 196 1", correct)
- cfb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_128_196, 0, 0, 16)
- assert ("test encryption 128 196 2", correct)
- cfb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_128_196, 0, 0, 16)
- assert ("test encryption 128 196 3", correct)
- cfb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_128_196, 0, 0, 16)
- assert ("test encryption 128 196 4", correct)
- end
-
- test_decryption_128_196
- local
- cfb: CFB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create plaintext.make_filled (0, 16)
- create cfb.make (aes, iv, 0, 16)
- cfb.decrypt_block (ciphertext_1_128_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 128 196 1", correct)
- cfb.decrypt_block (ciphertext_2_128_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 128 196 2", correct)
- cfb.decrypt_block (ciphertext_3_128_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 128 196 3", correct)
- cfb.decrypt_block (ciphertext_4_128_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 128 196 4", correct)
- end
-
- test_encryption_128_256
- local
- cfb: CFB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create ciphertext.make_filled (0, 16)
- create cfb.make (aes, iv, 0, 16)
- cfb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_128_256, 0, 0, 16)
- assert ("test encryption 128 256 1", correct)
- cfb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_128_256, 0, 0, 16)
- assert ("test encryption 128 256 2", correct)
- cfb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_128_256, 0, 0, 16)
- assert ("test encryption 128 256 3", correct)
- cfb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_128_256, 0, 0, 16)
- assert ("test encryption 128 256 4", correct)
- end
-
- test_decryption_128_256
- local
- cfb: CFB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create plaintext.make_filled (0, 16)
- create cfb.make (aes, iv, 0, 16)
- cfb.decrypt_block (ciphertext_1_128_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 128 256 1", correct)
- cfb.decrypt_block (ciphertext_2_128_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 128 256 2", correct)
- cfb.decrypt_block (ciphertext_3_128_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 128 256 3", correct)
- cfb.decrypt_block (ciphertext_4_128_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 128 256 4", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/ctr_test.e b/contrib/ise_library/text/encryption/eel/tests/ctr_test.e
deleted file mode 100644
index 61cf80da..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/ctr_test.e
+++ /dev/null
@@ -1,226 +0,0 @@
-note
- description: "Tests Counter mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "We contend that for a nation to try to tax itself into prosperity is like a man standing in a bucket and trying to lift himself up by the handle. - Winston Churchill (1903)"
-
-class
- CTR_TEST
-
-inherit
- MODE_TEST_DATA
- undefine
- default_create
- end
- EQA_TEST_SET
- redefine
- on_prepare
- end
-
-feature {NONE}
- on_prepare
- local
- ciphertext: INTEGER_X
- do
- make_data
- create ciphertext.make_from_hex_string ("874d6191b620e3261bef6864990db6ce")
- create ciphertext_1_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_128, 0, 15)
- create ciphertext.make_from_hex_string ("9806f66b7970fdff8617187bb9fffdff")
- create ciphertext_2_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_128, 0, 15)
- create ciphertext.make_from_hex_string ("5ae4df3edbd5d35e5b4f09020db03eab")
- create ciphertext_3_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_128, 0, 15)
- create ciphertext.make_from_hex_string ("1e031dda2fbe03d1792170a0f3009cee")
- create ciphertext_4_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_128, 0, 15)
-
- create ciphertext.make_from_hex_string ("1abc932417521ca24f2b0459fe7e6e0b")
- create ciphertext_1_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_196, 0, 15)
- create ciphertext.make_from_hex_string ("090339ec0aa6faefd5ccc2c6f4ce8e94")
- create ciphertext_2_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_196, 0, 15)
- create ciphertext.make_from_hex_string ("1e36b26bd1ebc670d1bd1d665620abf7")
- create ciphertext_3_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_196, 0, 15)
- create ciphertext.make_from_hex_string ("4f78a7f6d29809585a97daec58c6b050")
- create ciphertext_4_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_196, 0, 15)
-
- create ciphertext.make_from_hex_string ("601ec313775789a5b7a7f504bbf3d228")
- create ciphertext_1_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_256, 0, 15)
- create ciphertext.make_from_hex_string ("f443e3ca4d62b59aca84e990cacaf5c5")
- create ciphertext_2_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_256, 0, 15)
- create ciphertext.make_from_hex_string ("2b0930daa23de94ce87017ba2d84988d")
- create ciphertext_3_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_256, 0, 15)
- create ciphertext.make_from_hex_string ("dfc9c58db67aada613c2dd08457941a6")
- create ciphertext_4_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_256, 0, 15)
- end
-
-feature
- ciphertext_1_128: SPECIAL [NATURAL_8]
- ciphertext_2_128: SPECIAL [NATURAL_8]
- ciphertext_3_128: SPECIAL [NATURAL_8]
- ciphertext_4_128: SPECIAL [NATURAL_8]
-
- ciphertext_1_196: SPECIAL [NATURAL_8]
- ciphertext_2_196: SPECIAL [NATURAL_8]
- ciphertext_3_196: SPECIAL [NATURAL_8]
- ciphertext_4_196: SPECIAL [NATURAL_8]
-
- ciphertext_1_256: SPECIAL [NATURAL_8]
- ciphertext_2_256: SPECIAL [NATURAL_8]
- ciphertext_3_256: SPECIAL [NATURAL_8]
- ciphertext_4_256: SPECIAL [NATURAL_8]
-
- test_encryption_128
- local
- ctr: CTR_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create ciphertext.make_filled (0, 16)
- create ctr.make (aes, iv_counter)
- ctr.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_128, 0, 0, 16)
- assert ("test encryption 128 1", correct)
- ctr.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_128, 0, 0, 16)
- assert ("test encryption 128 2", correct)
- ctr.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_128, 0, 0, 16)
- assert ("test encryption 128 3", correct)
- ctr.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_128, 0, 0, 16)
- assert ("test encryption 128 4", correct)
- end
-
- test_decryption_128
- local
- ctr: CTR_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create plaintext.make_filled (0, 16)
- create ctr.make (aes, iv_counter)
- ctr.decrypt_block (ciphertext_1_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 128 1", correct)
- ctr.decrypt_block (ciphertext_2_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 128 2", correct)
- ctr.decrypt_block (ciphertext_3_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 128 3", correct)
- ctr.decrypt_block (ciphertext_4_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 128 4", correct)
- end
-
- test_encryption_196
- local
- ctr: CTR_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create ciphertext.make_filled (0, 16)
- create ctr.make (aes, iv_counter)
- ctr.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_196, 0, 0, 16)
- assert ("test encryption 196 1", correct)
- ctr.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_196, 0, 0, 16)
- assert ("test encryption 196 2", correct)
- ctr.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_196, 0, 0, 16)
- assert ("test encryption 196 3", correct)
- ctr.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_196, 0, 0, 16)
- assert ("test encryption 196 4", correct)
- end
-
- test_decryption_196
- local
- ctr: CTR_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create plaintext.make_filled (0, 16)
- create ctr.make (aes, iv_counter)
- ctr.decrypt_block (ciphertext_1_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 196 1", correct)
- ctr.decrypt_block (ciphertext_2_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 196 2", correct)
- ctr.decrypt_block (ciphertext_3_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 196 3", correct)
- ctr.decrypt_block (ciphertext_4_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 196 4", correct)
- end
-
- test_encryption_256
- local
- ctr: CTR_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create ciphertext.make_filled (0, 16)
- create ctr.make (aes, iv_counter)
- ctr.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_256, 0, 0, 16)
- assert ("test encryption 256 1", correct)
- ctr.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_256, 0, 0, 16)
- assert ("test encryption 256 2", correct)
- ctr.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_256, 0, 0, 16)
- assert ("test encryption 256 3", correct)
- ctr.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_256, 0, 0, 16)
- assert ("test encryption 256 4", correct)
- end
-
- test_decryption_256
- local
- ctr: CTR_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create plaintext.make_filled (0, 16)
- create ctr.make (aes, iv_counter)
- ctr.decrypt_block (ciphertext_1_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 256 1", correct)
- ctr.decrypt_block (ciphertext_2_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 256 2", correct)
- ctr.decrypt_block (ciphertext_3_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 256 3", correct)
- ctr.decrypt_block (ciphertext_4_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 256 4", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/der_test.e b/contrib/ise_library/text/encryption/eel/tests/der_test.e
deleted file mode 100644
index 121a71ba..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/der_test.e
+++ /dev/null
@@ -1,52 +0,0 @@
-note
- description: "Tests DER encoding facilities"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Nothing can destroy a government more quickly than its failure to observe its own laws, or worse, its disregard of the charter of its own existence - U.S. Supreme Court Justice Tom C. Clark - Mapp vs. Ohio"
-
-class
- DER_TEST
-
-inherit
- DER_FACILITIES
- undefine
- default_create
- end
-
- EQA_TEST_SET
-
-feature
--- test_big_int
--- local
--- int: INTEGER_X
--- sink: ARRAY_DER_SINK
--- target: ARRAY [NATURAL_8]
--- answer: ARRAY [NATURAL_8]
--- do
--- create int.make_from_hex_string ("02F40E7E 2221F295 DE297117 B7F3D62F 5C6A97FF CB8CEFF1 CD6BA8CE 4A9A18AD 84FFABBD 8EFA5933 2BE7AD67 56A66E29 4AFD185A 78FF12AA 520E4DE7 39BACA0C 7FFEFF7F 2955727A 02F40E7E 2221F295 DE297117 B7F3D62F 5C6A97FF CB8CEFF1 CD6BA8CE 4A9A18AD 84FFABBD 8EFA5933 2BE7AD67 56A66E29 4AFD185A 78FF12AA 520E4DE7 39BACA0C 7FFEFF7F 2955727A")
--- create target.make (1, 0)
--- create sink.make (target)
--- create answer.make (1, 1 + 1 + 4 + 36 * 4)
--- encode_integer (sink, int)
--- assert ("test big int 1", target.count = answer.count)
--- assert ("test big int 2", target.same_items (answer))
--- end
-
--- test_small_int
--- local
--- int: INTEGER_X
--- sink: ARRAY_DER_SINK
--- target: ARRAY [NATURAL_8]
--- answer: ARRAY [NATURAL_8]
--- do
--- create int.make_from_natural (0x738243)
--- create target.make (1, 0)
--- create sink.make (target)
--- create answer.make (1, 1 + 1 + 3)
--- answer [1] := 0x2 answer [2] := 0x3 answer [3] := 0x73 answer [4] := 0x82 answer [5] := 0x43
--- encode_integer (sink, int)
--- assert ("test small int 1", target.count = answer.count)
--- assert ("test small int 2", target.same_items (answer))
--- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/ec_test.e b/contrib/ise_library/text/encryption/eel/tests/ec_test.e
deleted file mode 100644
index 350e8445..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/ec_test.e
+++ /dev/null
@@ -1,407 +0,0 @@
-note
- description : "Tests basic Elliptical Curve library functionality"
- author : "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Giving money and power to government is like giving whiskey and car keys to teenage boys. - P.J. O'Rourke"
-
-class
- EC_TEST
-
-inherit
- EQA_TEST_SET
-
-feature -- Polynomial math
- test_sec_multiply
- local
- curve: EC_CURVE_FP
- g: EC_POINT_FP
- d: INTEGER_X
- q: EC_POINT_FP
- q_x_solution: INTEGER_X
- q_y_solution: INTEGER_X
- q_solution: EC_POINT_FP
- correct: BOOLEAN
- do
- create curve.make_sec_p160r1
- create g.make_sec_p160r1
- create d.make_from_hex_string ("AA374FFC 3CE144E6 B0733079 72CB6D57 B2A4E982")
- q := g.product_value (d, curve)
- create q_x_solution.make_from_string ("466448783855397898016055842232266600516272889280")
- create q_y_solution.make_from_string ("1110706324081757720403272427311003102474457754220")
- create q_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_FP}.make_p_x (q_x_solution), create {EC_FIELD_ELEMENT_FP}.make_p_x (q_y_solution))
- correct := q ~ q_solution
- assert ("test sec multiply", correct)
- end
-
- test_sec_sign
- local
- h: INTEGER_X
- e: INTEGER_X
- k: INTEGER_X
- g: EC_POINT_FP
- r: EC_POINT_FP
- r_x_solution: INTEGER_X
- r_y_solution: INTEGER_X
- r_solution: EC_POINT_FP
- curve: EC_CURVE_FP
- correct: BOOLEAN
- s: INTEGER_X
- d: INTEGER_X
- s_solution: INTEGER_X
- n: INTEGER_X
- do
- create n.make_from_hex_string ("01 00000000 00000000 0001F4C8 F927AED3 CA752257")
- create d.make_from_hex_string ("AA374FFC 3CE144E6 B0733079 72CB6D57 B2A4E982")
- create h.make_from_hex_string ("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D")
- create curve.make_sec_p160r1
- create g.make_sec_p160r1
- create k.make_from_string ("702232148019446860144825009548118511996283736794")
- r := g.product_value (k, curve)
- create r_x_solution.make_from_string ("1176954224688105769566774212902092897866168635793")
- create r_y_solution.make_from_string ("1130322298812061698910820170565981471918861336822")
- create r_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_FP}.make_p_x (r_x_solution), create {EC_FIELD_ELEMENT_FP}.make_p_x (r_y_solution))
- correct := r_solution ~ r
- assert ("test sec sign 1", correct)
- e := h
- s := (k.inverse_value (n) * (e + d * r.x.x)) \\ n
- create s_solution.make_from_string ("299742580584132926933316745664091704165278518100")
- correct := s ~ s_solution
- assert ("test sec sign 2", correct)
- end
-
- test_set_verify
- local
- h: INTEGER_X
- e: INTEGER_X
- s: INTEGER_X
- r: INTEGER_X
- n: INTEGER_X
- u1: INTEGER_X
- u2: INTEGER_X
- g: EC_POINT_FP
- q: EC_POINT_FP
- q_x: INTEGER_X
- q_y: INTEGER_X
- curve: EC_CURVE_FP
- r_point: EC_POINT_FP
- r_x_solution: INTEGER_X
- r_y_solution: INTEGER_X
- gu: EC_POINT_FP
- gu_x_solution: INTEGER_X
- gu_y_solution: INTEGER_X
- qu: EC_POINT_FP
- qu_x_solution: INTEGER_X
- qu_y_solution: INTEGER_X
- correct: BOOLEAN
- v: INTEGER_X
- u1_solution: INTEGER_X
- u2_solution: INTEGER_X
- do
- create h.make_from_hex_string ("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D")
- create n.make_from_hex_string ("01 00000000 00000000 0001F4C8 F927AED3 CA752257")
- create g.make_sec_p160r1
- create r.make_from_string ("1176954224688105769566774212902092897866168635793")
- create s.make_from_string ("299742580584132926933316745664091704165278518100")
- create curve.make_sec_p160r1
- create q_x.make_from_string ("466448783855397898016055842232266600516272889280")
- create q_y.make_from_string ("1110706324081757720403272427311003102474457754220")
- create q.make_curve_x_y (create {EC_FIELD_ELEMENT_FP}.make_p_x (q_x), create {EC_FIELD_ELEMENT_FP}.make_p_x (q_y))
- create gu_x_solution.make_from_string ("559637225459801172484164154368876326912482639549")
- create gu_y_solution.make_from_string ("1427364757892877133166464896740210315153233662312")
- create qu_x_solution.make_from_string ("1096326382299378890940501642113021093797486469420")
- create qu_y_solution.make_from_string ("1361206527591198621565826173236094337930170472426")
- create r_x_solution.make_from_string ("1176954224688105769566774212902092897866168635793")
- create r_y_solution.make_from_string ("1130322298812061698910820170565981471918861336822")
- create u1_solution.make_from_string ("126492345237556041805390442445971246551226394866")
- create u2_solution.make_from_string ("642136937233451268764953375477669732399252982122")
- e := h
- u1 := e * s.inverse_value (n) \\ n
- correct := u1 ~ u1_solution
- assert ("test set verify 1", correct)
- u2 := r * s.inverse_value (n) \\ n
- correct := u2 ~ u2_solution
- assert ("test set verify 2", correct)
- gu := g.product_value (u1, curve)
- correct := gu.x.x ~ gu_x_solution
- assert ("test set verify 3", correct)
- correct := gu.y.x ~ gu_y_solution
- assert ("test set verify 4", correct)
- qu := q.product_value (u2, curve)
- correct := qu.x.x ~ qu_x_solution
- assert ("test set verify 5", correct)
- correct := qu.y.x ~ qu_y_solution
- assert ("test set verify 6", correct)
- r_point := gu.plus_value (qu, curve)
- correct := r_x_solution ~ r_point.x.x
- assert ("test set verify 7", correct)
- correct := r_y_solution ~ r_point.y.x
- assert ("test set verify 8", correct)
- v := r_point.x.x \\ n
- correct := v ~ r
- assert ("test set verify 9", correct)
- end
-
-feature -- Prime reflexive tests
- test_reflexive_2
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- i: INTEGER
- do
- from
- i := 0
- until
- i > 10
- loop
- create key.make_sec_p112r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test reflexive 2 iteration: " + i.out, correct)
- i := i + 1
- end
- end
-
- test_reflexive
- local
- key1: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create message.make_from_string ("968236873715988614170569073515315707566766479517")
- create key1.make_p521
- signature := key1.private.sign (message)
- correct := key1.public.verify (message, signature)
- assert ("test reflexive", correct)
- end
-
- test_sec_p112r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p112r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p112r1 reflexive", correct)
- end
-
- test_sec_p112r2_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p112r2
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p112r2 reflexive", correct)
- end
-
- test_sec_p128r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p128r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p128r1 reflexive", correct)
- end
-
- test_sec_p128r2_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p128r2
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p128r2 reflexive", correct)
- end
-
- test_sec_p160k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p160k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p160k1 reflexive", correct)
- end
-
- test_sec_p160r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p160r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p160r1 reflexive", correct)
- end
-
- test_sec_p160r2_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p160r2
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p160r2 reflexive", correct)
- end
-
- test_sec_p192k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p192k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p192k1 reflexive", correct)
- end
-
- test_sec_p192r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p192r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p192r1 reflexive", correct)
- end
-
- test_sec_p224k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p224k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p224k1 reflexive", correct)
- end
-
- test_sec_p224r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p224r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p224r1 reflexive", correct)
- end
-
- test_sec_p256k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p256k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p256k1 reflexive", correct)
- end
-
- test_sec_p256r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p256r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p256r1 reflexive", correct)
- end
-
- test_sec_p384r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p384r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p384r1 reflexive", correct)
- end
-
- test_sec_p521r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_p521r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec p521r1 relfexive", correct)
- end
-
- test_agreement
- local
- key1: EC_KEY_PAIR
- key2: EC_KEY_PAIR
- e1_agreement: INTEGER_X
- e2_agreement: INTEGER_X
- correct: BOOLEAN
- do
- create key1.make_p521
- create key2.make_p521
- e1_agreement := key1.private.agreement (key2.public)
- e2_agreement := key2.private.agreement (key1.public)
- correct := e1_agreement ~ e2_agreement
- assert ("test agreement", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/ecb_test.e b/contrib/ise_library/text/encryption/eel/tests/ecb_test.e
deleted file mode 100644
index 2209c947..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/ecb_test.e
+++ /dev/null
@@ -1,227 +0,0 @@
-note
- description: "Tests Electronic Codebook mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Ask not what you can do for your country; ask what your government is doing to you. - Joseph Sobran (1990)"
-
-class
- ECB_TEST
-
-inherit
- MODE_TEST_DATA
- undefine
- default_create
- end
-
- EQA_TEST_SET
- redefine
- on_prepare
- end
-
-feature {NONE}
- on_prepare
- local
- ciphertext: INTEGER_X
- do
- make_data
- create ciphertext.make_from_hex_string ("3ad77bb40d7a3660a89ecaf32466ef97")
- create ciphertext_1_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_128, 0, 15)
- create ciphertext.make_from_hex_string ("f5d3d58503b9699de785895a96fdbaaf")
- create ciphertext_2_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_128, 0, 15)
- create ciphertext.make_from_hex_string ("43b1cd7f598ece23881b00e3ed030688")
- create ciphertext_3_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_128, 0, 15)
- create ciphertext.make_from_hex_string ("7b0c785e27e8ad3f8223207104725dd4")
- create ciphertext_4_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_128, 0, 15)
-
- create ciphertext.make_from_hex_string ("bd334f1d6e45f25ff712a214571fa5cc")
- create ciphertext_1_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_196, 0, 15)
- create ciphertext.make_from_hex_string ("974104846d0ad3ad7734ecb3ecee4eef")
- create ciphertext_2_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_196, 0, 15)
- create ciphertext.make_from_hex_string ("ef7afd2270e2e60adce0ba2face6444e")
- create ciphertext_3_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_196, 0, 15)
- create ciphertext.make_from_hex_string ("9a4b41ba738d6c72fb16691603c18e0e")
- create ciphertext_4_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_196, 0, 15)
-
- create ciphertext.make_from_hex_string ("f3eed1bdb5d2a03c064b5a7e3db181f8")
- create ciphertext_1_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_256, 0, 15)
- create ciphertext.make_from_hex_string ("591ccb10d410ed26dc5ba74a31362870")
- create ciphertext_2_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_256, 0, 15)
- create ciphertext.make_from_hex_string ("b6ed21b99ca6f4f9f153e7b1beafed1d")
- create ciphertext_3_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_256, 0, 15)
- create ciphertext.make_from_hex_string ("23304b7a39f9f3ff067d8d8f9e24ecc7")
- create ciphertext_4_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_256, 0, 15)
- end
-
-feature
- ciphertext_1_128: SPECIAL [NATURAL_8]
- ciphertext_2_128: SPECIAL [NATURAL_8]
- ciphertext_3_128: SPECIAL [NATURAL_8]
- ciphertext_4_128: SPECIAL [NATURAL_8]
-
- ciphertext_1_196: SPECIAL [NATURAL_8]
- ciphertext_2_196: SPECIAL [NATURAL_8]
- ciphertext_3_196: SPECIAL [NATURAL_8]
- ciphertext_4_196: SPECIAL [NATURAL_8]
-
- ciphertext_1_256: SPECIAL [NATURAL_8]
- ciphertext_2_256: SPECIAL [NATURAL_8]
- ciphertext_3_256: SPECIAL [NATURAL_8]
- ciphertext_4_256: SPECIAL [NATURAL_8]
-
- test_encryption_128
- local
- ecb: ECB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create ciphertext.make_filled (0, 16)
- create ecb.make (aes)
- ecb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_128, 0, 0, 16)
- assert ("test encryption 128 1", correct)
- ecb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_128, 0, 0, 16)
- assert ("test encryption 128 2", correct)
- ecb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_128, 0, 0, 16)
- assert ("test encryption 128 3", correct)
- ecb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_128, 0, 0, 16)
- assert ("test encryption 128 4", correct)
- end
-
- test_decryption_128
- local
- ecb: ECB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create plaintext.make_filled (0, 16)
- create ecb.make (aes)
- ecb.decrypt_block (ciphertext_1_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 128 1", correct)
- ecb.decrypt_block (ciphertext_2_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 128 2", correct)
- ecb.decrypt_block (ciphertext_3_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 128 3", correct)
- ecb.decrypt_block (ciphertext_4_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 128 4", correct)
- end
-
- test_encryption_196
- local
- ecb: ECB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create ciphertext.make_filled (0, 16)
- create ecb.make (aes)
- ecb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_196, 0, 0, 16)
- assert ("test encryption 196 1", correct)
- ecb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_196, 0, 0, 16)
- assert ("test encryption 196 2", correct)
- ecb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_196, 0, 0, 16)
- assert ("test encryption 196 3", correct)
- ecb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_196, 0, 0, 16)
- assert ("test encryption 196 4", correct)
- end
-
- test_decryption_196
- local
- ecb: ECB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create plaintext.make_filled (0, 16)
- create ecb.make (aes)
- ecb.decrypt_block (ciphertext_1_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 196 1", correct)
- ecb.decrypt_block (ciphertext_2_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 196 2", correct)
- ecb.decrypt_block (ciphertext_3_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 196 3", correct)
- ecb.decrypt_block (ciphertext_4_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 196 4", correct)
- end
-
- test_encryption_256
- local
- ecb: ECB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create ciphertext.make_filled (0, 16)
- create ecb.make (aes)
- ecb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_256, 0, 0, 16)
- assert ("test encryption 256 1", correct)
- ecb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_256, 0, 0, 16)
- assert ("test encryption 256 2", correct)
- ecb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_256, 0, 0, 16)
- assert ("test encryption 256 3", correct)
- ecb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_256, 0, 0, 16)
- assert ("test encryption 256 4", correct)
- end
-
- test_decryption_256
- local
- ecb: ECB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create plaintext.make_filled (0, 16)
- create ecb.make (aes)
- ecb.decrypt_block (ciphertext_1_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 256 1", correct)
- ecb.decrypt_block (ciphertext_2_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 256 2", correct)
- ecb.decrypt_block (ciphertext_3_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 256 3", correct)
- ecb.decrypt_block (ciphertext_4_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 256 4", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/hmac_sha256_test.e b/contrib/ise_library/text/encryption/eel/tests/hmac_sha256_test.e
deleted file mode 100644
index 7f7d0845..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/hmac_sha256_test.e
+++ /dev/null
@@ -1,110 +0,0 @@
-note
- description: "Summary description for {HMAC_SHA256_TEST}."
- author: ""
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
-
-class
- HMAC_SHA256_TEST
-
-inherit
-
- EQA_TEST_SET
-
-feature
-
- test_empty
- local
- hmac: HMAC_SHA256
- do
- create hmac.make (create {INTEGER_X}.make_from_hex_string ("0"))
- hmac.finish
- hmac.reset
- hmac.finish
- end
-
- test_rfc_4231_1
- local
- hmac: HMAC_SHA256
- expected: INTEGER_X
- do
- create hmac.make (create {INTEGER_X}.make_from_hex_string ("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"))
- hmac.sink_string ("Hi There")
- hmac.finish
- create expected.make_from_hex_string ("b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7")
- assert ("test_rfc_4231_1", hmac.hmac ~ expected)
- end
-
- test_rfc_4231_2
- local
- hmac: HMAC_SHA256
- expected: INTEGER_X
- do
- create hmac.make (create {INTEGER_X}.make_from_hex_string ("4a656665"))
- hmac.sink_string ("what do ya want for nothing?")
- hmac.finish
- create expected.make_from_hex_string ("5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843")
- assert ("test_rfc_4231_2", hmac.hmac ~ expected)
- end
-
- test_rfc_4231_2_ascii
- local
- hmac: HMAC_SHA256
- expected: INTEGER_X
- do
- create hmac.make_ascii_key ("Jefe")
- hmac.sink_string ("what do ya want for nothing?")
- hmac.finish
- create expected.make_from_hex_string ("5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843")
- assert ("test_rfc_4231_2", hmac.hmac ~ expected)
- end
-
- test_rfc_4231_3
- local
- hmac: HMAC_SHA256
- expected: INTEGER_X
- do
- create hmac.make (create {INTEGER_X}.make_from_hex_string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
- hmac.sink_string (create {STRING_8}.make_filled ('%/221/', 50))
- hmac.finish
- create expected.make_from_hex_string ("773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe")
- assert ("test_rfc_4231_3", hmac.hmac ~ expected)
- end
-
- test_rfc_4231_4
- local
- hmac: HMAC_SHA256
- expected: INTEGER_X
- do
- create hmac.make (create {INTEGER_X}.make_from_hex_string ("0102030405060708090a0b0c0d0e0f10111213141516171819"))
- hmac.sink_string (create {STRING_8}.make_filled ('%/205/', 50))
- hmac.finish
- create expected.make_from_hex_string ("82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b")
- assert ("test_rfc_4231_4", hmac.hmac ~ expected)
- end
-
- test_rfc_4231_6
- local
- hmac: HMAC_SHA256
- expected: INTEGER_X
- do
- create hmac.make (create {INTEGER_X}.make_from_hex_string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
- hmac.sink_string ("Test Using Larger Than Block-Size Key - Hash Key First")
- hmac.finish
- create expected.make_from_hex_string ("60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54")
- assert ("test_rfc_4231_6", hmac.hmac ~ expected)
- end
-
- test_rfc_4231_7
- local
- hmac: HMAC_SHA256
- expected: INTEGER_X
- do
- create hmac.make (create {INTEGER_X}.make_from_hex_string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
- hmac.sink_string ("This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.")
- hmac.finish
- create expected.make_from_hex_string ("9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2")
- assert ("test_rfc_4231_7", hmac.hmac ~ expected)
- end
-
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/md5_test.e b/contrib/ise_library/text/encryption/eel/tests/md5_test.e
deleted file mode 100644
index fcc7dbfc..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/md5_test.e
+++ /dev/null
@@ -1,136 +0,0 @@
-note
- description: "Summary description for {MD5_TEST}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Give me liberty or give me death! - Patrick Henry"
-
-class
- MD5_TEST
-
-inherit
- EQA_TEST_SET
-
-feature
- test_million_a
- local
- md5: MD5
- count: INTEGER_32
- do
- create md5.make
- from
- count := 1
- until
- count > 1_000_000
- loop
- md5.sink_character ('a')
- count := count + 1
- end
- end
-
- test_alphabet
- local
- md5: MD5
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create solution.make_filled (0, 16)
- solution [0] := 0xc3
- solution [1] := 0xfc
- solution [2] := 0xd3
- solution [3] := 0xd7
- solution [4] := 0x61
- solution [5] := 0x92
- solution [6] := 0xe4
- solution [7] := 0x00
- solution [8] := 0x7d
- solution [9] := 0xfb
- solution [10] := 0x49
- solution [11] := 0x6c
- solution [12] := 0xca
- solution [13] := 0x67
- solution [14] := 0xe1
- solution [15] := 0x3b
- create output.make_filled (0, 16)
- create md5.make
- md5.sink_string ("abcdefghijklmnopqrstuvwxyz")
- md5.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 16)
- assert ("test alphabet", correct)
- end
-
- test_empty
- local
- md5: MD5
- output: SPECIAL [NATURAL_8]
- do
- create output.make_filled (0, 16)
- create md5.make
- md5.do_final (output, 0)
- end
-
- test_a
- local
- md5: MD5
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create solution.make_filled (0, 16)
- solution [0] := 0x0c
- solution [1] := 0xc1
- solution [2] := 0x75
- solution [3] := 0xb9
- solution [4] := 0xc0
- solution [5] := 0xf1
- solution [6] := 0xb6
- solution [7] := 0xa8
- solution [8] := 0x31
- solution [9] := 0xc3
- solution [10] := 0x99
- solution [11] := 0xe2
- solution [12] := 0x69
- solution [13] := 0x77
- solution [14] := 0x26
- solution [15] := 0x61
- create output.make_filled (0, 16)
- create md5.make
- md5.sink_string ("a")
- md5.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 16)
- assert ("test a", correct)
- end
-
- test_abc
- local
- md5: MD5
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create solution.make_filled (0, 16)
- solution [0] := 0x90
- solution [1] := 0x01
- solution [2] := 0x50
- solution [3] := 0x98
- solution [4] := 0x3c
- solution [5] := 0xd2
- solution [6] := 0x4f
- solution [7] := 0xb0
- solution [8] := 0xd6
- solution [9] := 0x96
- solution [10] := 0x3f
- solution [11] := 0x7d
- solution [12] := 0x28
- solution [13] := 0xe1
- solution [14] := 0x7f
- solution [15] := 0x72
- create output.make_filled (0, 16)
- create md5.make
- md5.sink_string ("abc")
- md5.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 16)
- assert ("test abc", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/ofb_test.e b/contrib/ise_library/text/encryption/eel/tests/ofb_test.e
deleted file mode 100644
index a8861991..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/ofb_test.e
+++ /dev/null
@@ -1,226 +0,0 @@
-note
- description: "Tests Output Feedback mode"
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "Government is actually the worst failure of civilized man. There has never been a really good one, and even those that are most tolerable are arbitrary, cruel, grasping, and unintelligent. - H. L. Mencken"
-
-class
- OFB_TEST
-
-inherit
- MODE_TEST_DATA
- undefine
- default_create
- end
- EQA_TEST_SET
- redefine
- on_prepare
- end
-
-feature {NONE}
- on_prepare
- local
- ciphertext: INTEGER_X
- do
- make_data
- create ciphertext.make_from_hex_string ("3b3fd92eb72dad20333449f8e83cfb4a")
- create ciphertext_1_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_128, 0, 15)
- create ciphertext.make_from_hex_string ("7789508d16918f03f53c52dac54ed825")
- create ciphertext_2_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_128, 0, 15)
- create ciphertext.make_from_hex_string ("9740051e9c5fecf64344f7a82260edcc")
- create ciphertext_3_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_128, 0, 15)
- create ciphertext.make_from_hex_string ("304c6528f659c77866a510d9c1d6ae5e")
- create ciphertext_4_128.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_128, 0, 15)
-
- create ciphertext.make_from_hex_string ("cdc80d6fddf18cab34c25909c99a4174")
- create ciphertext_1_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_196, 0, 15)
- create ciphertext.make_from_hex_string ("fcc28b8d4c63837c09e81700c1100401")
- create ciphertext_2_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_196, 0, 15)
- create ciphertext.make_from_hex_string ("8d9a9aeac0f6596f559c6d4daf59a5f2")
- create ciphertext_3_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_196, 0, 15)
- create ciphertext.make_from_hex_string ("6d9f200857ca6c3e9cac524bd9acc92a")
- create ciphertext_4_196.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_196, 0, 15)
-
- create ciphertext.make_from_hex_string ("dc7e84bfda79164b7ecd8486985d3860")
- create ciphertext_1_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_1_256, 0, 15)
- create ciphertext.make_from_hex_string ("4febdc6740d20b3ac88f6ad82a4fb08d")
- create ciphertext_2_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_2_256, 0, 15)
- create ciphertext.make_from_hex_string ("71ab47a086e86eedf39d1c5bba97c408")
- create ciphertext_3_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_3_256, 0, 15)
- create ciphertext.make_from_hex_string ("0126141d67f37be8538f5a8be740e484")
- create ciphertext_4_256.make_filled (0, 16)
- ciphertext.to_fixed_width_byte_array (ciphertext_4_256, 0, 15)
- end
-
-feature
- ciphertext_1_128: SPECIAL [NATURAL_8]
- ciphertext_2_128: SPECIAL [NATURAL_8]
- ciphertext_3_128: SPECIAL [NATURAL_8]
- ciphertext_4_128: SPECIAL [NATURAL_8]
-
- ciphertext_1_196: SPECIAL [NATURAL_8]
- ciphertext_2_196: SPECIAL [NATURAL_8]
- ciphertext_3_196: SPECIAL [NATURAL_8]
- ciphertext_4_196: SPECIAL [NATURAL_8]
-
- ciphertext_1_256: SPECIAL [NATURAL_8]
- ciphertext_2_256: SPECIAL [NATURAL_8]
- ciphertext_3_256: SPECIAL [NATURAL_8]
- ciphertext_4_256: SPECIAL [NATURAL_8]
-
- test_encryption_128
- local
- ofb: OFB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create ciphertext.make_filled (0, 16)
- create ofb.make (aes, iv, 0)
- ofb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_128, 0, 0, 16)
- assert ("test encryption 128 1", correct)
- ofb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_128, 0, 0, 16)
- assert ("test encryption 128 2", correct)
- ofb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_128, 0, 0, 16)
- assert ("test encryption 128 3", correct)
- ofb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_128, 0, 0, 16)
- assert ("test encryption 128 4", correct)
- end
-
- test_decryption_128
- local
- ofb: OFB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_128
- create plaintext.make_filled (0, 16)
- create ofb.make (aes, iv, 0)
- ofb.decrypt_block (ciphertext_1_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 128 1", correct)
- ofb.decrypt_block (ciphertext_2_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 128 2", correct)
- ofb.decrypt_block (ciphertext_3_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 128 3", correct)
- ofb.decrypt_block (ciphertext_4_128, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 128 4", correct)
- end
-
- test_encryption_196
- local
- ofb: OFB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create ciphertext.make_filled (0, 16)
- create ofb.make (aes, iv, 0)
- ofb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_196, 0, 0, 16)
- assert ("test encryption 196 1", correct)
- ofb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_196, 0, 0, 16)
- assert ("test encryption 196 2", correct)
- ofb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_196, 0, 0, 16)
- assert ("test encryption 196 3", correct)
- ofb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_196, 0, 0, 16)
- assert ("test encryption 196 4", correct)
- end
-
- test_decryption_196
- local
- ofb: OFB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_196
- create plaintext.make_filled (0, 16)
- create ofb.make (aes, iv, 0)
- ofb.decrypt_block (ciphertext_1_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 196 1", correct)
- ofb.decrypt_block (ciphertext_2_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 196 2", correct)
- ofb.decrypt_block (ciphertext_3_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 196 3", correct)
- ofb.decrypt_block (ciphertext_4_196, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 196 4", correct)
- end
-
- test_encryption_256
- local
- ofb: OFB_ENCRYPTION
- aes: AES_KEY
- ciphertext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create ciphertext.make_filled (0, 16)
- create ofb.make (aes, iv, 0)
- ofb.encrypt_block (block_1, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_1_256, 0, 0, 16)
- assert ("test encryption 256 1", correct)
- ofb.encrypt_block (block_2, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_2_256, 0, 0, 16)
- assert ("test encryption 256 2", correct)
- ofb.encrypt_block (block_3, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_3_256, 0, 0, 16)
- assert ("test encryption 256 3", correct)
- ofb.encrypt_block (block_4, 0, ciphertext, 0)
- correct := ciphertext.same_items (ciphertext_4_256, 0, 0, 16)
- assert ("test encryption 256 4", correct)
- end
-
- test_decryption_256
- local
- cbc: OFB_DECRYPTION
- aes: AES_KEY
- plaintext: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create aes.make_spec_256
- create plaintext.make_filled (0, 16)
- create cbc.make (aes, iv, 0)
- cbc.decrypt_block (ciphertext_1_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_1, 0, 0, 16)
- assert ("test decryption 256 1", correct)
- cbc.decrypt_block (ciphertext_2_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_2, 0, 0, 16)
- assert ("test decryption 256 2", correct)
- cbc.decrypt_block (ciphertext_3_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_3, 0, 0, 16)
- assert ("test decryption 256 3", correct)
- cbc.decrypt_block (ciphertext_4_256, 0, plaintext, 0)
- correct := plaintext.same_items (block_4, 0, 0, 16)
- assert ("test decryption 256 4", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/rsa_test.e b/contrib/ise_library/text/encryption/eel/tests/rsa_test.e
deleted file mode 100644
index b3636620..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/rsa_test.e
+++ /dev/null
@@ -1,89 +0,0 @@
-note
- description: "Summary description for {RSA_TEST}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "When buying and selling are controlled by legislation, the first things to be bought and sold are legislators. - P.J. O'Rourke"
-
-class
- RSA_TEST
-
-inherit
- EQA_TEST_SET
-
-feature
- test_small
- local
- private: RSA_PRIVATE_KEY
- public: RSA_PUBLIC_KEY
- message: INTEGER_X
- ciphertext: INTEGER_X
- plaintext: INTEGER_X
- do
- create private.make (61, 53, 3233, 17)
- create public.make (3233, 17)
- assert ("test small 1", private.d.to_integer = 2753)
- create message.make_from_integer (123)
- ciphertext := public.encrypt (message)
- assert ("test small 2", ciphertext.to_integer = 855)
- plaintext := private.decrypt (ciphertext)
- assert ("test small 3", plaintext.to_integer = 123)
- end
-
- test_1024_reflexive
- local
- key_pair: RSA_KEY_PAIR
- message: INTEGER_X
- cipher: INTEGER_X
- plain: INTEGER_X
- signature: INTEGER_X
- correct: BOOLEAN
- do
- create key_pair.make (1024)
- create message.make_random (128)
- cipher := key_pair.public.encrypt (message)
- plain := key_pair.private.decrypt (cipher)
- assert ("test 1024 reflexive 1", plain ~ message)
- signature := key_pair.private.sign (message)
- correct := key_pair.public.verify (message, signature)
- assert ("test 1024 reflexive 2", correct)
- end
-
- test_2048_reflexive
- local
- key_pair: RSA_KEY_PAIR
- message: INTEGER_X
- cipher: INTEGER_X
- plain: INTEGER_X
- signature: INTEGER_X
- correct: BOOLEAN
- do
- create key_pair.make (2048)
- create message.make_random (128)
- cipher := key_pair.public.encrypt (message)
- plain := key_pair.private.decrypt (cipher)
- assert ("test 2048 reflexive 1", plain ~ message)
- signature := key_pair.private.sign (message)
- correct := key_pair.public.verify (message, signature)
- assert ("test 2048 reflexive 2", correct)
- end
-
- test_4096_reflexive
- local
- key_pair: RSA_KEY_PAIR
- message: INTEGER_X
- cipher: INTEGER_X
- plain: INTEGER_X
- signature: INTEGER_X
- correct: BOOLEAN
- do
- create key_pair.make (4096)
- create message.make_random (128)
- cipher := key_pair.public.encrypt (message)
- plain := key_pair.private.decrypt (cipher)
- assert ("test 4096 reflexive 1", plain ~ message)
- signature := key_pair.private.sign (message)
- correct := key_pair.public.verify (message, signature)
- assert ("test 4096 reflexive 2", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/sha1_test.e b/contrib/ise_library/text/encryption/eel/tests/sha1_test.e
deleted file mode 100644
index 08ffd813..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/sha1_test.e
+++ /dev/null
@@ -1,169 +0,0 @@
-note
- description: "Summary description for {SHA1_TEST}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "We must have government, but we must watch them like a hawk. - Millicent Fenwick (1983)"
-
-class
- SHA1_TEST
-
-inherit
- EQA_TEST_SET
-
-feature
- test_long
- local
- sha1: SHA1
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- i: INTEGER
- do
- create sha1.make
- create output.make_filled (0, 20)
- create solution.make_filled (0, 20)
- solution [0] := 0x34
- solution [1] := 0xaa
- solution [2] := 0x97
- solution [3] := 0x3c
- solution [4] := 0xd4
- solution [5] := 0xc4
- solution [6] := 0xda
- solution [7] := 0xa4
- solution [8] := 0xf6
- solution [9] := 0x1e
- solution [10] := 0xeb
- solution [11] := 0x2b
- solution [12] := 0xdb
- solution [13] := 0xad
- solution [14] := 0x27
- solution [15] := 0x31
- solution [16] := 0x65
- solution [17] := 0x34
- solution [18] := 0x01
- solution [19] := 0x6f
- from
- i := 1
- until
- i > 1_000_000
- loop
- sha1.sink_character ('a')
- i := i + 1
- variant
- 1_000_000 - i + 1
- end
- sha1.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 20)
- assert ("test long", correct)
- end
-
- test_multi
- local
- sha1: SHA1
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create sha1.make
- create output.make_filled (0, 20)
- create solution.make_filled (0, 20)
- solution [0] := 0x84
- solution [1] := 0x98
- solution [2] := 0x3e
- solution [3] := 0x44
- solution [4] := 0x1c
- solution [5] := 0x3b
- solution [6] := 0xd2
- solution [7] := 0x6e
- solution [8] := 0xba
- solution [9] := 0xae
- solution [10] := 0x4a
- solution [11] := 0xa1
- solution [12] := 0xf9
- solution [13] := 0x51
- solution [14] := 0x29
- solution [15] := 0xe5
- solution [16] := 0xe5
- solution [17] := 0x46
- solution [18] := 0x70
- solution [19] := 0xf1
- sha1.sink_string ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
- sha1.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 20)
- assert ("test multi", correct)
- end
-
- test_abc
- local
- sha1: SHA1
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create sha1.make
- create output.make_filled (0, 20)
- create solution.make_filled (0, 20)
- solution [0] := 0xa9
- solution [1] := 0x99
- solution [2] := 0x3e
- solution [3] := 0x36
- solution [4] := 0x47
- solution [5] := 0x06
- solution [6] := 0x81
- solution [7] := 0x6a
- solution [8] := 0xba
- solution [9] := 0x3e
- solution [10] := 0x25
- solution [11] := 0x71
- solution [12] := 0x78
- solution [13] := 0x50
- solution [14] := 0xc2
- solution [15] := 0x6c
- solution [16] := 0x9c
- solution [17] := 0xd0
- solution [18] := 0xd8
- solution [19] := 0x9d
- sha1.update (('a').code.to_natural_8)
- sha1.update (('b').code.to_natural_8)
- sha1.update (('c').code.to_natural_8)
- sha1.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 20)
- assert ("test abc", correct)
- end
-
- test_empty
- local
- sha1: SHA1
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create sha1.make
- create output.make_filled (0, 20)
- create solution.make_filled (0, 20)
- solution [0] := 0xda
- solution [1] := 0x39
- solution [2] := 0xa3
- solution [3] := 0xee
- solution [4] := 0x5e
- solution [5] := 0x6b
- solution [6] := 0x4b
- solution [7] := 0x0d
- solution [8] := 0x32
- solution [9] := 0x55
- solution [10] := 0xbf
- solution [11] := 0xef
- solution [12] := 0x95
- solution [13] := 0x60
- solution [14] := 0x18
- solution [15] := 0x90
- solution [16] := 0xaf
- solution [17] := 0xd8
- solution [18] := 0x07
- solution [19] := 0x09
- sha1.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 20)
- assert ("test empty", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/sha256_test.e b/contrib/ise_library/text/encryption/eel/tests/sha256_test.e
deleted file mode 100644
index 708d0c38..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/sha256_test.e
+++ /dev/null
@@ -1,170 +0,0 @@
-note
- description: "Summary description for {SHA256_TEST}."
- author: "Colin LeMahieu"
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
- quote: "A little government and a little luck are necessary in life, but only a fool trusts either of them. - P. J. O'Rourke"
-
-class
- SHA256_TEST
-
-inherit
- EQA_TEST_SET
-
-feature
- test_long
- local
- sha256: SHA256
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- i: INTEGER
- do
- create sha256.make
- create output.make_filled (0, 32)
- create solution.make_filled (0, 32)
- solution [0] := 0xcd
- solution [1] := 0xc7
- solution [2] := 0x6e
- solution [3] := 0x5c
- solution [4] := 0x99
- solution [5] := 0x14
- solution [6] := 0xfb
- solution [7] := 0x92
- solution [8] := 0x81
- solution [9] := 0xa1
- solution [10] := 0xc7
- solution [11] := 0xe2
- solution [12] := 0x84
- solution [13] := 0xd7
- solution [14] := 0x3e
- solution [15] := 0x67
- solution [16] := 0xf1
- solution [17] := 0x80
- solution [18] := 0x9a
- solution [19] := 0x48
- solution [20] := 0xa4
- solution [21] := 0x97
- solution [22] := 0x20
- solution [23] := 0x0e
- solution [24] := 0x04
- solution [25] := 0x6d
- solution [26] := 0x39
- solution [27] := 0xcc
- solution [28] := 0xc7
- solution [29] := 0x11
- solution [30] := 0x2c
- solution [31] := 0xd0
- from
- i := 1
- until
- i > 1_000_000
- loop
- sha256.sink_character ('a')
- i := i + 1
- variant
- 1_000_000 - i + 1
- end
- sha256.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 32)
- assert ("test long", correct)
- end
-
- test_multi
- local
- sha256: SHA256
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create sha256.make
- create output.make_filled (0, 32)
- create solution.make_filled (0, 32)
- solution [0] := 0x24
- solution [1] := 0x8d
- solution [2] := 0x6a
- solution [3] := 0x61
- solution [4] := 0xd2
- solution [5] := 0x06
- solution [6] := 0x38
- solution [7] := 0xb8
- solution [8] := 0xe5
- solution [9] := 0xc0
- solution [10] := 0x26
- solution [11] := 0x93
- solution [12] := 0x0c
- solution [13] := 0x3e
- solution [14] := 0x60
- solution [15] := 0x39
- solution [16] := 0xa3
- solution [17] := 0x3c
- solution [18] := 0xe4
- solution [19] := 0x59
- solution [20] := 0x64
- solution [21] := 0xff
- solution [22] := 0x21
- solution [23] := 0x67
- solution [24] := 0xf6
- solution [25] := 0xec
- solution [26] := 0xed
- solution [27] := 0xd4
- solution [28] := 0x19
- solution [29] := 0xdb
- solution [30] := 0x06
- solution [31] := 0xc1
- sha256.sink_string ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
- sha256.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 32)
- assert ("test multi", correct)
- end
-
- test_abc
- local
- sha256: SHA256
- output: SPECIAL [NATURAL_8]
- solution: SPECIAL [NATURAL_8]
- correct: BOOLEAN
- do
- create sha256.make
- create output.make_filled (0, 32)
- create solution.make_filled (0, 32)
- solution [0] := 0xba
- solution [1] := 0x78
- solution [2] := 0x16
- solution [3] := 0xbf
- solution [4] := 0x8f
- solution [5] := 0x01
- solution [6] := 0xcf
- solution [7] := 0xea
- solution [8] := 0x41
- solution [9] := 0x41
- solution [10] := 0x40
- solution [11] := 0xde
- solution [12] := 0x5d
- solution [13] := 0xae
- solution [14] := 0x22
- solution [15] := 0x23
- solution [16] := 0xb0
- solution [17] := 0x03
- solution [18] := 0x61
- solution [19] := 0xa3
- solution [20] := 0x96
- solution [21] := 0x17
- solution [22] := 0x7a
- solution [23] := 0x9c
- solution [24] := 0xb4
- solution [25] := 0x10
- solution [26] := 0xff
- solution [27] := 0x61
- solution [28] := 0xf2
- solution [29] := 0x00
- solution [30] := 0x15
- solution [31] := 0xad
- sha256.update (('a').code.to_natural_8)
- sha256.update (('b').code.to_natural_8)
- sha256.update (('c').code.to_natural_8)
- sha256.do_final (output, 0)
- correct := solution.same_items (output, 0, 0, 32)
- assert ("test abc", correct)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/test.e b/contrib/ise_library/text/encryption/eel/tests/test.e
deleted file mode 100644
index 650d9115..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/test.e
+++ /dev/null
@@ -1,95 +0,0 @@
-note
- description : "tests application root class"
- date : "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision : "$Revision: 87787 $"
-
-class
- TEST
-
-inherit
- ARGUMENTS
-
-create
- make
-
-feature {NONE} -- Initialization
-
- make
- local
- key_pair: RSA_KEY_PAIR
- message: INTEGER_X
- cipher: INTEGER_X
- plain: INTEGER_X
- signature: INTEGER_X
- correct: BOOLEAN
- do
- io.put_string ("Creating keypair%N")
- create key_pair.make (1024)
- io.put_string ("Created keypair%N")
- create message.make_random (128)
- cipher := key_pair.public.encrypt (message)
- plain := key_pair.private.decrypt (cipher)
- io.put_string ("Checked encryption%N")
- signature := key_pair.private.sign (message)
- correct := key_pair.public.verify (message, signature)
- io.put_string ("Checked signing%N")
- end
-
- make_2
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- i: INTEGER
- do
- create key.make_sec_t113r1
- create message.make_random_max (key.private.params.n)
- from
- i := 0
- until
- i > 100
- loop
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- i := i + 1
- end
- end
-
- test_sec_t_multiply
- local
- d: INTEGER_X
- g: EC_POINT_F2M
- curve: EC_CURVE_F2M
- q: EC_POINT_F2M
- q_x_solution: INTEGER_X
- q_y_solution: INTEGER_X
- q_solution: EC_POINT_F2M
- correct: BOOLEAN
- do
- create d.make_from_hex_string ("00000003 A41434AA 99C2EF40 C8495B2E D9739CB2 155A1E0D")
- create g.make_sec_t163k1
- create curve.make_sec_t163k1
- create q_x_solution.make_from_hex_string ("00000003 7D529FA3 7E42195F 10111127 FFB2BB38 644806BC")
- create q_y_solution.make_from_hex_string ("00000004 47026EEE 8B34157F 3EB51BE5 185D2BE0 249ED776")
- create q_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_F2M}.make (q_x_solution), create {EC_FIELD_ELEMENT_F2M}.make (q_y_solution))
- q := g.product_value (d, curve)
- correct := q ~ q_solution
- end
-
- test1: detachable AES_TEST
- test2: detachable CBC_TEST
- test3: detachable CFB_TEST
- test4: detachable CTR_TEST
- test5: detachable DER_TEST
- test6: detachable ECB_TEST
- test7: detachable EC_TEST
- test8: detachable MD5_TEST
- test9: detachable OFB_TEST
- test10: detachable RSA_TEST
- test11: detachable SHA1_TEST
- test12: detachable SHA256_TEST
- test13: detachable TEST_EC_BINARY
- test14: detachable HMAC_SHA256_TEST
-
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/test_ec_binary.e b/contrib/ise_library/text/encryption/eel/tests/test_ec_binary.e
deleted file mode 100644
index 0644f7e2..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/test_ec_binary.e
+++ /dev/null
@@ -1,493 +0,0 @@
-note
- description: "Summary description for {TEST_EC_BINARY}."
- author: ""
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
-
-class
- TEST_EC_BINARY
-
-inherit
- EQA_TEST_SET
-
-feature -- Binary math
-
- test_sec_t_multiply
- local
- d: INTEGER_X
- g: EC_POINT_F2M
- curve: EC_CURVE_F2M
- q: EC_POINT_F2M
- q_x_solution: INTEGER_X
- q_y_solution: INTEGER_X
- q_solution: EC_POINT_F2M
- correct: BOOLEAN
- do
- create d.make_from_hex_string ("00000003 A41434AA 99C2EF40 C8495B2E D9739CB2 155A1E0D")
- create g.make_sec_t163k1
- create curve.make_sec_t163k1
- create q_x_solution.make_from_hex_string ("00000003 7D529FA3 7E42195F 10111127 FFB2BB38 644806BC")
- create q_y_solution.make_from_hex_string ("00000004 47026EEE 8B34157F 3EB51BE5 185D2BE0 249ED776")
- create q_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_F2M}.make (q_x_solution), create {EC_FIELD_ELEMENT_F2M}.make (q_y_solution))
- q := g.product_value (d, curve)
- correct := q ~ q_solution
- assert ("test sec t multiply", correct)
- end
-
- test_sec_t_sign
- local
- d: INTEGER_X
- k: INTEGER_X
- e: INTEGER_X
- r_x_solution: INTEGER_X
- r_y_solution: INTEGER_X
- r_solution: EC_POINT_F2M
- curve: EC_CURVE_F2M
- r: INTEGER_X
- s: INTEGER_X
- s_solution: INTEGER_X
- r_point: EC_POINT_F2M
- r_int_solution: INTEGER_X
- correct: BOOLEAN
- g: EC_POINT_F2M
- do
- create curve.make_sec_t163k1
- create g.make_sec_t163k1
- create d.make_from_hex_string ("00000003 A41434AA 99C2EF40 C8495B2E D9739CB2 155A1E0D")
- create k.make_from_string ("936523985789236956265265265235675811949404040044")
- create r_x_solution.make_from_hex_string ("00000004 994D2C41 AA30E529 52B0A94E C6511328 C502DA9B")
- create r_y_solution.make_from_hex_string ("00000003 1FC936D7 3163B858 BBC5326D 77C19839 46405264")
- create e.make_from_hex_string ("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D")
- create r_int_solution.make_from_hex_string ("994D2C41 AA30E529 52AEA846 2370471B 2B0A34AC")
- create s_solution.make_from_hex_string ("00000001 52F95CA1 5DA1997A 8C449E00 CD2AA2AC CB988D7F")
- create r_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_F2M}.make (r_x_solution), create {EC_FIELD_ELEMENT_F2M}.make (r_y_solution))
- r_point := g.product_value (k, curve)
- correct := r_point ~ r_solution
- assert ("test set t sign 1", correct)
- r := r_point.x.x \\ curve.n
- correct := r_int_solution ~ r
- assert ("test set t sign 2", correct)
- s := (k.inverse_value (curve.n) * (r * d + e)) \\ curve.n
- correct := s ~ s_solution
- assert ("test set t sign 3", correct)
- end
-
- test_sec_t_verify
- local
- q: EC_POINT_F2M
- d: INTEGER_X
- curve: EC_CURVE_F2M
- e: INTEGER_X
- r: INTEGER_X
- s: INTEGER_X
- u1: INTEGER_X
- u2: INTEGER_X
- u1_solution: INTEGER_X
- u2_solution: INTEGER_X
- correct: BOOLEAN
- u1g: EC_POINT_F2M
- u1g_solution: EC_POINT_F2M
- u1g_x: INTEGER_X
- u1g_y: INTEGER_X
- u2q: EC_POINT_F2M
- u2q_solution: EC_POINT_F2M
- u2q_x: INTEGER_X
- u2q_y: INTEGER_X
- r_x: INTEGER_X
- r_y: INTEGER_X
- r_solution: EC_POINT_F2M
- r_point: EC_POINT_F2M
- g: EC_POINT_F2M
- v: INTEGER_X
- do
- create curve.make_sec_t163k1
- create d.make_from_hex_string ("00000003 A41434AA 99C2EF40 C8495B2E D9739CB2 155A1E0D")
- create r.make_from_hex_string ("994D2C41 AA30E529 52AEA846 2370471B 2B0A34AC")
- create s.make_from_hex_string ("00000001 52F95CA1 5DA1997A 8C449E00 CD2AA2AC CB988D7F")
- create e.make_from_hex_string ("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D")
- create u1_solution.make_from_string ("5658067548292182333034494350975093404971930311298")
- create u2_solution.make_from_string ("2390570840421010673757367220187439778211658217319")
- create u1g_x.make_from_hex_string ("00000005 1B4B9235 90399545 34D77469 AC7434D7 45BE784D")
- create u1g_y.make_from_hex_string ("00000001 C657D070 935987CA 79976B31 6ED2F533 41058956")
- create u2q_x.make_from_hex_string ("07FD04AF 05DCAF73 39F6F89C 52EF27FE 94699AED")
- create u2q_y.make_from_hex_string ("AA84BE48 C0F1256F A31AAADD F4ADDDD5 AD1F0E14")
- create r_x.make_from_hex_string ("00000004 994D2C41 AA30E529 52B0A94E C6511328 C502DA9B")
- create r_y.make_from_hex_string ("00000003 1FC936D7 3163B858 BBC5326D 77C19839 46405264")
- create u1g_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_F2M}.make (u1g_x), create {EC_FIELD_ELEMENT_F2M}.make (u1g_y))
- create u2q_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_F2M}.make (u2q_x), create {EC_FIELD_ELEMENT_F2M}.make (u2q_y))
- create r_solution.make_curve_x_y (create {EC_FIELD_ELEMENT_F2M}.make (r_x), create {EC_FIELD_ELEMENT_F2M}.make (r_y))
- create g.make_sec_t163k1
- q := g.product_value (d, curve)
- u1 := (e * s.inverse_value (curve.n) \\ curve.n)
- u2 := (r * s.inverse_value (curve.n) \\ curve.n)
- correct := u1 ~ u1_solution
- assert ("test sec t verify 1", correct)
- correct := u2 ~ u2_solution
- assert ("test sec t verify 2", correct)
- u1g := g.product_value (u1, curve)
- correct := u1g ~ u1g_solution
- assert ("test sec t verify 3", correct)
- u2q := q.product_value (u2, curve)
- correct := u2q ~ u2q_solution
- assert ("test sec t verify 4", correct)
- r_point := u1g.plus_value (u2q, curve)
- correct := r_point ~ r_solution
- v := r_point.x.x \\ curve.n
- correct := v ~ r
- assert ("test sec t verify 5", correct)
- end
-feature --Polynomial reflexive tests
- test_sec_t113r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t113r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t113r1 reflexive", correct)
- end
-
- test_sec_t113r2_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t113r2
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t113r2 reflexive", correct)
- end
-
- test_sec_t131r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t131r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t131r1 reflexive", correct)
- end
-
- test_sec_t131r2_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t131r2
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t131r2 reflexive", correct)
- end
-
- test_sec_t163k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t163k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t163k1 reflexive", correct)
- end
-
- test_sec_t163r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t163r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t163r1 reflexive", correct)
- end
-
- test_sec_t163r2_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t163r2
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t163r2 reflexive", correct)
- end
-
- test_sec_t193r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t193r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t193r1 reflexive", correct)
- end
-
- test_sec_t193r2_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t193r2
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t193r2 reflexive", correct)
- end
-
- test_sec_t233k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t233k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t233k1 reflexive", correct)
- end
-
- test_sec_t233r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t233r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t233r1 reflexive", correct)
- end
-
- test_sec_t239k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t239k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t239k1 reflexive", correct)
- end
-
- test_sec_t283k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t283k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t283k1 reflexive", correct)
- end
-
- test_sec_t283r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t283r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t283r1 reflexive", correct)
- end
-
- test_sec_t409k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t409k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t409k1 reflexive", correct)
- end
-
- test_sec_t409r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t409r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t409r1 reflexive", correct)
- end
-
- test_sec_t571k1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t571k1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t571k1 reflexive", correct)
- end
-
- test_sec_t571r1_reflexive
- local
- key: EC_KEY_PAIR
- message: INTEGER_X
- signature: TUPLE [r: INTEGER_X s: INTEGER_X]
- correct: BOOLEAN
- do
- create key.make_sec_t571r1
- create message.make_random_max (key.private.params.n)
- signature := key.private.sign (message)
- correct := key.public.verify (message, signature)
- assert ("test sec t571r1 reflexive", correct)
- end
-
- test_reduce_1
- local
- one: INTEGER_X
- a: INTEGER_X
- b: INTEGER_X
- n: INTEGER_X
- curve: EC_CURVE_F2M
- element: EC_FIELD_ELEMENT_F2M
- expected: INTEGER_X
- do
- create expected.make_from_hex_string ("13b6c2e54bb8c935c13fab54639da")
- create one.make_from_hex_string ("54505401551104100555400451414110050100000151441011150550")
- create a.make_from_hex_string ("3088250ca6e7c7fe649ce85820f7")
- create b.make_from_hex_string ("e8bee4d3e2260744188be0e9c723")
- create n.make_from_hex_string ("100000000000000d9ccec8a39e56f")
- create curve.make (0x71, 9, 0, 0, a, b, n)
- create element.make (one)
- element.reduce (one, curve)
- assert ("test reduce 1", one ~ expected)
- end
-
- test_square_1
- local
- one: INTEGER_X
- a: INTEGER_X
- b: INTEGER_X
- n: INTEGER_X
- curve: EC_CURVE_F2M
- element: EC_FIELD_ELEMENT_F2M
- expected: INTEGER_X
- do
- create one.make_from_hex_string ("ece1f5243f82d99431001da4573c")
- create expected.make_from_hex_string ("13b6c2e54bb8c935c13fab54639da")
- create a.make_from_hex_string ("3088250ca6e7c7fe649ce85820f7")
- create b.make_from_hex_string ("e8bee4d3e2260744188be0e9c723")
- create n.make_from_hex_string ("100000000000000d9ccec8a39e56f")
- create curve.make (0x71, 9, 0, 0, a, b, n)
- create element.make (one)
- element.square (curve)
- assert ("test square 1", element.x ~ expected)
- end
-
- test_square_2
- local
- parameters: EC_DOMAIN_PARAMETERS_F2M
- one: INTEGER_X
- element: EC_FIELD_ELEMENT_F2M
- expected: INTEGER_X
- do
- create one.make_from_hex_string ("3 ffffffff ffffffff ffffffff ffffffff")
- create expected.make_from_hex_string ("aaaaaaaaaaaaaaaaaaaaaaaaaaaabfee")
- create parameters.make_sec_t131r1
- create element.make (one)
- element.square (parameters.curve)
- assert ("test square 2", element.x ~ expected)
- end
-
- test_square_3
- local
- parameters: EC_DOMAIN_PARAMETERS_F2M
- one: INTEGER_X
- element: EC_FIELD_ELEMENT_F2M
- expected: INTEGER_X
- do
- create parameters.make_sec_t131r1
- create one.make_from_hex_string ("b11acac3b1c28415a4e733010375a5b8")
- create expected.make_from_hex_string ("18b11dd51ffe1f2aeef0ec79fae0b67f7")
- create element.make (one)
- element.square (parameters.curve)
- assert ("test square 3", element.x ~ expected)
- end
-
- test_product_1
- local
- curve: EC_CURVE_F2M
- one: EC_POINT_F2M
- expected: EC_POINT_F2M
- multiplicand: INTEGER_X
- do
- create one.make_curve_x_y (create {INTEGER_X}.make_from_hex_string ("9d73616f35f4ab1407d73562c10f"), create {INTEGER_X}.make_from_hex_string ("a52830277958ee84d1315ed31886"))
- create expected.make_curve_x_y (create {INTEGER_X}.make_from_hex_string ("1a42d8acf7568670dfd067fde38ff"), create {INTEGER_X}.make_from_hex_string ("11747870124d247a94b527a2fbc2e"))
- create multiplicand.make_from_hex_string ("a077518c809013ae8ec6baecd515")
- create curve.make (0x71, 9, 0, 0, create {INTEGER_X}.make_from_hex_string ("3088250ca6e7c7fe649ce85820f7"), create {INTEGER_X}.make_from_hex_string ("e8bee4d3e2260744188be0e9c723"), create {INTEGER_X}.make_from_hex_string ("100000000000000d9ccec8a39e56f"))
- one.product (multiplicand, curve)
- assert ("test product 1", one ~ expected)
- end
-
- test_product_2
- local
- curve: EC_CURVE_F2M
- one: EC_FIELD_ELEMENT_F2M
- expected: EC_FIELD_ELEMENT_F2M
- multiplicand: INTEGER_X
- do
- create one.make (create {INTEGER_X}.make_from_hex_string ("a52830277958ee84d1315ed31886"))
- create multiplicand.make_from_hex_string ("fa499cd55090de5385193e34792c")
- create expected.make (create {INTEGER_X}.make_from_hex_string ("7192944b0a76728036d728c69633"))
- create curve.make (0x71, 9, 0, 0, create {INTEGER_X}.make_from_hex_string ("3088250ca6e7c7fe649ce85820f7"), create {INTEGER_X}.make_from_hex_string ("e8bee4d3e2260744188be0e9c723"), create {INTEGER_X}.make_from_hex_string ("100000000000000d9ccec8a39e56f"))
- one.product (multiplicand, curve)
- assert ("test product 2", one ~ expected)
- end
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/test_ec_field_element_f2m.e b/contrib/ise_library/text/encryption/eel/tests/test_ec_field_element_f2m.e
deleted file mode 100644
index 0c653532..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/test_ec_field_element_f2m.e
+++ /dev/null
@@ -1,14 +0,0 @@
-note
- description: "Summary description for {TEST_EC_FIELD_ELEMENT_F2M}."
- author: ""
- date: "$Date: 2011-11-11 18:13:16 +0100 (ven., 11 nov. 2011) $"
- revision: "$Revision: 87787 $"
-
-class
- TEST_EC_FIELD_ELEMENT_F2M
-
-inherit
- EQA_TEST_SET
-
-feature
-end
diff --git a/contrib/ise_library/text/encryption/eel/tests/tests-safe.ecf b/contrib/ise_library/text/encryption/eel/tests/tests-safe.ecf
deleted file mode 100644
index 3be4066f..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/tests-safe.ecf
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /.hg$
- /EIFGENs$
- /CVS$
- /.svn$
-
-
-
-
diff --git a/contrib/ise_library/text/encryption/eel/tests/tests.ecf b/contrib/ise_library/text/encryption/eel/tests/tests.ecf
deleted file mode 100644
index 778008b6..00000000
--- a/contrib/ise_library/text/encryption/eel/tests/tests.ecf
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /.svn$
- /EIFGENs$
- /CVS$
- /.hg$
-
-
-
-
diff --git a/contrib/ise_library/text/uri/license.lic b/contrib/ise_library/text/uri/license.lic
new file mode 100644
index 00000000..c929225f
--- /dev/null
+++ b/contrib/ise_library/text/uri/license.lic
@@ -0,0 +1 @@
+reference:forum2
diff --git a/contrib/ise_library/text/uri/src/implementation/percent_encoder.e b/contrib/ise_library/text/uri/src/implementation/percent_encoder.e
new file mode 100644
index 00000000..72b7b894
--- /dev/null
+++ b/contrib/ise_library/text/uri/src/implementation/percent_encoder.e
@@ -0,0 +1,508 @@
+note
+ description: "[
+ Component to handle percent encoding
+ ]"
+ date: "$Date: 2013-01-26 01:40:46 +0100 (sam., 26 janv. 2013) $"
+ revision: "$Revision: 90880 $"
+ EIS: "name=Percent-encoding", "protocol=URI", "src=http://en.wikipedia.org/wiki/Percent-encoding"
+
+class
+ PERCENT_ENCODER
+
+feature -- Percent encoding
+
+ append_percent_encoded_string_to (s: READABLE_STRING_GENERAL; a_result: STRING_GENERAL)
+ -- Append `a_string' as percent-encoded value to `a_result'
+ local
+ c: NATURAL_32
+ i,n: INTEGER
+ do
+ from
+ i := 1
+ n := s.count
+ until
+ i > n
+ loop
+ c := s.code (i)
+ if
+ --| unreserved ALPHA / DIGIT
+ (48 <= c and c <= 57) -- DIGIT: 0 .. 9
+ or (65 <= c and c <= 90) -- ALPHA: A .. Z
+ or (97 <= c and c <= 122) -- ALPHA: a .. z
+ then
+ a_result.append_code (c)
+ else
+ inspect c
+ when
+ 45, 46, 95, 126 -- unreserved characters: -._~
+ then
+ a_result.append_code (c)
+ when
+ 58, 64, -- reserved =+ gen-delims: :@
+ 33, 36, 38, 39, 40, 41, 42, -- reserved =+ sub-delims: !$&'()*
+ 43, 44, 59, 61, -- reserved = sub-delims: +,;=
+ 37 -- percent encoding: %
+ then
+ append_percent_encoded_character_code_to (c, a_result)
+ else
+ append_percent_encoded_character_code_to (c, a_result)
+ end
+ end
+ i := i + 1
+ end
+ end
+
+feature -- Percent encoding: character
+
+ append_percent_encoded_character_code_to (a_code: NATURAL_32; a_result: STRING_GENERAL)
+ -- Append character code `a_code' as percent-encoded content into `a_result'
+ do
+ if a_code > 0xFF then
+ -- Unicode
+ append_percent_encoded_unicode_character_code_to (a_code, a_result)
+ elseif a_code > 0x7F then
+ -- Extended ASCII
+ -- This requires percent-encoding on UTF-8 converted character.
+ append_percent_encoded_unicode_character_code_to (a_code, a_result)
+ else
+ -- ASCII
+ append_percent_encoded_ascii_character_code_to (a_code, a_result)
+ end
+ ensure
+ appended: a_result.count > old a_result.count
+ end
+
+feature {NONE} -- Implementation: character encoding
+
+ append_percent_encoded_ascii_character_code_to (a_code: NATURAL_32; a_result: STRING_GENERAL)
+ -- Append extended ascii character code `a_code' as percent-encoded content into `a_result'
+ -- Note: it does not UTF-8 convert this extended ASCII.
+ require
+ is_extended_ascii: a_code <= 0xFF
+ local
+ c: INTEGER
+ do
+ if a_code > 0xFF then
+ -- Unicode
+ append_percent_encoded_unicode_character_code_to (a_code, a_result)
+ else
+ -- Extended ASCII
+ c := a_code.to_integer_32
+ a_result.append_code (37) -- 37 '%%'
+ a_result.append_code (hex_digit [c |>> 4])
+ a_result.append_code (hex_digit [c & 0xF])
+ end
+ ensure
+ appended: a_result.count > old a_result.count
+ end
+
+ append_percent_encoded_unicode_character_code_to (a_code: NATURAL_32; a_result: STRING_GENERAL)
+ -- Append Unicode character code `a_code' as UTF-8 and percent-encoded content into `a_result'
+ -- Note: it does include UTF-8 conversion of extended ASCII and Unicode.
+ do
+ if a_code <= 0x7F then
+ -- 0xxxxxxx
+ append_percent_encoded_ascii_character_code_to (a_code, a_result)
+ elseif a_code <= 0x7FF then
+ -- 110xxxxx 10xxxxxx
+ append_percent_encoded_ascii_character_code_to ((a_code |>> 6) | 0xC0, a_result)
+ append_percent_encoded_ascii_character_code_to ((a_code & 0x3F) | 0x80, a_result)
+ elseif a_code <= 0xFFFF then
+ -- 1110xxxx 10xxxxxx 10xxxxxx
+ append_percent_encoded_ascii_character_code_to ((a_code |>> 12) | 0xE0, a_result)
+ append_percent_encoded_ascii_character_code_to (((a_code |>> 6) & 0x3F) | 0x80, a_result)
+ append_percent_encoded_ascii_character_code_to ((a_code & 0x3F) | 0x80, a_result)
+ else
+ -- c <= 1FFFFF - there are no higher code points
+ -- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ append_percent_encoded_ascii_character_code_to ((a_code |>> 18) | 0xF0, a_result)
+ append_percent_encoded_ascii_character_code_to (((a_code |>> 12) & 0x3F) | 0x80, a_result)
+ append_percent_encoded_ascii_character_code_to (((a_code |>> 6) & 0x3F) | 0x80, a_result)
+ append_percent_encoded_ascii_character_code_to ((a_code & 0x3F) | 0x80, a_result)
+ end
+ ensure
+ appended: a_result.count > old a_result.count
+ end
+
+feature -- Percent decoding
+
+ append_percent_decoded_string_to (v: READABLE_STRING_GENERAL; a_result: STRING_GENERAL)
+ -- Append to `a_result' a string equivalent to the percent-encoded string `v'
+ --| Note that is `a_result' is a STRING_8, any Unicode character will be kept as UTF-8
+ local
+ i,n: INTEGER
+ c: NATURAL_32
+ pr: CELL [INTEGER]
+ a_result_is_string_32: BOOLEAN
+ do
+ a_result_is_string_32 := attached {STRING_32} a_result
+ from
+ i := 1
+ create pr.put (i)
+ n := v.count
+ until
+ i > n
+ loop
+ c := v.code (i)
+ inspect c
+ when 43 then -- 43 '+'
+ -- Some implementation are replacing spaces with "+" instead of "%20"
+ a_result.append_code (32) -- 32 ' '
+ when 37 then -- 37 '%%'
+ -- An escaped character ?
+ if i = n then -- Error?
+ a_result.append_code (c)
+ else
+ if a_result_is_string_32 then
+ -- Convert UTF-8 to UTF-32
+ pr.replace (i)
+ c := next_percent_decoded_unicode_character_code (v, pr)
+ a_result.append_code (c)
+ i := pr.item
+ else
+ -- Keep UTF-8
+ pr.replace (i)
+ c := next_percent_decoded_character_code (v, pr)
+ a_result.append_code (c)
+ i := pr.item
+ end
+ end
+ else
+ if c <= 0x7F then
+ a_result.append_code (c)
+ else
+ if a_result_is_string_32 then
+ a_result.append_code (c)
+ else
+ append_percent_encoded_character_code_to (c, a_result)
+ end
+ end
+ end
+ i := i + 1
+ end
+ end
+
+feature {NONE} -- Implementation: decoding
+
+ next_percent_decoded_character_code (v: READABLE_STRING_GENERAL; a_position: CELL [INTEGER]): NATURAL_32
+ -- Character decoded from string `v' starting from index `a_position.item'
+ -- note: it also updates `a_position.item' to indicate the new index position.
+ require
+ valid_start: a_position.item <= v.count
+ is_percent_char: v.code (a_position.item) = 37 -- 37 '%%'
+ local
+ c: NATURAL_32
+ i, n: INTEGER
+ not_a_digit: BOOLEAN
+ ascii_pos: NATURAL_32
+ ival: NATURAL_32
+ pos: INTEGER
+ c_is_digit: BOOLEAN
+ do
+ --| pos is index in stream of escape character ('%')
+ pos := a_position.item
+ c := v.code (pos + 1)
+ if c = 85 or c = 117 then -- 117 'u' 85 'U'
+ -- NOTE: this is not a standard, but it can occur, so use this for decoding only
+ -- An escaped Unicode (ucs2) value, from ECMA scripts
+ -- has the form: %u where is the UCS value
+ -- of the character (two byte integer, one to 4 chars
+ -- after escape sequence).
+ -- See: http://en.wikipedia.org/wiki/Percent-encoding#Non-standard_implementations
+ -- UTF-8 result can be 1 to 4 characters.
+ from
+ i := pos + 2
+ n := v.count
+ until
+ (i > n) or not_a_digit
+ loop
+ c := v.code (i)
+ c_is_digit := (48 <= c and c <= 57) -- DIGIT: 0 .. 9
+ if
+ c_is_digit
+ or (97 <= c and c <= 102) -- ALPHA: a..f
+ or (65 <= c and c <= 70) -- ALPHA: A..F
+ then
+ ival := ival * 16
+ if c_is_digit then
+ ival := ival + (c - 48) -- 48 '0'
+ else
+ if c > 70 then -- a..f
+ ival := ival + (c - 97) + 10 -- 97 'a'
+ else -- A..F
+ ival := ival + (c - 65) + 10 -- 65 'A'
+ end
+ end
+ i := i + 1
+ else
+ not_a_digit := True
+ i := i - 1
+ end
+ end
+ a_position.replace (i)
+ Result := ival
+ else
+ -- ASCII char?
+ ascii_pos := hexadecimal_string_to_natural_32 (v.substring (pos + 1, pos + 2))
+ Result := ascii_pos
+ a_position.replace (pos + 2)
+ end
+ end
+
+ next_percent_decoded_unicode_character_code (v: READABLE_STRING_GENERAL; a_position: CELL [INTEGER]): NATURAL_32
+ -- Next decoded character from `v' at position `a_position.item'
+ -- note: it also updates `a_position' to indicate the new index position.
+ require
+ valid_start: a_position.item <= v.count
+ is_percent_char: v.code (a_position.item) = 37 -- 37 '%%'
+ local
+ n, j: INTEGER
+ c: NATURAL_32
+ c1, c2, c3, c4: NATURAL_32
+ pr: CELL [INTEGER]
+ do
+ create pr.put (a_position.item)
+ c1 := next_percent_decoded_character_code (v, pr)
+
+ j := pr.item
+ n := v.count
+
+ Result := c1
+ a_position.replace (j)
+
+ if c1 <= 0x7F then
+ -- 0xxxxxxx
+ Result := c1
+ elseif c1 <= 0xDF then
+ -- 110xxxxx 10xxxxxx
+ if j + 2 <= n then
+ c := v.code (j + 1)
+ if c = 37 then -- 37 '%%'
+ pr.replace (j + 1)
+ c2 := next_percent_decoded_character_code (v, pr)
+ j := pr.item
+ Result := (
+ ((c1 & 0x1F) |<< 6) |
+ ( c2 & 0x3F )
+ )
+ a_position.replace (j)
+ else
+ -- Do not try to decode
+ end
+ end
+ elseif c1 <= 0xEF then
+ -- 1110xxxx 10xxxxxx 10xxxxxx
+ if j + 2 <= n then
+ c := v.code (j + 1)
+ if c = 37 then -- 37 '%%'
+ pr.replace (j + 1)
+ c2 := next_percent_decoded_character_code (v, pr)
+ j := pr.item
+ if j + 2 <= n then
+ c := v.code (j + 1)
+ if c = 37 then -- 37 '%%'
+ pr.replace (j + 1)
+ c3 := next_percent_decoded_character_code (v, pr)
+ j := pr.item
+
+ Result := (
+ ((c1 & 0xF) |<< 12) |
+ ((c2 & 0x3F) |<< 6) |
+ ( c3 & 0x3F )
+ )
+ a_position.replace (j)
+ else
+ -- Do not try to decode
+ end
+ end
+ else
+ -- Do not try to decode
+ end
+ end
+ elseif c1 <= 0xF7 then
+ -- 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+
+ if j + 2 <= n then
+ c := v.code (j + 1)
+ if c = 37 then -- 37 '%%'
+ pr.replace (j + 1)
+ c2 := next_percent_decoded_character_code (v, pr)
+ j := pr.item
+ if j + 2 <= n then
+ c := v.code (j + 1)
+ if c = 37 then -- 37 '%%'
+ pr.replace (j + 1)
+ c3 := next_percent_decoded_character_code (v, pr)
+ j := pr.item
+ if j + 2 <= n then
+ c := v.code (j + 1)
+ if c = 37 then -- 37 '%%'
+ pr.replace (j + 1)
+ c4 := next_percent_decoded_character_code (v, pr)
+ j := pr.item
+
+ a_position.replace (j)
+
+ Result := (
+ ((c1 & 0x7) |<< 18 ) |
+ ((c2 & 0x3F) |<< 12) |
+ ((c3 & 0x3F) |<< 6) |
+ ( c4 & 0x3F )
+ )
+ else
+ -- Do not try to decode
+ end
+ end
+ else
+ -- Do not try to decode
+ end
+ end
+ else
+ -- Do not try to decode
+ end
+ end
+ else
+ Result := c1
+ end
+ end
+
+feature -- RFC and characters
+
+ is_hexa_decimal_character (c: CHARACTER_32): BOOLEAN
+ -- Is hexadecimal character ?
+ do
+ Result := ('a' <= c and c <= 'f') or ('A' <= c and c <= 'F') -- HEXA
+ or ('0' <= c and c <= '9') -- DIGIT
+ end
+
+ is_alpha_or_digit_character (c: CHARACTER_32): BOOLEAN
+ -- Is ALPHA or DIGIT character ?
+ do
+ Result := ('a' <= c and c <= 'z') or ('A' <= c and c <= 'Z') -- ALPHA
+ or ('0' <= c and c <= '9') -- DIGIT
+ end
+
+ is_alpha_character (c: CHARACTER_32): BOOLEAN
+ -- Is ALPHA character ?
+ do
+ Result := ('a' <= c and c <= 'z') or ('A' <= c and c <= 'Z')
+ end
+
+ is_digit_character (c: CHARACTER_32): BOOLEAN
+ -- Is DIGIT character ?
+ do
+ Result := ('0' <= c and c <= '9')
+ end
+
+ is_unreserved_character (c: CHARACTER_32): BOOLEAN
+ -- unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ do
+ if
+ ('a' <= c and c <= 'z') -- ALPHA
+ or ('A' <= c and c <= 'Z') -- ALPHA
+ or ('0' <= c and c <= '9') -- DIGIT
+ then
+ Result := True
+ else
+ inspect c
+ when '-', '_', '.', '~' then -- unreserved
+ Result := True
+ else
+ end
+ end
+ end
+
+ is_reserved_character (c: CHARACTER_32): BOOLEAN
+ -- reserved = gen-delims / sub-delims
+ do
+ Result := is_gen_delims_character (c) or is_sub_delims_character (c)
+ end
+
+ is_gen_delims_character (c: CHARACTER_32): BOOLEAN
+ -- gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+ do
+ inspect c
+ when ':' , '/', '?' , '#' , '[' , ']' , '@' then
+ Result := True
+ else
+ end
+ end
+
+ is_sub_delims_character (c: CHARACTER_32): BOOLEAN
+ -- sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ -- / "*" / "+" / "," / ";" / "="
+ do
+ inspect c
+ when '!' , '$' , '&' , '%'' , '(' , ')' , '*' , '+' , ',' , ';' , '=' then -- sub-delims
+ Result := True
+ else
+ end
+ end
+
+feature {NONE} -- Implementation
+
+ hex_digit: SPECIAL [NATURAL_32]
+ -- Hexadecimal digits.
+ once
+ create Result.make_filled (0, 16)
+ Result [0] := {NATURAL_32} 48 -- 48 '0'
+ Result [1] := {NATURAL_32} 49 -- 49 '1'
+ Result [2] := {NATURAL_32} 50 -- 50 '2'
+ Result [3] := {NATURAL_32} 51 -- 51 '3'
+ Result [4] := {NATURAL_32} 52 -- 52 '4'
+ Result [5] := {NATURAL_32} 53 -- 53 '5'
+ Result [6] := {NATURAL_32} 54 -- 54 '6'
+ Result [7] := {NATURAL_32} 55 -- 55 '7'
+ Result [8] := {NATURAL_32} 56 -- 56 '8'
+ Result [9] := {NATURAL_32} 57 -- 57 '9'
+ Result [10] := {NATURAL_32} 65 -- 65 'A'
+ Result [11] := {NATURAL_32} 66 -- 66 'B'
+ Result [12] := {NATURAL_32} 67 -- 67 'C'
+ Result [13] := {NATURAL_32} 68 -- 68 'D'
+ Result [14] := {NATURAL_32} 69 -- 69 'E'
+ Result [15] := {NATURAL_32} 70 -- 70 'F'
+ end
+
+ is_hexa_decimal (a_string: READABLE_STRING_GENERAL): BOOLEAN
+ -- Is `a_string' a valid hexadecimal sequence?
+ local
+ l_convertor: like ctoi_convertor
+ do
+ l_convertor := ctoi_convertor
+ l_convertor.parse_string_with_type (a_string, {NUMERIC_INFORMATION}.type_natural_32)
+ Result := l_convertor.is_integral_integer
+ end
+
+ hexadecimal_string_to_natural_32 (a_hex_string: READABLE_STRING_GENERAL): NATURAL_32
+ -- Convert hexadecimal value `a_hex_string' to its corresponding NATURAL_32 value.
+ require
+ is_hexa: is_hexa_decimal (a_hex_string)
+ local
+ l_convertor: like ctoi_convertor
+ do
+ l_convertor := ctoi_convertor
+ l_convertor.parse_string_with_type (a_hex_string, {NUMERIC_INFORMATION}.type_no_limitation)
+ Result := l_convertor.parsed_natural_32
+ end
+
+ ctoi_convertor: HEXADECIMAL_STRING_TO_INTEGER_CONVERTER
+ -- Converter used to convert string to integer or natural.
+ once
+ create Result.make
+ Result.set_leading_separators_acceptable (False)
+ Result.set_trailing_separators_acceptable (False)
+ ensure
+ ctoi_convertor_not_void: Result /= Void
+ end
+
+note
+ copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
diff --git a/contrib/ise_library/text/uri/src/iri.e b/contrib/ise_library/text/uri/src/iri.e
new file mode 100644
index 00000000..81fd1a97
--- /dev/null
+++ b/contrib/ise_library/text/uri/src/iri.e
@@ -0,0 +1,352 @@
+note
+ description : "[
+ Object that represents an IRI Scheme
+
+ See http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier
+ See http://tools.ietf.org/html/rfc3987 (IRI)
+
+ ]"
+ author: "$Author: manus $"
+ date: "$Date: 2013-01-26 01:40:46 +0100 (sam., 26 janv. 2013) $"
+ revision: "$Revision: 90880 $"
+ EIS: "name=IRI-RFC3987", "protocol=URI", "src=http://tools.ietf.org/html/rfc3987"
+ EIS: "name=IRI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier"
+
+class
+ IRI
+
+inherit
+ URI
+ rename
+ make_from_string as make_from_uri_string,
+ userinfo as uri_userinfo,
+ path as uri_path, path_segments as uri_path_segments,
+ query as uri_query, query_items as uri_query_items,
+ fragment as uri_fragment,
+ username_password as uri_username_password,
+ username as uri_username, password as uri_password,
+ hier as uri_hier,
+ authority as uri_authority,
+ string as uri_string
+ end
+
+create
+ make_from_string,
+ make_from_uri
+
+feature {NONE} -- Initialization
+
+ make_from_string (a_string: READABLE_STRING_GENERAL)
+ -- Make from Internationalized resource identifier text `a_string'
+ note
+ EIS: "name=IRI-RFC3987", "protocol=URI", "src=http://tools.ietf.org/html/rfc3987"
+ EIS: "name=IRI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier"
+ local
+ l_uri_string: STRING_8
+ do
+ create l_uri_string.make (a_string.count)
+ iri_into_uri (a_string, l_uri_string)
+ make_from_uri_string (l_uri_string)
+ end
+
+ make_from_uri (a_uri: URI)
+ -- Make Current Internationalized resource identifier from `uri' object
+ do
+ make_from_uri_string (a_uri.string)
+ end
+
+feature -- Access
+
+ userinfo: detachable READABLE_STRING_32
+ -- User information.
+ --| username:password
+ --| RFC3986: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
+ do
+ Result := to_internationalized_percent_encoded_string (uri_userinfo)
+ end
+
+ path: READABLE_STRING_32
+ -- Path component containing data, usually organized in hierarchical form.
+ do
+ Result := to_attached_internationalized_percent_encoded_string (uri_path)
+ end
+
+ query: detachable READABLE_STRING_32
+ -- Query string.
+ do
+ Result := to_internationalized_percent_encoded_string (uri_query)
+ end
+
+ fragment: detachable READABLE_STRING_32
+ -- The fragment identifier component of a URI allows indirect
+ -- identification of a secondary resource by reference to a primary
+ -- resource and additional identifying information.
+ do
+ Result := to_internationalized_percent_encoded_string (uri_fragment)
+ end
+
+feature -- Access
+
+ path_segments: LIST [READABLE_STRING_32]
+ -- Segments composing `path'.
+ do
+ Result := path.split ('/')
+ end
+
+ query_items: detachable LIST [TUPLE [name: READABLE_STRING_32; value: detachable READABLE_STRING_32]]
+ -- Query items composing the `query'.
+ local
+ lst: LIST [READABLE_STRING_32]
+ i: INTEGER
+ do
+ if attached query as q then
+ lst := q.split ('&')
+ create {ARRAYED_LIST [like query_items.item]} Result.make (lst.count)
+ across
+ lst as e
+ loop
+ i := e.item.index_of ('=', 1)
+ if i > 0 then
+ Result.force ([e.item.substring (1, i - 1), e.item.substring (i + 1, e.item.count)])
+ else
+ Result.force ([e.item, Void])
+ end
+ end
+ end
+ end
+
+feature -- Query
+
+ hier: READABLE_STRING_32
+ -- Hier part.
+ -- hier-part = "//" authority path-abempty
+ -- / path-absolute
+ -- / path-rootless
+ -- / path-empty
+ local
+ s: STRING_32
+ do
+ create s.make (10)
+ if attached authority as l_authority then
+ s.append_character ('/')
+ s.append_character ('/')
+ s.append (l_authority)
+ end
+ s.append (path)
+ Result := s
+ end
+
+ username_password: detachable TUPLE [username: READABLE_STRING_32; password: detachable READABLE_STRING_32]
+ -- Username and password value extrated from `userinfo'.
+ --| userinfo = username:password
+ local
+ i: INTEGER
+ u,p: detachable READABLE_STRING_32
+ do
+ if attached userinfo as t then
+ i := t.index_of (':', 1)
+ if i > 0 then
+ p := t.substring (i + 1, t.count)
+ u := t.substring (1, i - 1)
+ else
+ u := t
+ p := Void
+ end
+ Result := [u, p]
+ end
+ end
+
+ username: detachable READABLE_STRING_32
+ -- Eventual username.
+ do
+ if attached username_password as up then
+ Result := up.username
+ end
+ end
+
+ password: detachable READABLE_STRING_32
+ -- Eventual password.
+ do
+ if attached username_password as up then
+ Result := up.password
+ end
+ end
+
+ authority: detachable READABLE_STRING_32
+ -- Hierarchical element for naming authority.
+ --| RFC3986: authority = [ userinfo "@" ] host [ ":" port ]
+ local
+ s: STRING_32
+ do
+ if attached host as h then
+ if attached userinfo as u then
+ create s.make_from_string (u)
+ s.append_character ('@')
+ s.append_string_general (h)
+ else
+ create s.make (h.count)
+ s.append_string_general (h)
+ end
+ if port /= 0 then
+ s.append_character (':')
+ s.append_integer (port)
+ end
+ Result := s
+ else
+ check not is_valid or else (userinfo = Void and port = 0) end
+ end
+ end
+
+feature -- Conversion
+
+ string: READABLE_STRING_32
+ -- String representation.
+ -- scheme://username:password@hostname/path?query#fragment
+ local
+ s: STRING_32
+ do
+ if attached scheme as l_scheme and then not l_scheme.is_empty then
+ create s.make (l_scheme.count)
+ s.append_string_general (l_scheme)
+ s.append_character (':')
+ else
+ create s.make_empty
+ end
+ s.append (hier)
+ if attached query as q then
+ s.append_character ('?')
+ s.append (q)
+ end
+ if attached fragment as f then
+ s.append_character ('#')
+ s.append (f)
+ end
+ Result := s
+ end
+
+ to_uri: URI
+ do
+ create Result.make_from_string (uri_string)
+ end
+
+feature {NONE} -- Implementation: Internationalization
+
+ iri_into_uri (a_string: READABLE_STRING_GENERAL; a_result: STRING_8)
+ require
+ is_valid_iri: True
+ local
+ i,n: INTEGER
+ c: NATURAL_32
+ do
+ from
+ i := 1
+ n := a_string.count
+ until
+ i > n
+ loop
+ c := a_string.code (i)
+ if c > 0x7F then
+ -- extended ASCII and/or Unicode
+ append_percent_encoded_character_code_to (c, a_result)
+-- elseif c = 37 then -- '%'
+-- -- Check for %u + code
+-- if i + 1 <= n then
+-- c := a_string.code (i + 1)
+-- if c = 85 or c = 117 then -- 85 'U' 117 'u'
+-- TODO: Convert it to standard percent-encoding without %U...
+-- end
+-- else
+-- a_result.append_code (c)
+-- end
+ else
+ -- keep as it is
+ a_result.append_code (c)
+ end
+ i := i + 1
+ end
+ end
+
+ to_internationalized_percent_encoded_string (s: detachable READABLE_STRING_8): detachable STRING_32
+ -- Convert string `s' to Internationalized Resource Identifier string
+ -- Result is Void if `s' is Void.
+ do
+ if s /= Void then
+ create Result.make (s.count)
+ append_percent_encoded_string_into_internationalized_percent_encoded_string (s, Result)
+ end
+ end
+
+ to_attached_internationalized_percent_encoded_string (s: READABLE_STRING_8): STRING_32
+ -- Convert string `s' to Internationalized Resource Identifier string
+ do
+ create Result.make (s.count)
+ append_percent_encoded_string_into_internationalized_percent_encoded_string (s, Result)
+ end
+
+ append_percent_encoded_string_into_internationalized_percent_encoded_string (v: READABLE_STRING_GENERAL; a_result: STRING_32)
+ -- Append to `a_result' the Internationalized URL-decoded equivalent of the given percent-encoded string `v'
+ -- It simply decode any percent-encoded Unicode character and kept the rest untouched
+ -- "http://example.com/summer/%C3%A9t%C3%A9" will be converted to IRI "http://example.com/summer/été"
+ local
+ i,n: INTEGER
+ c1,
+ c: NATURAL_32
+ pr: CELL [INTEGER]
+ do
+ from
+ i := 1
+ create pr.put (i)
+ n := v.count
+ until
+ i > n
+ loop
+ c := v.code (i)
+ inspect c
+ when 43 then -- 43 '+'
+ -- Some implementation are replacing spaces with "+" instead of "%20"
+ -- Here fix this bad behavior
+ a_result.append_code (37) -- 37 '%'
+ a_result.append_code (50) -- 50 '2'
+ a_result.append_code (48) -- 48 '0'
+ when 37 then -- 37 '%%'
+ -- An escaped character ?
+ if i = n then -- Error?
+ a_result.append_code (c)
+ elseif i + 1 <= n then
+ c1 := v.code (i + 1)
+ if c1 = 85 or c1 = 117 then -- 117 'u' 85 'U'
+ -- %u + UTF-32 code
+ pr.replace (i)
+ c1 := next_percent_decoded_character_code (v, pr)
+ i := pr.item
+ a_result.append_code (c1)
+ else
+ pr.replace (i)
+ c1 := next_percent_decoded_unicode_character_code (v, pr)
+ if c1 > 0x7F then
+ a_result.append_code (c1)
+ i := pr.item
+ else
+ a_result.append_code (c)
+ end
+ end
+ end
+ else
+ a_result.append_code (c)
+ end
+ i := i + 1
+ end
+ end
+
+
+;note
+ copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
diff --git a/contrib/ise_library/text/uri/src/uri.e b/contrib/ise_library/text/uri/src/uri.e
new file mode 100644
index 00000000..b34a5249
--- /dev/null
+++ b/contrib/ise_library/text/uri/src/uri.e
@@ -0,0 +1,971 @@
+note
+ description : "[
+ Object that represent a URI Scheme
+
+ See http://en.wikipedia.org/wiki/URI_scheme
+ See http://en.wikipedia.org/wiki/Uniform_resource_identifier
+ See http://en.wikipedia.org/wiki/Uniform_resource_locator
+ See http://tools.ietf.org/html/rfc3986 (URI)
+
+ Global syntax element:
+ pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ pct-encoded = "%" HEXDIG HEXDIG
+ unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ reserved = gen-delims / sub-delims
+ gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+ sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ / "*" / "+" / "," / ";" / "="
+ ]"
+ date: "$Date: 2013-01-21 10:25:01 +0100 (lun., 21 janv. 2013) $"
+ revision: "$Revision: 90748 $"
+ EIS: "name=URI-RFC3986 Generic syntax", "protocol=URI", "src=http://tools.ietf.org/html/rfc3986"
+ EIS: "name=URI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/URI_scheme"
+ EIS: "name=IRI-RFC3987", "protocol=URI", "src=http://tools.ietf.org/html/rfc3987"
+ EIS: "name=IRI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier"
+ EIS: "name=Percent-encoding", "protocol=URI", "src=http://en.wikipedia.org/wiki/Percent-encoding"
+
+ EIS: "name=url-RFC1738", "protocol=URI", "src=http://tools.ietf.org/html/rfc1738"
+ EIS: "name=mailto-RFC2368", "protocol=URI", "src=http://tools.ietf.org/html/rfc2368"
+ EIS: "name=ipv6-RFC2373", "protocol=URI", "src=http://tools.ietf.org/html/rfc2373"
+ EIS: "name=ipv6-RFC2373 in URL", "protocol=URI", "src=http://tools.ietf.org/html/rfc2732"
+
+class
+ URI
+
+inherit
+ ANY
+
+ PERCENT_ENCODER
+ export
+ {NONE} all
+ end
+
+ DEBUG_OUTPUT
+
+create
+ make_from_string
+
+feature {NONE} -- Initialization
+
+ make_from_string (a_string: READABLE_STRING_8)
+ -- Parse `a_string' as a URI as specified by RFC3986
+ --| Note: for now the result of the parsing does not check the strict validity of each part.
+ --| URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
+ note
+ EIS: "name=Syntax Components", "protocol=URI", "src=http://tools.ietf.org/html/rfc3986#section-3"
+ local
+ p,q: INTEGER
+ s, t: STRING_8
+ do
+ is_valid := True
+ p := a_string.index_of (':', 1)
+ if p > 0 then
+ set_scheme (a_string.substring (1, p - 1))
+ if a_string.count > p + 1 and then a_string[p+1] = '/' and then a_string[p+2] = '/' then
+ --| Starts by scheme://
+ --| waiting for hierarchical part username:password@hostname:port
+ p := p + 2
+ q := a_string.index_of ('@', p + 1)
+ if q > 0 then
+ --| found user:passwd
+ t := a_string.substring (p + 1, q - 1)
+ set_userinfo (t)
+ p := q
+ end
+ q := a_string.index_of ('/', p + 1)
+ if q > 0 then
+ t := a_string.substring (p + 1, q - 1)
+ else
+ q := a_string.count
+ t := a_string.substring (p + 1, q)
+ q := 0 --| end of processing
+ end
+ if not t.is_empty and then t[1] = '[' then
+ p := t.index_of (']', 2)
+ if p > 0 then
+ p := t.index_of (':', p + 1)
+ else
+ is_valid := False
+ end
+ else
+ p := t.index_of (':', 1)
+ end
+ if p > 0 then
+ set_hostname (t.substring (1, p - 1))
+ t.remove_head (p)
+ if t.is_integer then
+ set_port (t.to_integer)
+ else
+ set_port (0)
+ is_valid := False
+ end
+ else
+ set_hostname (t)
+ set_port (0)
+ end
+ else
+ --| Keep eventual '/' as part of the path
+ q := p + 1
+ set_hostname (Void)
+ end
+
+ if q > 0 and q <= a_string.count then
+ --| found query
+ t := a_string.substring (q, a_string.count)
+ q := t.index_of ('?', 1)
+ if q > 0 then
+ s := t.substring (1, q - 1)
+ if is_valid_in_uri_string (s) then
+ set_path (s)
+ else
+ set_path ("")
+ is_valid := False
+ end
+ t.remove_head (q)
+ q := t.index_of ('#', 1)
+ if q > 0 then
+ set_query (t.substring (1, q - 1))
+ t.remove_head (q)
+ set_fragment (t)
+ else
+ set_query (t)
+ end
+ else
+ if is_valid_in_uri_string (t) then
+ set_path (t)
+ else
+ set_path ("")
+ is_valid := False
+ end
+ end
+ else
+ set_path ("")
+ end
+ else
+ set_scheme ("")
+ set_hostname (Void)
+ set_path ("")
+ end
+ if is_valid then
+ check_validity (True)
+ end
+ ensure
+ same_if_valid: is_valid and not is_corrected implies a_string.starts_with (string)
+ end
+
+feature -- Basic operation
+
+ check_validity (a_fixing: BOOLEAN)
+ -- Check validity of URI
+ -- If `a_fixing' is True, attempt to correct input URI.
+ local
+ s: STRING_8
+ do
+ -- check scheme
+ -- TODO: RFC3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+ if not is_valid_scheme (scheme) then
+ is_valid := False
+ end
+
+ -- check userinfo
+ -- TODO: RFC3986: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
+ if not is_valid_userinfo (userinfo) then
+ is_valid := False
+ end
+
+ -- check host
+ -- TODO: RFC3986: host = IP-literal / IPv4address / reg-name
+ if not is_valid_host (host) then
+ is_valid := False
+ end
+
+ -- Check path
+ -- TODO: no space, all character well escaped, ...
+ if path.has (' ') then
+ -- Fix bad URI
+ if a_fixing then
+ create s.make_from_string (path)
+ s.replace_substring_all (" ", "%%20")
+ set_path (s)
+ is_corrected := True
+ end
+ end
+ if not is_valid_path (path) then
+ is_valid := False
+ end
+
+ -- Check query
+ -- TODO: no space, all character well escaped, ...
+ if attached query as q then
+ if q.has (' ') then
+ -- Fix bad URI
+ if a_fixing then
+ create s.make_from_string (q)
+ s.replace_substring_all (" ", "%%20")
+ set_query (s)
+ is_corrected := True
+ else
+ is_valid := False
+ end
+ end
+ end
+ if not is_valid_query (query) then
+ is_valid := True
+ end
+
+ -- Check fragment
+ if not is_valid_fragment (fragment) then
+ is_valid := False
+ end
+ end
+
+feature -- Status
+
+ is_valid: BOOLEAN
+ -- Is Current valid?
+
+ is_corrected: BOOLEAN
+ -- Is Current valid after eventual correction?
+
+ has_authority: BOOLEAN
+ do
+ Result := host /= Void
+ end
+
+ has_query: BOOLEAN
+ do
+ Result := query /= Void
+ end
+
+ has_path: BOOLEAN
+ do
+ Result := not path.is_empty
+ end
+
+ has_fragment: BOOLEAN
+ do
+ Result := fragment /= Void
+ end
+
+feature -- Access
+
+ scheme: IMMUTABLE_STRING_8
+ -- Scheme name.
+ --| scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+
+ userinfo: detachable IMMUTABLE_STRING_8
+ -- User information.
+ --| username:password
+ --| RFC3986: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
+
+ host: detachable IMMUTABLE_STRING_8
+ -- Host name.
+ --| RFC3986: host = IP-literal / IPv4address / reg-name
+
+ port: INTEGER
+ -- Associated port, if `0' this is not defined.
+ -- RFC3986: port = *DIGIT
+
+ path: IMMUTABLE_STRING_8
+ -- Path component containing data, usually organized in hierarchical form.
+
+ query: detachable IMMUTABLE_STRING_8
+ -- Query string.
+
+ fragment: detachable IMMUTABLE_STRING_8
+ -- The fragment identifier component of a URI allows indirect
+ -- identification of a secondary resource by reference to a primary
+ -- resource and additional identifying information.
+
+feature -- Access
+
+ decoded_path: READABLE_STRING_32
+ -- Decoded `path'
+ local
+ s: STRING_32
+ do
+ create s.make (path.count)
+ append_decoded_www_form_urlencoded_string_to (path, s)
+ Result := s
+ end
+
+ path_segments: LIST [READABLE_STRING_8]
+ -- Segments composing `path'.
+ do
+ Result := path.split ('/')
+ end
+
+ decoded_path_segments: LIST [READABLE_STRING_32]
+ -- Decoded Segments composing `path'.
+ local
+ lst: like path_segments
+ do
+ lst := path_segments
+ create {ARRAYED_LIST [READABLE_STRING_32]} Result.make (lst.count)
+ across
+ lst as e
+ loop
+ Result.force (decoded_www_form_urlencoded_string (e.item))
+ end
+ end
+
+ query_items: detachable LIST [TUPLE [name: READABLE_STRING_8; value: detachable READABLE_STRING_8]]
+ -- Query items composing the `query'.
+ local
+ lst: LIST [READABLE_STRING_8]
+ i: INTEGER
+ do
+ if attached query as q then
+ lst := q.split ('&')
+ create {ARRAYED_LIST [like query_items.item]} Result.make (lst.count)
+ across
+ lst as e
+ loop
+ i := e.item.index_of ('=', 1)
+ if i > 0 then
+ Result.force ([e.item.substring (1, i - 1), e.item.substring (i + 1, e.item.count)])
+ else
+ Result.force ([e.item, Void])
+ end
+ end
+ end
+ end
+
+ decoded_query_items: detachable LIST [TUPLE [name: READABLE_STRING_32; value: detachable READABLE_STRING_32]]
+ -- Decoded query items composing the `query'.
+ do
+ if attached query_items as lst then
+ create {ARRAYED_LIST [like decoded_query_items.item]} Result.make (lst.count)
+ across
+ lst as e
+ loop
+ if attached e.item.value as l_val then
+ Result.force ([decoded_www_form_urlencoded_string (e.item.name), decoded_www_form_urlencoded_string (l_val)])
+ else
+ Result.force ([decoded_www_form_urlencoded_string (e.item.name), Void])
+ end
+ end
+ end
+ end
+
+feature -- Query
+
+ hier: READABLE_STRING_8
+ -- Hier part.
+ -- hier-part = "//" authority path-abempty
+ -- / path-absolute
+ -- / path-rootless
+ -- / path-empty
+ local
+ s: STRING_8
+ do
+ create s.make (10)
+ if attached authority as l_authority then
+ s.append_character ('/')
+ s.append_character ('/')
+ s.append (l_authority)
+ end
+ s.append (path)
+ Result := s
+ end
+
+ username_password: detachable TUPLE [username: READABLE_STRING_8; password: detachable READABLE_STRING_8]
+ -- Username and password value extrated from `userinfo'.
+ --| userinfo = username:password
+ local
+ i: INTEGER
+ u,p: detachable READABLE_STRING_8
+ do
+ if attached userinfo as t then
+ i := t.index_of (':', 1)
+ if i > 0 then
+ p := t.substring (i + 1, t.count)
+ u := t.substring (1, i - 1)
+ else
+ u := t
+ p := Void
+ end
+ Result := [u, p]
+ end
+ end
+
+ username: detachable READABLE_STRING_8
+ -- Eventual username.
+ do
+ if attached username_password as up then
+ Result := up.username
+ end
+ end
+
+ password: detachable READABLE_STRING_8
+ -- Eventual password.
+ do
+ if attached username_password as up then
+ Result := up.password
+ end
+ end
+
+ authority: detachable READABLE_STRING_8
+ -- Hierarchical element for naming authority.
+ --| RFC3986: authority = [ userinfo "@" ] host [ ":" port ]
+ local
+ s: STRING_8
+ do
+ if attached host as h then
+ if attached userinfo as u then
+ create s.make_from_string (u)
+ s.append_character ('@')
+ s.append (h)
+ else
+ create s.make_from_string (h)
+ end
+ if port /= 0 then
+ s.append_character (':')
+ s.append_integer (port)
+ end
+ Result := s
+ else
+ check not is_valid or else (userinfo = Void and port = 0) end
+ end
+ end
+
+feature -- Conversion
+
+ string: READABLE_STRING_8
+ -- String representation.
+ -- scheme://username:password@hostname/path?query#fragment
+ local
+ s: STRING_8
+ do
+ if attached scheme as l_scheme and then not l_scheme.is_empty then
+ create s.make_from_string (l_scheme)
+ s.append_character (':')
+ else
+ create s.make_empty
+ end
+ s.append (hier)
+ if attached query as q then
+ s.append_character ('?')
+ s.append (q)
+ end
+ if attached fragment as f then
+ s.append_character ('#')
+ s.append (f)
+ end
+ Result := s
+ end
+
+ resolved_uri: URI
+ -- Resolved URI, i.e remove segment-component from `path'
+ local
+ p: STRING_8
+ lst: like path_segments
+ l_first: BOOLEAN
+ do
+ from
+ lst := path_segments
+ lst.start
+ until
+ lst.off
+ loop
+ if lst.item.same_string (".") then
+ lst.remove
+ elseif lst.item.same_string ("..") then
+ lst.back
+ if not lst.before then
+ lst.remove
+ lst.remove
+ else
+ lst.forth
+ lst.remove
+ end
+ else
+ lst.forth
+ end
+ end
+ create p.make (path.count)
+ l_first := True
+ across
+ lst as c
+ loop
+ if l_first then
+ l_first := False
+ else
+ p.append_character ('/')
+ end
+ p.append (c.item)
+ end
+ if p.is_empty then
+ else
+ if p.item (1) /= '/' then
+ if not path.is_empty and then path.item (1) = '/' then
+ p.prepend_character ('/')
+ end
+ end
+ end
+ create Result.make_from_string (string)
+ Result.set_path (p)
+ end
+
+feature -- Comparison
+
+ is_same_uri (a_uri: URI): BOOLEAN
+ -- Is `a_uri' same as Current ?
+ --| See http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_unreserved_characters
+ do
+ Result := decoded_www_form_urlencoded_string (string).same_string (decoded_www_form_urlencoded_string (a_uri.string))
+ end
+
+feature -- Element Change
+
+ set_scheme (v: READABLE_STRING_8)
+ -- Set `scheme' to `v'
+ require
+ is_valid_scheme (v)
+ do
+ create scheme.make_from_string (v)
+ ensure
+ scheme_set: scheme.same_string (v)
+ end
+
+ set_userinfo (v: detachable READABLE_STRING_8)
+ require
+ is_valid_userinfo (v)
+ do
+ if v = Void then
+ userinfo := Void
+ else
+ create userinfo.make_from_string (v.as_string_8)
+ end
+ ensure
+ userinfo_set: is_same_string (v, userinfo)
+ end
+
+ set_hostname (v: detachable READABLE_STRING_8)
+ -- Set `host' to `v'
+ require
+ is_valid_host (v)
+ do
+ if v = Void then
+ host := Void
+ else
+ create host.make_from_string (v)
+ end
+ ensure
+ hostname_set: is_same_string (v, host)
+ end
+
+ set_port (v: like port)
+ -- Set `port' to `v'
+ do
+ port := v
+ ensure
+ port_set: port = v
+ end
+
+ set_path (a_path: READABLE_STRING_8)
+ -- Set `path' to `a_path'
+ require
+ is_valid_path (a_path)
+ do
+ create path.make_from_string (a_path)
+ ensure
+ path_set: path.same_string_general (a_path)
+ end
+
+ set_query (v: detachable READABLE_STRING_8)
+ -- Set `query' to `v'
+ require
+ is_valid_query (v)
+ do
+ if v = Void then
+ query := Void
+ else
+ create query.make_from_string (v)
+ end
+ ensure
+ query_set: is_same_string (v, query)
+ end
+
+ set_fragment (v: detachable READABLE_STRING_8)
+ -- Set `fragment' to `v'
+ require
+ is_valid_fragment (v)
+ do
+ if v = Void then
+ fragment := Void
+ else
+ create fragment.make_from_string (v)
+ end
+ ensure
+ fragment_set: is_same_string (v, fragment)
+ end
+
+feature -- Change: query
+
+ remove_query
+ -- Remove query from Current URI
+ do
+ query := Void
+ end
+
+ add_query_parameter (a_name: READABLE_STRING_GENERAL; a_value: detachable READABLE_STRING_GENERAL)
+ -- Add non percent-encoded parameters
+ local
+ q: detachable STRING
+ do
+ if attached query as l_query then
+ create q.make_from_string (l_query)
+ else
+ create q.make_empty
+ end
+ if not q.is_empty then
+ q.append_character ('&')
+ end
+
+ q.append (www_form_urlencoded_string (a_name))
+ if a_value /= Void then
+ q.append_character ('=')
+ q.append (www_form_urlencoded_string (a_value))
+ end
+ create query.make_from_string (q)
+ end
+
+ add_query_parameters (lst: ITERABLE [TUPLE [name: READABLE_STRING_GENERAL; value: detachable READABLE_STRING_GENERAL]])
+ -- Add non percent-encoded parameters from manifest
+ do
+ across
+ lst as c
+ loop
+ add_query_parameter (c.item.name, c.item.value)
+ end
+ end
+
+ add_query_parameters_from_table (tb: TABLE_ITERABLE [detachable READABLE_STRING_GENERAL, READABLE_STRING_GENERAL])
+ -- Add non percent-encoded parameters from table
+ do
+ across
+ tb as c
+ loop
+ add_query_parameter (c.key, c.item)
+ end
+ end
+
+feature -- Status report
+
+ is_valid_scheme (s: READABLE_STRING_GENERAL): BOOLEAN
+ -- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+ local
+ i,n: INTEGER
+ c: CHARACTER_32
+ do
+ if s.is_empty then
+ Result := False -- Check for URI-reference ..
+ else
+ from
+ i := 1
+ n := s.count
+ Result := is_alpha_character (string_item (s, i))
+ i := 2
+ until
+ not Result or i > n
+ loop
+ c := string_item (s, i)
+ Result := is_alpha_or_digit_character (c) or c = '+' or c = '-' or c = '.'
+ i := i + 1
+ end
+ end
+ end
+
+ is_valid_userinfo (s: detachable READABLE_STRING_GENERAL): BOOLEAN
+ -- userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
+ local
+ i,n: INTEGER
+ c: CHARACTER_32
+ do
+ Result := True
+ if s /= Void then
+ from
+ i := 1
+ n := s.count
+ until
+ not Result or i > n
+ loop
+ c := string_item (s, i)
+ -- unreserved
+ if is_unreserved_character (c)
+ or is_sub_delims_character (c)
+ or c = ':'
+ then
+ -- True
+ elseif c = '%%' then
+ if
+ i + 2 <= n and then
+ is_hexa_decimal_character (string_item (s, i+ 1)) and is_hexa_decimal_character (string_item (s, i + 2))
+ then
+ -- True
+ i := i + 2
+ else
+ Result := False
+ end
+ else
+ Result := False
+ end
+ i := i + 1
+ end
+ end
+ end
+
+ is_valid_host (s: detachable READABLE_STRING_GENERAL): BOOLEAN
+ -- host = IP-literal / IPv4address / reg-name
+ -- IP-literal = "[" ( IPv6address / IPvFuture ) "]"
+ -- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
+ -- IPv6address = 6( h16 ":" ) ls32
+ -- / "::" 5( h16 ":" ) ls32
+ -- / [ h16 ] "::" 4( h16 ":" ) ls32
+ -- / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
+ -- / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
+ -- / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
+ -- / [ *4( h16 ":" ) h16 ] "::" ls32
+ -- / [ *5( h16 ":" ) h16 ] "::" h16
+ -- / [ *6( h16 ":" ) h16 ] "::"
+ --
+ -- ls32 = ( h16 ":" h16 ) / IPv4address
+ -- ; least-significant 32 bits of address
+ --
+ -- h16 = 1*4HEXDIG
+ -- ; 16 bits of address represented in hexadecimal
+ --
+ -- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
+ --
+ -- dec-octet = DIGIT ; 0-9
+ -- / %x31-39 DIGIT ; 10-99
+ -- / "1" 2DIGIT ; 100-199
+ -- / "2" %x30-34 DIGIT ; 200-249
+ -- / "25" %x30-35 ; 250-255
+ --
+ -- reg-name = *( unreserved / pct-encoded / sub-delims )
+ do
+ Result := True
+ if s /= Void and then not s.is_empty then
+ if string_item (s, 1) = '[' and string_item (s, s.count) = ']' then
+ Result := True -- IPV6 : to complete
+ else
+ Result := is_hexa_decimal_character (string_item (s, 1)) -- IPV4 or reg-name : to complete
+ end
+ end
+ end
+
+ is_valid_path (s: READABLE_STRING_GENERAL): BOOLEAN
+ -- path = path-abempty ; begins with "/" or is empty
+ -- / path-absolute ; begins with "/" but not "//"
+ -- / path-noscheme ; begins with a non-colon segment
+ -- / path-rootless ; begins with a segment
+ -- / path-empty ; zero characters
+ --
+ -- path-abempty = *( "/" segment )
+ -- path-absolute = "/" [ segment-nz *( "/" segment ) ]
+ -- path-noscheme = segment-nz-nc *( "/" segment )
+ -- path-rootless = segment-nz *( "/" segment )
+ -- path-empty = 0
+ -- segment = *pchar
+ -- segment-nz = 1*pchar
+ -- segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
+ -- ; non-zero-length segment without any colon ":"
+ --
+ -- pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ do
+ if s.is_empty or string_item (s, 1) = '/' then
+ Result := is_valid_in_uri_string (s)
+ elseif has_authority then
+ if string_item (s, 1) = '/' and (s.count > 1 implies string_item (s, 2) /= '/') then
+ Result := is_valid_in_uri_string (s)
+ end
+ elseif s.is_empty then
+ Result := True
+ else
+ Result := is_valid_in_uri_string (s)
+ end
+ -- TO COMPLETE
+ end
+
+ is_valid_query (s: detachable READABLE_STRING_GENERAL): BOOLEAN
+ -- query = *( pchar / "/" / "?" )
+ local
+ i,n: INTEGER
+ c: CHARACTER_32
+ do
+ Result := True
+ if s /= Void then
+ from
+ i := 1
+ n := s.count
+ until
+ not Result or i > n
+ loop
+ c := string_item (s, i)
+ -- pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ if -- pchar
+ is_unreserved_character (c)
+ or is_sub_delims_character (c)
+ or c = ':' or c = '@'
+ then
+ Result := True
+ elseif c = '/' or c = '?' then
+ Result := True
+ elseif c = '%%' then
+ if
+ i + 2 <= n and then
+ is_hexa_decimal_character (string_item (s, i + 1)) and is_hexa_decimal_character (string_item (s, i + 2))
+ then
+ -- True
+ i := i + 2
+ else
+ Result := False
+ end
+ else
+ Result := False
+ end
+ i := i + 1
+ end
+ end
+ end
+
+ is_valid_fragment (s: detachable READABLE_STRING_GENERAL): BOOLEAN
+ --fragment = *( pchar / "/" / "?" )
+ local
+ i,n: INTEGER
+ c: CHARACTER_32
+ do
+ Result := True
+ if s /= Void then
+ from
+ i := 1
+ n := s.count
+ until
+ not Result or i > n
+ loop
+ c := string_item (s, i)
+ -- pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ if -- pchar
+ is_unreserved_character (c)
+ or is_sub_delims_character (c)
+ or c = ':' or c = '@'
+ then
+ Result := True
+ elseif c = '/' or c = '?' then
+ Result := True
+ elseif c = '%%' then
+ if
+ i + 2 <= n and then
+ is_alpha_or_digit_character (string_item (s, i + 1)) and is_alpha_or_digit_character (string_item (s, i + 2))
+ then
+ i := i + 2
+ else
+ Result := False
+ end
+ else
+ Result := False
+ end
+ i := i + 1
+ end
+ end
+ end
+
+feature -- Helper
+
+ string_item (s: READABLE_STRING_GENERAL; i: INTEGER): CHARACTER_32
+ do
+ Result := s.code (i).to_character_32
+ end
+
+ append_www_form_urlencoded_string_to (a_string: READABLE_STRING_GENERAL; a_target: STRING_GENERAL)
+ -- The application/x-www-form-urlencoded encoded string for `a_string'.
+ -- character encoding is UTF-8.
+ -- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
+ do
+ append_percent_encoded_string_to (a_string, a_target)
+ end
+
+ www_form_urlencoded_string (a_string: READABLE_STRING_GENERAL): STRING_8
+ -- The application/x-www-form-urlencoded encoded string for `a_string'.
+ -- character encoding is UTF-8.
+ -- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
+ do
+ create Result.make (a_string.count)
+ append_percent_encoded_string_to (a_string, Result)
+ end
+
+ append_decoded_www_form_urlencoded_string_to (a_string: READABLE_STRING_GENERAL; a_target: STRING_GENERAL)
+ -- The string decoded from application/x-www-form-urlencoded encoded string `a_string'.
+ -- character encoding is UTF-8.
+ -- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
+ do
+ append_percent_decoded_string_to (a_string, a_target)
+ end
+
+ decoded_www_form_urlencoded_string (a_string: READABLE_STRING_GENERAL): STRING_32
+ -- The string decoded from application/x-www-form-urlencoded encoded string `a_string'.
+ -- character encoding is UTF-8.
+ -- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
+ do
+ create Result.make (a_string.count)
+ append_percent_decoded_string_to (a_string, Result)
+ end
+
+feature -- Assertion helper
+
+ is_valid_in_uri_string (s: READABLE_STRING_GENERAL): BOOLEAN
+ -- Is `s' composed only of ASCII character?
+ local
+ i,n: INTEGER
+ do
+ from
+ Result := True
+ i := 1
+ n := s.count
+ until
+ not Result or i > n
+ loop
+ if s.code (i) > 0x7F then
+ Result := False
+ end
+ i := i + 1
+ end
+ end
+
+ is_same_string (s1, s2: detachable READABLE_STRING_GENERAL): BOOLEAN
+ -- `s1' and `s2' have same string content?
+ do
+ if s1 = Void then
+ Result := s2 = Void
+ elseif s2 = Void then
+ Result := False
+ else
+ Result := s1.same_string (s2)
+ end
+ end
+
+feature -- Status report
+
+ debug_output: STRING
+ -- String that should be displayed in debugger to represent `Current'.
+ local
+ s: STRING
+ do
+ create s.make_empty
+ s.append (string)
+ Result := s
+ end
+
+;note
+ copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
diff --git a/contrib/ise_library/text/uri/uri-safe.ecf b/contrib/ise_library/text/uri/uri-safe.ecf
new file mode 100644
index 00000000..7ae5299d
--- /dev/null
+++ b/contrib/ise_library/text/uri/uri-safe.ecf
@@ -0,0 +1,17 @@
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
+
diff --git a/draft/library/security/openid/openid.ecf b/contrib/ise_library/text/uri/uri.ecf
similarity index 72%
rename from draft/library/security/openid/openid.ecf
rename to contrib/ise_library/text/uri/uri.ecf
index 7bbb5803..c92ba12d 100644
--- a/draft/library/security/openid/openid.ecf
+++ b/contrib/ise_library/text/uri/uri.ecf
@@ -1,6 +1,6 @@
-
-
+
+
/.git$
@@ -10,6 +10,8 @@
-
+
+
+
diff --git a/draft/application/cms/cms-safe.ecf b/draft/application/cms/cms-safe.ecf
index 596289b0..03be6e2f 100644
--- a/draft/application/cms/cms-safe.ecf
+++ b/draft/application/cms/cms-safe.ecf
@@ -1,7 +1,7 @@
-
+
-
+
/EIFGENs$
/CVS$
@@ -10,9 +10,8 @@
-
-
+
@@ -24,7 +23,6 @@
-
-
+
diff --git a/draft/application/cms/cms.ecf b/draft/application/cms/cms.ecf
new file mode 100644
index 00000000..43bdba7d
--- /dev/null
+++ b/draft/application/cms/cms.ecf
@@ -0,0 +1,30 @@
+
+
+
+
+
+ /EIFGENs$
+ /CVS$
+ /.svn$
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/draft/application/cms/cms.ini b/draft/application/cms/cms.ini
deleted file mode 100644
index f1803e45..00000000
--- a/draft/application/cms/cms.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-site.name=EWF Web CMS
-#site.base_url=/demo
-site.email=your@email.com
diff --git a/draft/application/cms/example/cms.ini b/draft/application/cms/example/cms.ini
new file mode 100644
index 00000000..7de4d96e
--- /dev/null
+++ b/draft/application/cms/example/cms.ini
@@ -0,0 +1,8 @@
+site.name=EWF Web CMS
+#site.base_url=/demo
+site.email=your@email.com
+root-dir=../www
+var-dir=var
+files-dir=files
+themes-dir=${root-dir}/themes
+#theme=test
diff --git a/draft/application/cms/example/cms_demo-safe.ecf b/draft/application/cms/example/cms_demo-safe.ecf
new file mode 100644
index 00000000..cac6d8f4
--- /dev/null
+++ b/draft/application/cms/example/cms_demo-safe.ecf
@@ -0,0 +1,22 @@
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/draft/application/cms/ewf.ini b/draft/application/cms/example/ewf.ini
similarity index 100%
rename from draft/application/cms/ewf.ini
rename to draft/application/cms/example/ewf.ini
diff --git a/draft/application/cms/example/src/module/demo/demo_module.e b/draft/application/cms/example/src/module/demo/demo_module.e
new file mode 100644
index 00000000..5edae43e
--- /dev/null
+++ b/draft/application/cms/example/src/module/demo/demo_module.e
@@ -0,0 +1,79 @@
+note
+ description: "Summary description for {CMS_MODULE}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ DEMO_MODULE
+
+inherit
+ CMS_MODULE
+
+ CMS_HOOK_MENU_ALTER
+
+ CMS_HOOK_AUTO_REGISTER
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make
+ do
+ name := "demo"
+ version := "1.0"
+ description := "demo"
+ package := "misc"
+ end
+
+feature {CMS_SERVICE} -- Registration
+
+ service: detachable CMS_SERVICE
+
+ register (a_service: CMS_SERVICE)
+ do
+ service := a_service
+ a_service.map_uri_template ("/demo/widget{/args}", agent handle_widget_demo (a_service, ?, ?))
+ a_service.map_uri_template ("/demo/date/{arg}", agent handle_date_time_demo (a_service, ?, ?))
+ a_service.map_uri_template ("/demo/format/{arg}", agent handle_format_demo (a_service, ?, ?))
+ end
+
+ menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
+ local
+ lnk: CMS_LOCAL_LINK
+-- opts: CMS_API_OPTIONS
+ do
+ create lnk.make ("Demo::widget", "/demo/widget/")
+ a_menu_system.management_menu.extend (lnk)
+ end
+
+feature -- Hooks
+
+ links: HASH_TABLE [CMS_MODULE_LINK, STRING]
+ -- Link indexed by path
+ local
+ lnk: CMS_MODULE_LINK
+ do
+ create Result.make (0)
+ create lnk.make ("Date/time demo")
+-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
+-- Result["/demo/date/{arg}"] := lnk
+ end
+
+ handle_date_time_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
+ do
+ (create {ANY_CMS_EXECUTION}.make_with_text (req, res, cms, "Demo::date/time
")).execute
+ end
+
+ handle_format_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
+ do
+ (create {ANY_CMS_EXECUTION}.make_with_text (req, res, cms, "Demo::format
")).execute
+ end
+
+ handle_widget_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
+ do
+ (create {DEMO_WIDGET_CMS_EXECUTION}.make (req, res, cms)).execute
+ end
+
+end
diff --git a/draft/application/cms/example/src/module/demo/demo_widget_cms_execution.e b/draft/application/cms/example/src/module/demo/demo_widget_cms_execution.e
new file mode 100644
index 00000000..d808bfe2
--- /dev/null
+++ b/draft/application/cms/example/src/module/demo/demo_widget_cms_execution.e
@@ -0,0 +1,97 @@
+note
+ description : "Objects that ..."
+ author : "$Author$"
+ date : "$Date$"
+ revision : "$Revision$"
+
+class
+ DEMO_WIDGET_CMS_EXECUTION
+
+inherit
+ CMS_EXECUTION
+
+create
+ make
+
+feature -- Execution
+
+ process
+ local
+ args: like arguments
+ l_table: like new_table
+ s: STRING
+ do
+ args := arguments
+ if args.is_empty then
+ set_title ("Widgets")
+ set_main_content ("...")
+ else
+
+ end
+ l_table := new_table
+
+ create s.make_empty
+ l_table.append_to_html (theme, s)
+ set_main_content (s)
+ end
+
+ new_table: CMS_WIDGET_TABLE [READABLE_STRING_8]
+ local
+ l_table: CMS_WIDGET_TABLE [READABLE_STRING_8]
+ do
+ create l_table.make
+ l_table.add_css_style ("width: 85%%; border: solid 1px #999; padding: 2px;")
+
+ l_table.set_column_count (3)
+ l_table.column (1).set_title ("First")
+ l_table.column (2).set_title ("Second")
+ l_table.column (3).set_title ("Third")
+
+ l_table.column (1).add_css_style ("width: 20%%")
+ l_table.column (2).add_css_style ("width: 40px")
+ l_table.column (3).add_css_style ("width: 40px")
+
+ l_table.set_data (<<"foo", "bar", "foobar">>)
+ l_table.set_foot_data (<<"abc", "def">>)
+ l_table.set_compute_item_function (agent (d: READABLE_STRING_8): CMS_WIDGET_TABLE_ROW
+ local
+ i: INTEGER
+ w: CMS_WIDGET_TABLE_ITEM
+ do
+ create Result.make (d.count)
+ if d.is_case_insensitive_equal ("bar") then
+ Result.add_css_style ("background-color: #ccf;")
+ end
+ across
+ d as c
+ loop
+ i := i + 1
+ create w.make_with_text (c.item.out)
+ if i = 1 then
+ w.add_css_style ("background-color: #333; color: white; font-weight: bold;")
+ elseif i > 3 then
+ w.add_css_style ("color: red; border: solid 1px red; padding: 3px;")
+ end
+ Result.force (w)
+ end
+ end)
+
+ Result := l_table
+ end
+
+ arguments: ARRAY [READABLE_STRING_32]
+ -- Path parameters arguments related to {/vars}
+ do
+ if
+ attached {WSF_TABLE} request.path_parameter ("args") as lst and then
+ attached lst.as_array_of_string as arr
+ then
+ Result := arr
+ else
+ create Result.make_empty
+ end
+
+ Result.rebase (1)
+ end
+
+end
diff --git a/draft/application/cms/src/module/shutdown/shutdown_cms_execution.e b/draft/application/cms/example/src/module/shutdown/shutdown_cms_execution.e
similarity index 100%
rename from draft/application/cms/src/module/shutdown/shutdown_cms_execution.e
rename to draft/application/cms/example/src/module/shutdown/shutdown_cms_execution.e
diff --git a/draft/application/cms/src/module/shutdown/shutdown_module.e b/draft/application/cms/example/src/module/shutdown/shutdown_module.e
similarity index 100%
rename from draft/application/cms/src/module/shutdown/shutdown_module.e
rename to draft/application/cms/example/src/module/shutdown/shutdown_module.e
diff --git a/draft/application/cms/example/src/web_cms.e b/draft/application/cms/example/src/web_cms.e
new file mode 100644
index 00000000..c8a5f5e4
--- /dev/null
+++ b/draft/application/cms/example/src/web_cms.e
@@ -0,0 +1,131 @@
+note
+ description: "[
+ This class implements the Demo of WEB CMS service
+
+ ]"
+
+class
+ WEB_CMS
+
+inherit
+ WSF_DEFAULT_SERVICE
+ redefine
+ initialize
+ end
+
+create
+ make_and_launch
+
+feature {NONE} -- Initialization
+
+ initialize
+ local
+ args: ARGUMENTS
+ cfg: detachable STRING
+ i,n: INTEGER
+ do
+ --| Arguments
+ create args
+ from
+ i := 1
+ n := args.argument_count
+ until
+ i > n or cfg /= Void
+ loop
+ if attached args.argument (i) as s then
+ if s.same_string ("--config") or s.same_string ("-c") then
+ if i < n then
+ cfg := args.argument (i + 1)
+ end
+ end
+ end
+ i := i + 1
+ end
+ if cfg = Void then
+ if file_exists ("cms.ini") then
+ cfg := "cms.ini"
+ end
+ end
+
+ --| EWF settings
+ service_options := create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("ewf.ini")
+ Precursor
+
+ --| CMS initialization
+ launch_cms (cms_setup (cfg))
+ end
+
+ cms_setup (a_cfg_fn: detachable READABLE_STRING_8): CMS_CUSTOM_SETUP
+ do
+ if a_cfg_fn /= Void then
+ create Result.make_from_file (a_cfg_fn)
+ else
+ create Result -- Default
+ end
+ setup_modules (Result)
+ setup_storage (Result)
+ end
+
+ launch_cms (a_setup: CMS_SETUP)
+ local
+ cms: CMS_SERVICE
+ do
+ create cms.make (a_setup)
+ on_launched (cms)
+ cms_service := cms
+ end
+
+feature -- Execution
+
+ cms_service: CMS_SERVICE
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ do
+ cms_service.execute (req, res)
+ end
+
+feature -- Access
+
+ setup_modules (a_setup: CMS_SETUP)
+ local
+ m: CMS_MODULE
+ do
+ create {DEMO_MODULE} m.make
+ m.enable
+ a_setup.add_module (m)
+
+ create {SHUTDOWN_MODULE} m.make
+ m.enable
+ a_setup.add_module (m)
+
+ create {DEBUG_MODULE} m.make
+ m.enable
+ a_setup.add_module (m)
+ end
+
+ setup_storage (a_setup: CMS_SETUP)
+ do
+
+ end
+
+feature -- Event
+
+ on_launched (cms: CMS_SERVICE)
+ local
+ e: CMS_EMAIL
+ do
+ create e.make (cms.site_email, cms.site_email, "[" + cms.site_name + "] launched...", "The site [" + cms.site_name + "] was launched at " + (create {DATE_TIME}.make_now_utc).out + " UTC.")
+ cms.mailer.safe_process_email (e)
+ end
+
+feature -- Helper
+
+ file_exists (fn: STRING): BOOLEAN
+ local
+ f: RAW_FILE
+ do
+ create f.make (fn)
+ Result := f.exists and then f.is_readable
+ end
+
+end
diff --git a/draft/application/cms/src/cms_configuration.e b/draft/application/cms/src/cms_configuration.e
new file mode 100644
index 00000000..2f7f8f53
--- /dev/null
+++ b/draft/application/cms/src/cms_configuration.e
@@ -0,0 +1,305 @@
+note
+ description: "Summary description for {CMS_CONFIGURATION}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ CMS_CONFIGURATION
+
+create
+ make,
+ make_from_file
+
+feature {NONE} -- Initialization
+
+ make
+ do
+ create options.make (10)
+ analyze
+ end
+
+ make_from_file (a_filename: READABLE_STRING_32)
+ -- Initialize `Current'.
+ do
+ make
+ configuration_location := a_filename
+ import (a_filename)
+ resolve
+ analyze
+ end
+
+ resolve
+ -- Resolve options related to variable ${..}
+ do
+ across
+ options as c
+ loop
+ options.replace (resolved_string (c.item), c.key)
+ end
+ end
+
+ analyze
+ do
+ get_root_location
+ get_var_location
+ get_themes_location
+ get_files_location
+ end
+
+feature -- Access
+
+ configuration_location: detachable READABLE_STRING_8
+
+ option (a_name: READABLE_STRING_GENERAL): detachable ANY
+ do
+ Result := options.item (a_name.as_string_8.as_lower)
+ end
+
+ options: HASH_TABLE [STRING, STRING]
+
+feature -- Conversion
+
+ append_to_string (s: STRING)
+ do
+ s.append ("Options:%N")
+ across
+ options as c
+ loop
+ s.append (c.key)
+ s.append_character ('=')
+ s.append (c.key)
+ s.append_character ('%N')
+ end
+
+ s.append ("Specific:%N")
+ s.append ("root_location=" + root_location + "%N")
+ s.append ("var_location=" + var_location + "%N")
+ s.append ("files_location=" + files_location + "%N")
+ s.append ("themes_location=" + themes_location + "%N")
+ end
+
+feature -- Element change
+
+ set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING)
+ do
+ options.force (a_value, a_name.as_string_8)
+ end
+
+feature -- Access
+
+ var_location: READABLE_STRING_8
+
+ root_location: READABLE_STRING_8
+
+ files_location: STRING
+
+ themes_location: STRING
+
+ theme_name (dft: detachable like theme_name): READABLE_STRING_8
+ do
+ if attached options.item ("theme") as s then
+ Result := s
+ elseif dft /= Void then
+ Result := dft
+ else
+ Result := "default"
+ end
+ end
+
+ site_id: READABLE_STRING_8
+ do
+ if attached options.item ("site.id") as s then
+ Result := s
+ else
+ Result := "_EWF_CMS_NO_ID_"
+ end
+ end
+
+ site_name (dft: like site_name): READABLE_STRING_8
+ do
+ if attached options.item ("site.name") as s then
+ Result := s
+ else
+ Result := dft
+ end
+ end
+
+ site_url (dft: like site_url): READABLE_STRING_8
+ do
+ if attached options.item ("site.url") as s then
+ Result := s
+ else
+ Result := dft
+ end
+ if Result /= Void then
+ if Result.is_empty then
+ -- ok
+ elseif not Result.ends_with ("/") then
+ Result := Result + "/"
+ end
+ end
+ end
+
+ site_script_url (dft: like site_script_url): detachable READABLE_STRING_8
+ do
+ if attached options.item ("site.script_url") as s then
+ Result := s
+ else
+ Result := dft
+ end
+ if Result /= Void then
+ if Result.is_empty then
+ elseif not Result.ends_with ("/") then
+ Result := Result + "/"
+ end
+ end
+ end
+
+ site_email (dft: like site_email): READABLE_STRING_8
+ do
+ if attached options.item ("site.email") as s then
+ Result := s
+ else
+ Result := dft
+ end
+ end
+
+feature -- Change
+
+ get_var_location
+ local
+ res: STRING_32
+ do
+ if attached options.item ("var-dir") as s then
+ res := s
+ else
+ res := execution_environment.current_working_directory
+ end
+ if res.ends_with ("/") then
+ res.remove_tail (1)
+ end
+ var_location := res
+ end
+
+ get_root_location
+ local
+ res: STRING_32
+ do
+ if attached options.item ("root-dir") as s then
+ res := s
+ else
+ res := execution_environment.current_working_directory
+ end
+ if res.ends_with ("/") then
+ res.remove_tail (1)
+ end
+ root_location := res
+ end
+
+ get_files_location
+ do
+ if attached options.item ("files-dir") as s then
+ files_location := s
+ else
+ files_location := "files"
+ end
+ end
+
+ get_themes_location
+ local
+ dn: DIRECTORY_NAME
+ do
+ if attached options.item ("themes-dir") as s then
+ themes_location := s
+ else
+ create dn.make_from_string (root_location)
+ dn.extend ("themes")
+ themes_location := dn.string
+ end
+ end
+
+feature {NONE} -- Implementation
+
+ import (a_filename: READABLE_STRING_32)
+ -- Import ini file content
+ local
+ f: PLAIN_TEXT_FILE
+ l,v: STRING_8
+ p: INTEGER
+ do
+ --FIXME: handle unicode filename here.
+ create f.make (a_filename)
+ if f.exists and f.is_readable then
+ f.open_read
+ from
+ f.read_line
+ until
+ f.exhausted
+ loop
+ l := f.last_string
+ l.left_adjust
+ if not l.is_empty and then l[1] /= '#' then
+ p := l.index_of ('=', 1)
+ if p > 1 then
+ v := l.substring (p + 1, l.count)
+ l.keep_head (p - 1)
+ v.left_adjust
+ v.right_adjust
+ l.right_adjust
+ set_option (l.as_lower, v)
+ end
+ end
+ f.read_line
+ end
+ f.close
+ end
+ end
+
+feature {NONE} -- Environment
+
+ Execution_environment: EXECUTION_ENVIRONMENT
+ once
+ create Result
+ end
+
+ resolved_string (s: READABLE_STRING_8): STRING
+ -- Resolved `s' using `options' or else environment variables.
+ local
+ i,n,b,e: INTEGER
+ k: detachable READABLE_STRING_8
+ do
+ from
+ i := 1
+ n := s.count
+ create Result.make (s.count)
+ until
+ i > n
+ loop
+ if i + 1 < n and then s[i] = '$' and then s[i+1] = '{' then
+ b := i + 2
+ e := s.index_of ('}', b) - 1
+ if e > 0 then
+ k := s.substring (b, e)
+ if attached option (k) as v then
+ Result.append (v.out)
+ i := e + 1
+ elseif attached execution_environment.get (k) as v then
+ Result.append (v)
+ i := e + 1
+ else
+ Result.extend (s[i])
+ end
+ else
+ Result.extend (s[i])
+ end
+ else
+ Result.extend (s[i])
+ end
+ i := i + 1
+ end
+ end
+
+
+
+end
diff --git a/draft/application/cms/src/cms_custom_setup.e b/draft/application/cms/src/cms_custom_setup.e
new file mode 100644
index 00000000..bc37ed0f
--- /dev/null
+++ b/draft/application/cms/src/cms_custom_setup.e
@@ -0,0 +1,18 @@
+note
+ description: "Summary description for {CMS_CUSTOM_SETUP}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ CMS_CUSTOM_SETUP
+
+inherit
+ CMS_DEFAULT_SETUP
+
+create
+ default_create,
+ make,
+ make_from_file
+
+end
diff --git a/draft/application/cms/src/cms_default_setup.e b/draft/application/cms/src/cms_default_setup.e
new file mode 100644
index 00000000..f9b61bea
--- /dev/null
+++ b/draft/application/cms/src/cms_default_setup.e
@@ -0,0 +1,134 @@
+note
+ description: "Summary description for {CMS_DEFAULT_SETUP}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ CMS_DEFAULT_SETUP
+
+inherit
+ CMS_SETUP
+ redefine
+ default_create
+ end
+
+create
+ default_create,
+ make,
+ make_from_file
+
+feature {NONE} -- Initialization
+
+ make (a_cfg: CMS_CONFIGURATION)
+ do
+ configuration := a_cfg
+ default_create
+ end
+
+ make_from_file (fn: READABLE_STRING_8)
+ local
+ cfg: CMS_CONFIGURATION
+ do
+ create cfg.make_from_file (fn)
+ make (cfg)
+ end
+
+ default_create
+ do
+ Precursor
+ build_modules
+ build_storage
+ build_session_manager
+ build_auth_engine
+ build_mailer
+ end
+
+feature -- Access
+
+ modules: ARRAYED_LIST [CMS_MODULE]
+
+ storage: CMS_STORAGE
+ -- CMS persistent layer
+
+ session_manager: WSF_SESSION_MANAGER
+ -- CMS Session manager
+
+ auth_engine: CMS_AUTH_ENGINE
+ -- CMS Authentication engine
+
+ mailer: CMS_MAILER
+
+feature {NONE} -- Initialization
+
+ build_modules
+ local
+ m: CMS_MODULE
+ do
+ create modules.make (3)
+
+ -- Core
+ create {USER_MODULE} m.make
+ m.enable
+ modules.extend (m)
+
+ create {ADMIN_MODULE} m.make
+ m.enable
+ modules.extend (m)
+
+ create {NODE_MODULE} m.make
+ m.enable
+ modules.extend (m)
+ end
+
+ build_storage
+ local
+ dn: DIRECTORY_NAME
+ do
+ if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
+ create dn.make_from_string (l_site_var_dir)
+ else
+ create dn.make
+ end
+ dn.extend ("_storage_")
+ create {CMS_SED_STORAGE} storage.make (dn.string)
+ end
+
+ build_session_manager
+ local
+ dn: DIRECTORY_NAME
+ do
+ if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
+ create dn.make_from_string (l_site_var_dir)
+ else
+ create dn.make
+ end
+ dn.extend ("_storage_")
+ dn.extend ("_sessions_")
+ create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
+ end
+
+ build_auth_engine
+ do
+ create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
+ end
+
+ build_mailer
+ local
+ ch_mailer: CMS_CHAIN_MAILER
+ st_mailer: CMS_STORAGE_MAILER
+ do
+ create st_mailer.make (storage)
+ create ch_mailer.make (st_mailer)
+ ch_mailer.set_next (create {CMS_SENDMAIL_MAILER})
+ mailer := ch_mailer
+ end
+
+feature -- Change
+
+ add_module (m: CMS_MODULE)
+ do
+ modules.force (m)
+ end
+
+end
diff --git a/draft/application/cms/src/core/cms_execution.e b/draft/application/cms/src/cms_execution.e
similarity index 84%
rename from draft/application/cms/src/core/cms_execution.e
rename to draft/application/cms/src/cms_execution.e
index 94d420d5..3211dd83 100644
--- a/draft/application/cms/src/core/cms_execution.e
+++ b/draft/application/cms/src/cms_execution.e
@@ -24,7 +24,7 @@ feature {NONE} -- Initialization
initialize
do
- is_front := request.path_info.same_string (service.front_path)
+ is_front := service.is_front_page (request)
has_js := True -- by default it is true, check cookie to see if this is not supported.
if attached request.cookie ("has_js") as c_has_js then
has_js := c_has_js.same_string ("0")
@@ -51,11 +51,6 @@ feature {CMS_SESSION_CONTROLER} -- Access: restricted
controller: CMS_SESSION_CONTROLER
- base_url: detachable READABLE_STRING_8
- do
- Result := service.base_url
- end
-
pending_messages_session_item_name: STRING = "cms.pending_messages"
-- Session item name to get the pending messages.
@@ -73,7 +68,7 @@ feature -- Access: CMS
feature -- Permission
- has_permissions (lst: detachable ITERABLE [READABLE_STRING_8]): BOOLEAN
+ frozen has_permissions (lst: detachable ITERABLE [READABLE_STRING_8]): BOOLEAN
do
if lst = Void then
Result := True
@@ -82,9 +77,11 @@ feature -- Permission
end
end
- has_permission (s: detachable READABLE_STRING_8): BOOLEAN
+ frozen has_permission (s: detachable READABLE_STRING_8): BOOLEAN
-- Anonymous or Current `user' has permission for `s'
--| `s' could be "create page",
+ local
+ u: detachable CMS_USER
do
if s = Void then
Result := True
@@ -92,10 +89,11 @@ feature -- Permission
if s.same_string ("authenticated") then
Result := authenticated
else
- if s.has_substring ("admin") or s.has_substring ("users") then
- Result := attached user as u and then u.is_admin
- else
+ u := user
+ if u /= Void and then u.is_admin then
Result := True
+ else
+ Result := service.user_has_permission (u, s)
end
end
end
@@ -349,10 +347,10 @@ feature -- Blocks
add_block (create {CMS_MENU_BLOCK}.make (m), Void)
end
- create s.make_empty
- s.append ("This site demonstrates a first implementation of CMS using EWF.%N")
- create b.make ("about", "About", s, formats.plain_text)
- add_block (b, "second_sidebar")
+-- create s.make_empty
+-- s.append ("This site demonstrates a first implementation of CMS using EWF.%N")
+-- create b.make ("about", "About", s, formats.plain_text)
+-- add_block (b, "second_sidebar")
create s.make_empty
s.append ("Made with EWF")
@@ -374,6 +372,9 @@ feature -- Access
page_title: detachable READABLE_STRING_32
-- Page title
+ additional_page_head_lines: detachable LIST [READABLE_STRING_8]
+ -- HTML>head>...extra lines
+
main_content: detachable STRING_8
redirection: detachable READABLE_STRING_8
@@ -385,11 +386,11 @@ feature -- Generation
across
a_menu_system as c
loop
- prepare_menu (c.item)
+ prepare_links (c.item)
end
end
- prepare_menu (a_menu: CMS_MENU)
+ prepare_links (a_menu: CMS_LINK_COMPOSITE)
local
to_remove: ARRAYED_LIST [CMS_LINK]
do
@@ -398,11 +399,17 @@ feature -- Generation
a_menu as c
loop
if attached {CMS_LOCAL_LINK} c.item as lm then
- if not has_permissions (lm.permission_arguments) then
+ if attached lm.permission_arguments as perms and then not has_permissions (perms) then
to_remove.force (lm)
else
+ -- if lm.permission_arguments is Void , this is permitted
lm.get_is_active (request)
+ if attached {CMS_LINK_COMPOSITE} lm as comp then
+ prepare_links (comp)
+ end
end
+ elseif attached {CMS_LINK_COMPOSITE} c.item as comp then
+ prepare_links (comp)
end
end
across
@@ -416,6 +423,14 @@ feature -- Generation
local
s: STRING_8
do
+ if attached additional_page_head_lines as l_head_lines then
+ across
+ l_head_lines as hl
+ loop
+ page.head_lines.force (hl.item)
+ end
+ end
+
add_to_main_menu (create {CMS_LOCAL_LINK}.make ("Home", "/"))
service.call_menu_alter_hooks (menu_system, Current)
@@ -491,7 +506,51 @@ feature -- Generation
end
end
-feature -- Element change
+feature -- Head customization
+
+ add_additional_head_line (s: READABLE_STRING_8; a_allow_duplication: BOOLEAN)
+ local
+ lst: like additional_page_head_lines
+ do
+ lst := additional_page_head_lines
+ if lst = Void then
+ create {ARRAYED_LIST [like additional_page_head_lines.item]} lst.make (1)
+ additional_page_head_lines := lst
+ end
+ if a_allow_duplication or else across lst as c all not c.item.same_string (s) end then
+ lst.extend (s)
+ end
+ end
+
+ add_style (a_href: STRING; a_media: detachable STRING)
+ local
+ s: STRING_8
+ do
+ s := "")
+ add_additional_head_line (s, False)
+ end
+
+ add_javascript_url (a_src: STRING)
+ local
+ s: STRING_8
+ do
+ s := ""
+ add_additional_head_line (s, False)
+ end
+
+ add_javascript_content (a_script: STRING)
+ local
+ s: STRING_8
+ do
+ s := ""
+ add_additional_head_line (s, True)
+ end
+
+feature -- Element change
set_title (t: like title)
do
@@ -558,6 +617,12 @@ feature {NONE} -- Execution
controller.session_commit (page, Current)
response.send (page)
+ on_terminated
+ end
+
+ on_terminated
+ do
+
end
feature {NONE} -- Implementation
diff --git a/draft/application/cms/src/core/cms_html_page_response.e b/draft/application/cms/src/cms_html_page_response.e
similarity index 100%
rename from draft/application/cms/src/core/cms_html_page_response.e
rename to draft/application/cms/src/cms_html_page_response.e
diff --git a/draft/application/cms/src/core/cms_service.e b/draft/application/cms/src/cms_service.e
similarity index 57%
rename from draft/application/cms/src/core/cms_service.e
rename to draft/application/cms/src/cms_service.e
index aebb13d4..5178eaa6 100644
--- a/draft/application/cms/src/core/cms_service.e
+++ b/draft/application/cms/src/cms_service.e
@@ -6,17 +6,51 @@ note
even for a specific handler.
]"
-deferred class
+class
CMS_SERVICE
-feature -- Initialization
+inherit
+ WSF_SERVICE
- initialize_cms
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make (a_setup: CMS_SETUP)
+ local
+ cfg: detachable CMS_CONFIGURATION
do
- site_name := "EWF::CMS"
- site_email := "webmaster"
- site_url := "" -- FIXME
+ cfg := a_setup.configuration
+ if cfg = Void then
+ create cfg.make
+ end
+
+ configuration := cfg
+ base_url := a_setup.base_url
+
+ site_id := cfg.site_id
+ site_url := cfg.site_url ("")
+ site_name := cfg.site_name ("EWF::CMS")
+ site_email := cfg.site_email ("webmaster")
+ site_dir := cfg.root_location
+ site_var_dir := cfg.var_location
+ files_location := cfg.files_location
+ themes_location := cfg.themes_location
+ theme_name := cfg.theme_name ("default")
+
+ set_script_url (cfg.site_script_url (Void)) -- Temporary value
+
+ compute_theme_resource_location
+
create content_types.make (3)
+
+ modules := a_setup.modules
+ storage := a_setup.storage
+ session_manager := a_setup.session_manager
+ auth_engine := a_setup.auth_engine
+ mailer := a_setup.mailer
+
initialize_storage
initialize_auth_engine
initialize_session_manager
@@ -26,55 +60,49 @@ feature -- Initialization
end
initialize_session_manager
- local
- dn: DIRECTORY_NAME
+-- local
+-- dn: DIRECTORY_NAME
do
- create dn.make_from_string ((create {EXECUTION_ENVIRONMENT}).current_working_directory)
- dn.extend ("_storage_")
- dn.extend ("_sessions_")
- create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
+-- create dn.make_from_string (site_var_dir)
+-- dn.extend ("_storage_")
+-- dn.extend ("_sessions_")
+-- create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
end
initialize_storage
- local
- e: EXECUTION_ENVIRONMENT
- dn: DIRECTORY_NAME
do
- create e
- create dn.make_from_string (e.current_working_directory)
- dn.extend ("_storage_")
- create {CMS_SED_STORAGE} storage.make (dn.string)
- if storage.users_count = 0 then
+ if not storage.has_user then
initialize_users
end
end
initialize_users
require
- has_no_user: storage.users_count = 0
+ has_no_user: not storage.has_user
local
u: CMS_USER
do
create u.make_new ("admin")
- u.set_encoded_password (storage.encoded_password ("istrator"))
+ u.set_password ("istrator")
storage.save_user (u)
end
initialize_mailer
local
- ch_mailer: CMS_CHAIN_MAILER
- st_mailer: CMS_STORAGE_MAILER
+-- ch_mailer: CMS_CHAIN_MAILER
+-- st_mailer: CMS_STORAGE_MAILER
do
- create st_mailer.make (storage)
- create ch_mailer.make (st_mailer)
- ch_mailer.set_next (create {CMS_SENDMAIL_MAILER})
- mailer := ch_mailer
+-- create st_mailer.make (storage)
+-- create ch_mailer.make (st_mailer)
+-- ch_mailer.set_next (create {CMS_SENDMAIL_MAILER})
+-- mailer := ch_mailer
end
initialize_router
local
-- h: CMS_HANDLER
file_hdl: CMS_FILE_SYSTEM_HANDLER
+ dn: DIRECTORY_NAME
do
create router.make (10)
router.set_base_url (base_url)
@@ -82,12 +110,13 @@ feature -- Initialization
router.map (create {WSF_URI_MAPPING}.make ("/", create {CMS_HANDLER}.make (agent handle_home)))
router.map (create {WSF_URI_MAPPING}.make ("/favicon.ico", create {CMS_HANDLER}.make (agent handle_favicon)))
- create file_hdl.make ("files")
+ create file_hdl.make (files_location)
file_hdl.disable_index
file_hdl.set_max_age (8*60*60)
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/files/", file_hdl))
- create file_hdl.make ("themes/default/res")
+ create dn.make_from_string (theme_resource_location)
+ create file_hdl.make (theme_resource_location)
file_hdl.set_max_age (8*60*60)
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/theme/", file_hdl))
end
@@ -99,37 +128,25 @@ feature -- Initialization
loop
if m.item.is_enabled then
m.item.register (Current)
+ if attached {CMS_HOOK_AUTO_REGISTER} m.item as h_auto then
+ h_auto.hook_auto_register (Current)
+ end
end
end
end
initialize_auth_engine
do
- create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
+-- create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
end
feature -- Access
+ configuration: CMS_CONFIGURATION
+
auth_engine: CMS_AUTH_ENGINE
- modules: ARRAYED_LIST [CMS_MODULE]
- local
- m: CMS_MODULE
- once
- create Result.make (10)
- -- Core
- create {USER_MODULE} m.make (Current)
- m.enable
- Result.extend (m)
-
- create {ADMIN_MODULE} m.make (Current)
- m.enable
- Result.extend (m)
-
- create {NODE_MODULE} m.make (Current)
- m.enable
- Result.extend (m)
- end
+ modules: LIST [CMS_MODULE]
feature -- Hook: menu_alter
@@ -218,22 +235,38 @@ feature -- Hook: block
feature -- Router
- site_name: STRING_32
+ site_id: READABLE_STRING_8
- site_email: STRING
+ site_name: READABLE_STRING_32
- site_url: STRING
+ site_email: READABLE_STRING_8
- front_path: STRING = "/"
+ site_url: READABLE_STRING_8
+
+ site_dir: READABLE_STRING_8
+
+ site_var_dir: READABLE_STRING_8
+
+ files_location: READABLE_STRING_8
+
+ themes_location: READABLE_STRING_8
+
+ compute_theme_resource_location
+ local
+ dn: DIRECTORY_NAME
+ do
+ create dn.make_from_string (themes_location)
+ dn.extend (theme_name)
+ dn.extend ("res")
+ theme_resource_location := dn.string
+ end
+
+ theme_resource_location: READABLE_STRING_8
+
+ theme_name: READABLE_STRING_32
router: WSF_ROUTER
- base_url: detachable READABLE_STRING_8
- deferred
- ensure
- valid_base_url: (Result /= Void and then Result.is_empty) implies (Result.starts_with ("/") and not Result.ends_with ("/"))
- end
-
map_uri_template (tpl: STRING; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
do
router.map (create {WSF_URI_TEMPLATE_MAPPING}.make_from_template (tpl, create {CMS_HANDLER}.make (proc)))
@@ -244,12 +277,83 @@ feature -- Router
router.map (create {WSF_URI_MAPPING}.make (a_uri, create {CMS_HANDLER}.make (proc)))
end
+feature -- URL related
+
+ front_path: STRING
+ do
+ if attached base_url as l_base_url then
+ Result := l_base_url + "/"
+ else
+ Result := "/"
+ end
+ end
+
+ urls_set: BOOLEAN
+
+ initialize_urls (req: WSF_REQUEST)
+ local
+ u: like base_url
+ do
+ if not urls_set then
+ u := base_url
+ if u = Void then
+ u := ""
+ end
+ urls_set := True
+ if site_url.is_empty then
+ site_url := req.absolute_script_url (u)
+ end
+ set_script_url (req.script_url (u))
+ end
+ end
+
+ base_url: detachable READABLE_STRING_8
+ -- Base url (related to the script path).
+
+ script_url: detachable READABLE_STRING_8
+
+ set_script_url (a_url: like script_url)
+ local
+ s: STRING_8
+ do
+ if a_url = Void then
+ script_url := Void
+ elseif not a_url.is_empty then
+ if a_url.ends_with ("/") then
+ create s.make_from_string (a_url)
+ else
+ create s.make (a_url.count + 1)
+ s.append (a_url)
+ s.append_character ('/')
+ end
+ script_url := s
+ end
+ ensure
+ attached script_url as l_url implies l_url.ends_with ("/")
+ end
+
+feature -- Report
+
+ is_front_page (req: WSF_REQUEST): BOOLEAN
+ do
+ Result := req.path_info.same_string (front_path)
+ end
+
+feature {CMS_EXECUTION, CMS_MODULE} -- Security report
+
+ user_has_permission (u: detachable CMS_USER; s: detachable READABLE_STRING_8): BOOLEAN
+ -- Anonymous or user `u' has permission for `s' ?
+ --| `s' could be "create page",
+ do
+ Result := storage.user_has_permission (u, s)
+ end
+
feature -- Storage
session_controller (req: WSF_REQUEST): CMS_SESSION_CONTROLER
-- New session controller for request `req'
do
- create Result.make (req, session_manager)
+ create Result.make (req, session_manager, site_id)
end
session_manager: WSF_SESSION_MANAGER
@@ -302,8 +406,11 @@ feature -- Core Execution
handle_favicon (req: WSF_REQUEST; res: WSF_RESPONSE)
local
fres: WSF_FILE_RESPONSE
+ fn: FILE_NAME
do
- create fres.make ("files/favicon.ico")
+ create fn.make_from_string (theme_resource_location)
+ fn.set_file_name ("favicon.ico")
+ create fres.make (fn.string)
fres.set_expires_in_seconds (7 * 24 * 60 * 60) -- 7 jours
res.send (fres)
end
@@ -313,27 +420,17 @@ feature -- Core Execution
(create {HOME_CMS_EXECUTION}.make (req, res, Current)).execute
end
--- handle_theme (req: WSF_REQUEST; res: WSF_RESPONSE)
--- do
--- (create {THEME_CMS_EXECUTION}.make (req, res, Current)).execute
--- end
-
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Default request handler if no other are relevant
local
e: CMS_EXECUTION
--- not_found: WSF_NOT_FOUND_RESPONSE
do
- if site_url.is_empty then
- site_url := req.absolute_script_url ("")
- end
+ initialize_urls (req)
if attached router.dispatch_and_return_handler (req, res) as p then
-- ok
else
create {NOT_FOUND_CMS_EXECUTION} e.make (req, res, Current)
e.execute
--- create not_found.make
--- res.send (not_found)
end
end
diff --git a/draft/application/cms/src/core/cms_session.e b/draft/application/cms/src/cms_session.e
similarity index 100%
rename from draft/application/cms/src/core/cms_session.e
rename to draft/application/cms/src/cms_session.e
diff --git a/draft/application/cms/src/cms_setup.e b/draft/application/cms/src/cms_setup.e
new file mode 100644
index 00000000..2ed8c7e0
--- /dev/null
+++ b/draft/application/cms/src/cms_setup.e
@@ -0,0 +1,55 @@
+note
+ description: "Summary description for {CMS_SETUP}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ CMS_SETUP
+
+feature -- Access
+
+ configuration: detachable CMS_CONFIGURATION
+
+ base_url: detachable READABLE_STRING_8
+
+ modules: LIST [CMS_MODULE]
+ deferred
+ end
+
+ storage: CMS_STORAGE
+ -- CMS persistent layer
+ deferred
+ end
+
+ session_manager: WSF_SESSION_MANAGER
+ -- CMS Session manager
+ deferred
+ end
+
+ auth_engine: CMS_AUTH_ENGINE
+ -- CMS Authentication engine
+ deferred
+ end
+
+ mailer: CMS_MAILER
+ -- CMS email engine
+ deferred
+ end
+
+feature -- Change
+
+ set_base_url (a_base_url: like base_url)
+ do
+ if a_base_url /= Void and then not a_base_url.is_empty then
+ base_url := a_base_url
+ else
+ base_url := Void
+ end
+ end
+
+ add_module (m: CMS_MODULE)
+ deferred
+ end
+
+end
diff --git a/draft/application/cms/src/core/cms_configuration.e b/draft/application/cms/src/core/cms_configuration.e
deleted file mode 100644
index e0f56325..00000000
--- a/draft/application/cms/src/core/cms_configuration.e
+++ /dev/null
@@ -1,146 +0,0 @@
-note
- description: "Summary description for {CMS_CONFIGURATION}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-class
- CMS_CONFIGURATION
-
-create
- make,
- make_from_file
-
-feature {NONE} -- Initialization
-
- make
- do
- create options.make (10)
- end
-
- make_from_file (a_filename: READABLE_STRING_32)
- -- Initialize `Current'.
- do
- make
- import (a_filename)
- end
-
-feature -- Access
-
- option (a_name: READABLE_STRING_GENERAL): detachable ANY
- do
- Result := options.item (a_name.as_string_8)
- end
-
- options: HASH_TABLE [STRING, STRING]
-
-feature -- Element change
-
- set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING)
- do
- options.force (a_value, a_name.as_string_8)
- end
-
-feature -- Access
-
- root_location: STRING
- do
- if attached options.item ("root.location") as s then
- Result := s
- else
- Result := execution_environment.current_working_directory
- end
- if not Result.ends_with ("/") then
- Result.append_character ('/')
- end
- end
-
- themes_location: STRING
- do
- if attached options.item ("themes.location") as s then
- Result := s
- else
- Result := root_location + "theme/default/"
- end
- end
-
- site_name (dft: like site_name): READABLE_STRING_8
- do
- if attached options.item ("site.name") as s then
- Result := s
- else
- Result := dft
- end
- end
-
- site_base_url (dft: like site_base_url): detachable READABLE_STRING_8
- do
- if attached options.item ("site.base_url") as s then
- Result := s
- else
- Result := dft
- end
- if Result /= Void then
- if Result.is_empty then
- Result := Void
- elseif not Result.starts_with ("/") then
- Result := "/" + Result
- if Result.ends_with ("/") then
- Result := Result.substring (1, Result.count - 1)
- end
- end
- end
- end
-
- site_email (dft: like site_email): READABLE_STRING_8
- do
- if attached options.item ("site.email") as s then
- Result := s
- else
- Result := dft
- end
- end
-
-feature {NONE} -- Implementation
-
- execution_environment: EXECUTION_ENVIRONMENT
- once
- create Result
- end
-
- import (a_filename: READABLE_STRING_32)
- -- Import ini file content
- local
- f: PLAIN_TEXT_FILE
- l,v: STRING_8
- p: INTEGER
- do
- --FIXME: handle unicode filename here.
- create f.make (a_filename)
- if f.exists and f.is_readable then
- f.open_read
- from
- f.read_line
- until
- f.exhausted
- loop
- l := f.last_string
- l.left_adjust
- if not l.is_empty and then l[1] /= '#' then
- p := l.index_of ('=', 1)
- if p > 1 then
- v := l.substring (p + 1, l.count)
- l.keep_head (p - 1)
- v.left_adjust
- v.right_adjust
- l.right_adjust
- set_option (l.as_lower, v)
- end
- end
- f.read_line
- end
- f.close
- end
- end
-
-end
diff --git a/draft/application/cms/src/core/default_theme/default_cms_theme.e b/draft/application/cms/src/core/default_theme/default_cms_theme.e
deleted file mode 100644
index 07826965..00000000
--- a/draft/application/cms/src/core/default_theme/default_cms_theme.e
+++ /dev/null
@@ -1,134 +0,0 @@
-note
- description: "Summary description for {CMS_THEME}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-class
- DEFAULT_CMS_THEME
-
-inherit
- CMS_THEME
-
-create
- make
-
-feature {NONE} -- Initialization
-
- make (a_service: like service)
- do
- service := a_service
- end
-
- service: CMS_SERVICE
-
-feature -- Access
-
- name: STRING = "CMS"
-
- regions: ARRAY [STRING]
- once
- Result := <<"header", "content", "footer", "first_sidebar", "second_sidebar">>
- end
-
- html_template: DEFAULT_CMS_HTML_TEMPLATE
- local
- tpl: like internal_html_template
- do
- tpl := internal_html_template
- if tpl = Void then
- create tpl.make (Current)
- internal_html_template := tpl
- end
- Result := tpl
- end
-
- page_template: DEFAULT_CMS_PAGE_TEMPLATE
- local
- tpl: like internal_page_template
- do
- tpl := internal_page_template
- if tpl = Void then
- create tpl.make (Current)
- internal_page_template := tpl
- end
- Result := tpl
- end
-
- css: STRING
- do
- Result := "[
- body { margin: 0; }
- div#header { background-color: #00a; color: #fff; border: solid 1px #00a; padding: 10px;}
- div#header img#logo { float: left; margin: 3px; }
- div#header div#title {font-size: 180%; font-weight: bold; }
- ul.horizontal {
- list-style-type: none;
- }
- ul.horizontal li {
- display: inline;
- padding: 5px;
- }
- div#first-menu { padding: 5px; color: #ccf; background-color: #006; }
- div#first-menu a { color: #ccf; }
- div#second-menu { color: #99f; background-color: #333; }
- div#second-menu a { color: #99f; }
-
- div#left_sidebar {
- width: 150px;
- border: solid 1px #009;
- margin: 5px;
- padding: 5px;
- width: 150px;
- display: inline;
- float: left;
- position: relative;
- }
- div#main-wrapper {
- clear: both;
- display: block;
- height: 0;
- }
- div#main { margin: 0; padding: 10px; clear: both; height:0; display: block; }
- div#content { padding: 10px; border: solid 1px #00f;
- width: 700px;
- display: inline;
- float: left;
- position: relative;
- }
- div#footer { margin: 10px 0 10px 0; clear: both; display: block; text-align: center; padding: 10px; border-top: solid 1px #00f; color: #fff; background-color: #333;}
- div#footer a { color: #ff0; }
- ]"
- end
-
-feature -- Conversion
-
- prepare (page: CMS_HTML_PAGE)
- do
- if attached css as t_css then
--- page.head_lines.extend ("")
- page.add_style (url ("/theme/style.css", Void), Void)
- end
- end
-
- page_html (page: CMS_HTML_PAGE): STRING_8
- local
- l_content: STRING_8
- do
- prepare (page)
- page_template.prepare (page)
- l_content := page_template.to_html (page)
- html_template.prepare (page)
- html_template.register (l_content, "page")
- Result := html_template.to_html (page)
- end
-
-feature {NONE} -- Internal
-
- internal_page_template: detachable like page_template
-
- internal_html_template: detachable like html_template
-
-invariant
- attached internal_page_template as inv_p implies inv_p.theme = Current
-end
diff --git a/draft/application/cms/src/core/kernel/form/cms_form.e b/draft/application/cms/src/core/kernel/form/cms_form.e
deleted file mode 100644
index 4065d98e..00000000
--- a/draft/application/cms/src/core/kernel/form/cms_form.e
+++ /dev/null
@@ -1,166 +0,0 @@
-note
- description: "Summary description for {CMS_FORM}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-class
- CMS_FORM
-
-inherit
- ITERABLE [CMS_FORM_ITEM]
-
-create
- make
-
-feature {NONE} -- Initialization
-
- make (a_action: READABLE_STRING_8; a_id: READABLE_STRING_8)
- do
- action := a_action
- id := a_id
-
- create html_classes.make (2)
- create items.make (10)
- end
-
-feature -- Access
-
- action: READABLE_STRING_8
- -- URL for the web form
-
- id: READABLE_STRING_8
- -- Id of the form
-
- count: INTEGER
- do
- Result := items.count
- end
-
-feature -- Validation
-
- validation_action: detachable PROCEDURE [ANY, TUPLE [CMS_FORM_DATA]]
- -- Procedure to validate the data
- -- report error if not valid
-
--- submit_callbacks_actions: HASH_TABLE [PROCEDURE [ANY, TUPLE [CMS_FORM_DATA]], STRING]
--- -- Submit callbacks indexed by submit names
-
-feature -- Element change
-
- set_validation_action (act: like validation_action)
- do
- validation_action := act
- end
-
-feature -- Access
-
- new_cursor: ITERATION_CURSOR [CMS_FORM_ITEM]
- -- Fresh cursor associated with current structure
- do
- Result := items.new_cursor
- end
-
-feature -- Optional
-
- html_classes: ARRAYED_LIST [STRING_8]
-
-feature -- Items
-
- has_field (a_name: READABLE_STRING_GENERAL): BOOLEAN
- do
- Result := across items as i some attached {CMS_FORM_FIELD} i.item as l_field and then l_field.name.same_string_general (a_name) end
- end
-
--- items_by_name (a_name: READABLE_STRING_GENERAL): detachable LIST [CMS_FORM_ITEM]
--- local
--- res: detachable ARRAYED_LIST [CMS_FORM_ITEM]
--- do
--- across
--- items as c
--- loop
--- if c.item.name.same_string_general (a_name) then
--- if res = Void then
--- create res.make (1)
--- end
--- res.force (c.item)
--- end
--- end
--- Result := res
--- end
-
- fields_by_name (a_name: READABLE_STRING_GENERAL): detachable LIST [CMS_FORM_FIELD]
- local
- res: detachable ARRAYED_LIST [CMS_FORM_FIELD]
- do
- across
- items as c
- loop
- if
- attached {CMS_FORM_FIELD} c.item as l_field and then
- l_field.name.same_string_general (a_name)
- then
- if res = Void then
- create res.make (1)
- end
- res.force (l_field)
- end
- end
- Result := res
- end
-
- extend (i: CMS_FORM_ITEM)
- local
- n: READABLE_STRING_8
- do
- if attached {CMS_FORM_FIELD} i as l_field then
- n := l_field.name
- if n.is_empty then
- n := (items.count + 1).out
- l_field.update_name (n)
- end
- end
- items.force (i)
- end
-
- extend_text (t: READABLE_STRING_8)
- do
- extend (create {CMS_FORM_RAW_TEXT}.make (t))
- end
-
-feature -- Conversion
-
- to_html (a_theme: CMS_THEME): STRING_8
- local
- s: STRING
- do
- Result := "%N")
- end
-
-feature {NONE} -- Implementation
-
- items: ARRAYED_LIST [CMS_FORM_ITEM]
- -- name => item
-
-invariant
-
-end
diff --git a/draft/application/cms/src/core/kernel/form/cms_form_checkbox_input.e b/draft/application/cms/src/core/kernel/form/cms_form_checkbox_input.e
deleted file mode 100644
index 42b35165..00000000
--- a/draft/application/cms/src/core/kernel/form/cms_form_checkbox_input.e
+++ /dev/null
@@ -1,46 +0,0 @@
-note
- description: "Summary description for {CMS_FORM_CHECKBOX_INPUT}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-class
- CMS_FORM_CHECKBOX_INPUT
-
-inherit
- CMS_FORM_INPUT
- redefine
- specific_input_attributes_string
- end
-
-create
- make
-
-feature -- Access
-
- checked: BOOLEAN
- -- Current element should be preselected when the page loads
-
- input_type: STRING = "checkbox"
-
-feature -- Change
-
- set_checked (b: like checked)
- do
- checked := b
- end
-
-feature {NONE} -- Implementation
-
- specific_input_attributes_string: detachable STRING_8
- -- Specific input attributes if any.
- -- To redefine if needed
- do
- if checked then
- Result := "checked=%"checked%""
- end
- end
-
-invariant
-
-end
diff --git a/draft/application/cms/src/core/kernel/link/cms_link.e b/draft/application/cms/src/core/kernel/link/cms_link.e
deleted file mode 100644
index c9b37941..00000000
--- a/draft/application/cms/src/core/kernel/link/cms_link.e
+++ /dev/null
@@ -1,43 +0,0 @@
-note
- description: "Summary description for {CMS_MENU}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-deferred class
- CMS_LINK
-
-inherit
- REFACTORING_HELPER
-
-feature -- Access
-
- title: READABLE_STRING_32
-
- location: READABLE_STRING_8
-
- options: detachable CMS_API_OPTIONS
-
-feature -- status report
-
- is_active: BOOLEAN
- deferred
- end
-
- is_expanded: BOOLEAN
- deferred
- end
-
- is_expandable: BOOLEAN
- deferred
- end
-
-feature -- Query
-
- parent: detachable CMS_LINK
-
- children: detachable LIST [CMS_LINK]
- deferred
- end
-
-end
diff --git a/draft/application/cms/src/core/kernel/link/cms_local_link.e b/draft/application/cms/src/core/kernel/link/cms_local_link.e
deleted file mode 100644
index 152c89ab..00000000
--- a/draft/application/cms/src/core/kernel/link/cms_local_link.e
+++ /dev/null
@@ -1,72 +0,0 @@
-note
- description: "Summary description for {CMS_LOCAL_MENU}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-class
- CMS_LOCAL_LINK
-
-inherit
- CMS_LINK
-
-create
- make
-
-feature {NONE} -- Initialization
-
- make (a_title: detachable like title; a_location: like location)
- do
- if a_title /= Void then
- title := a_title
- else
- title := a_location
- end
- location := a_location
- end
-
-feature -- Status report
-
- is_active: BOOLEAN
-
- is_expanded: BOOLEAN
-
- is_expandable: BOOLEAN
-
- permission_arguments: detachable ITERABLE [STRING]
-
- children: detachable LIST [CMS_LINK]
-
-feature -- Element change
-
- set_children (lst: like children)
- do
- children := lst
- end
-
- set_expanded (b: like is_expanded)
- do
- is_expanded := b
- end
-
- set_expandable (b: like is_expandable)
- do
- is_expandable := b
- end
-
- get_is_active (req: WSF_REQUEST)
- do
- is_active := req.path_info.same_string (location)
- end
-
- set_permission_arguments (args: ITERABLE [STRING])
- do
- permission_arguments := args
- end
-
- set_options (opts: like options)
- do
- options := opts
- end
-
-end
diff --git a/draft/application/cms/src/core/modules/admin/admin_module.e b/draft/application/cms/src/core/modules/admin/admin_module.e
deleted file mode 100644
index a669ab28..00000000
--- a/draft/application/cms/src/core/modules/admin/admin_module.e
+++ /dev/null
@@ -1,100 +0,0 @@
-note
- description: "Summary description for {ADMIN_MODULE}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-class
- ADMIN_MODULE
-
-inherit
- CMS_MODULE
-
- CMS_HOOK_MENU_ALTER
-
-create
- make
-
-feature {NONE} -- Initialization
-
- make (a_service: like service)
- do
- service := a_service
- name := "admin"
- version := "1.0"
- description := "Set of service to administrate the site"
- package := "core"
-
- enable
- end
-
-feature {CMS_SERVICE} -- Registration
-
- service: CMS_SERVICE
-
- register (a_service: CMS_SERVICE)
- do
- a_service.map_uri ("/admin/", agent handle_admin)
- a_service.map_uri ("/admin/users/", agent handle_admin_users)
- a_service.map_uri ("/admin/blocks/", agent handle_admin_blocks)
- a_service.map_uri ("/admin/modules/", agent handle_admin_modules)
- a_service.map_uri ("/admin/logs/", agent handle_admin_logs)
- a_service.map_uri_template ("/admin/log/{log-id}", agent handle_admin_log_view)
-
- a_service.add_menu_alter_hook (Current)
- end
-
-feature -- Hooks
-
- menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
- local
- lnk: CMS_LOCAL_LINK
- do
- create lnk.make ("Administer", "/admin/")
- lnk.set_permission_arguments (<<"administer">>)
- a_menu_system.management_menu.extend (lnk)
- end
-
- links: HASH_TABLE [CMS_MODULE_LINK, STRING]
- -- Link indexed by path
- local
--- lnk: CMS_MODULE_LINK
- do
- create Result.make (3)
--- create lnk.make ("Date/time demo")
--- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
--- Result["/demo/date/{arg}"] := lnk
- end
-
- handle_admin (req: WSF_REQUEST; res: WSF_RESPONSE)
- do
- (create {ADMIN_CMS_EXECUTION}.make (req, res, service)).execute
- end
-
- handle_admin_users (req: WSF_REQUEST; res: WSF_RESPONSE)
- do
- (create {ADMIN_USERS_CMS_EXECUTION}.make (req, res, service)).execute
- end
-
- handle_admin_blocks (req: WSF_REQUEST; res: WSF_RESPONSE)
- do
- (create {ADMIN_BLOCKS_CMS_EXECUTION}.make (req, res, service)).execute
- end
-
- handle_admin_modules (req: WSF_REQUEST; res: WSF_RESPONSE)
- do
- (create {ADMIN_MODULES_CMS_EXECUTION}.make (req, res, service)).execute
- end
-
- handle_admin_logs (req: WSF_REQUEST; res: WSF_RESPONSE)
- do
- (create {ADMIN_LOGS_CMS_EXECUTION}.make (req, res, service)).execute
- end
-
- handle_admin_log_view (req: WSF_REQUEST; res: WSF_RESPONSE)
- do
- (create {LOG_VIEW_CMS_EXECUTION}.make (req, res, service)).execute
- end
-
-
-end
diff --git a/draft/application/cms/src/core/modules/user/user_login_cms_execution.e b/draft/application/cms/src/core/modules/user/user_login_cms_execution.e
deleted file mode 100644
index 56f1a4f0..00000000
--- a/draft/application/cms/src/core/modules/user/user_login_cms_execution.e
+++ /dev/null
@@ -1,114 +0,0 @@
-note
- description: "[
- ]"
-
-class
- USER_LOGIN_CMS_EXECUTION
-
-inherit
- CMS_EXECUTION
-
- CMS_AUTH_ENGINE
-
-create
- make
-
-feature -- Status
-
- valid_credential (u,p: READABLE_STRING_32): BOOLEAN
- do
- if attached service.storage.user_by_name (u) as l_user then
- Result := attached l_user.encoded_password as l_pass and then l_pass.same_string (service.storage.encoded_password (p))
- end
- end
-
-feature -- Execution
-
- process
- -- Computed response message.
- local
- auth_engine: CMS_AUTH_ENGINE
- l_url: detachable READABLE_STRING_8
- err: detachable STRING_8
- b: STRING_8
- u: detachable STRING_32
- do
- if request.is_request_method ("post") then
- if
- attached {WSF_STRING} request.form_parameter (form_login_name) as s_login and then not s_login.is_empty and
- attached {WSF_STRING} request.form_parameter (form_password_name) as s_passwd and then not s_passwd.is_empty
- then
- auth_engine := Current
- u := s_login.value
- if attached service.storage.user_by_name (u) as l_user and auth_engine.valid_credential (u, s_passwd.value) then
- login (l_user, request)
- else
- err := "Authentication failed for [" + html_encoded (u) + "]"
- end
- if attached {WSF_STRING} request.form_parameter ("form-destination") as s_dest then
- l_url := request.script_url (s_dest.value)
- end
- end
- else
- if
- attached {WSF_STRING} request.item ("destination") as s_dest
- then
- l_url := request.script_url (s_dest.value)
- end
- end
-
- if l_url = Void then
- l_url := request.script_url ("/user")
- end
-
- if authenticated then
- set_redirection (l_url)
- set_title ("Login")
- create b.make_empty
- b.append ("Login
%N")
- set_main_content (b)
- else
- set_title ("Login")
- create b.make_empty
- b.append ("Login
%N")
-
- if err /= Void then
- b.append ("" + err + "")
- end
-
- b.append ("%N")
-
- set_main_content (b)
- end
- end
-
- form_login_name: STRING = "login"
- form_password_name: STRING = "password"
-
-end
diff --git a/draft/application/cms/src/core/default_theme/default_cms_html_template.e b/draft/application/cms/src/default_theme/default_cms_html_template.e
similarity index 100%
rename from draft/application/cms/src/core/default_theme/default_cms_html_template.e
rename to draft/application/cms/src/default_theme/default_cms_html_template.e
diff --git a/draft/application/cms/src/core/default_theme/default_cms_page_template.e b/draft/application/cms/src/default_theme/default_cms_page_template.e
similarity index 81%
rename from draft/application/cms/src/core/default_theme/default_cms_page_template.e
rename to draft/application/cms/src/default_theme/default_cms_page_template.e
index eba29827..e31dc329 100644
--- a/draft/application/cms/src/core/default_theme/default_cms_page_template.e
+++ b/draft/application/cms/src/default_theme/default_cms_page_template.e
@@ -27,7 +27,7 @@ feature -- Access
theme: DEFAULT_CMS_THEME
- prepare (page: CMS_HTML_PAGE)
+ prepare (page: CMS_HTML_PAGE)
do
variables.make (10)
@@ -69,9 +69,9 @@ feature {NONE} -- Implementation
-
- $content
-
+
+ $content
+
diff --git a/draft/application/cms/src/default_theme/default_cms_theme.e b/draft/application/cms/src/default_theme/default_cms_theme.e
new file mode 100644
index 00000000..00a0334d
--- /dev/null
+++ b/draft/application/cms/src/default_theme/default_cms_theme.e
@@ -0,0 +1,85 @@
+note
+ description: "Summary description for {CMS_THEME}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ DEFAULT_CMS_THEME
+
+inherit
+ CMS_THEME
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make (a_service: like service)
+ do
+ service := a_service
+ end
+
+ service: CMS_SERVICE
+
+feature -- Access
+
+ name: STRING = "CMS"
+
+ regions: ARRAY [STRING]
+ once
+ Result := <<"header", "content", "footer", "first_sidebar", "second_sidebar">>
+ end
+
+ html_template: DEFAULT_CMS_HTML_TEMPLATE
+ local
+ tpl: like internal_html_template
+ do
+ tpl := internal_html_template
+ if tpl = Void then
+ create tpl.make (Current)
+ internal_html_template := tpl
+ end
+ Result := tpl
+ end
+
+ page_template: DEFAULT_CMS_PAGE_TEMPLATE
+ local
+ tpl: like internal_page_template
+ do
+ tpl := internal_page_template
+ if tpl = Void then
+ create tpl.make (Current)
+ internal_page_template := tpl
+ end
+ Result := tpl
+ end
+
+feature -- Conversion
+
+ prepare (page: CMS_HTML_PAGE)
+ do
+ page.add_style (url ("/theme/style.css", Void), Void)
+ end
+
+ page_html (page: CMS_HTML_PAGE): STRING_8
+ local
+ l_content: STRING_8
+ do
+ prepare (page)
+ page_template.prepare (page)
+ l_content := page_template.to_html (page)
+ html_template.prepare (page)
+ html_template.register (l_content, "page")
+ Result := html_template.to_html (page)
+ end
+
+feature {NONE} -- Internal
+
+ internal_page_template: detachable like page_template
+
+ internal_html_template: detachable like html_template
+
+invariant
+ attached internal_page_template as inv_p implies inv_p.theme = Current
+end
diff --git a/draft/application/cms/src/core/handler/any_cms_execution.e b/draft/application/cms/src/handler/any_cms_execution.e
similarity index 60%
rename from draft/application/cms/src/core/handler/any_cms_execution.e
rename to draft/application/cms/src/handler/any_cms_execution.e
index 86312476..882e5205 100644
--- a/draft/application/cms/src/core/handler/any_cms_execution.e
+++ b/draft/application/cms/src/handler/any_cms_execution.e
@@ -34,15 +34,28 @@ feature -- Execution
-- Computed response message.
local
b: STRING_8
+ s: STRING
do
- create b.make_empty
- if attached text as t then
- set_title (request.path_info)
+ if attached main_content as m then
+ -- ok
+ elseif attached text as t then
+ create b.make_empty
+ s := request.path_info
+ if attached service.script_url as l_script_url then
+ if s.starts_with (l_script_url) then
+ s.remove_head (l_script_url.count)
+ if s.starts_with ("/") then
+ s.remove_head (1)
+ end
+ end
+ end
+ set_title (s)
b.append (t)
+ set_main_content (b)
else
- set_title ("Page Not Found")
+ set_title ("...")
+ set_main_content ("")
end
- set_main_content (b)
end
end
diff --git a/draft/application/cms/src/core/handler/cms_file_system_handler.e b/draft/application/cms/src/handler/cms_file_system_handler.e
similarity index 100%
rename from draft/application/cms/src/core/handler/cms_file_system_handler.e
rename to draft/application/cms/src/handler/cms_file_system_handler.e
diff --git a/draft/application/cms/src/core/handler/cms_handler.e b/draft/application/cms/src/handler/cms_handler.e
similarity index 100%
rename from draft/application/cms/src/core/handler/cms_handler.e
rename to draft/application/cms/src/handler/cms_handler.e
diff --git a/draft/application/cms/src/core/handler/home_cms_execution.e b/draft/application/cms/src/handler/home_cms_execution.e
similarity index 100%
rename from draft/application/cms/src/core/handler/home_cms_execution.e
rename to draft/application/cms/src/handler/home_cms_execution.e
diff --git a/draft/application/cms/src/core/handler/not_found_cms_execution.e b/draft/application/cms/src/handler/not_found_cms_execution.e
similarity index 100%
rename from draft/application/cms/src/core/handler/not_found_cms_execution.e
rename to draft/application/cms/src/handler/not_found_cms_execution.e
diff --git a/draft/application/cms/src/core/handler/theme_cms_execution.e b/draft/application/cms/src/handler/theme_cms_execution.e
similarity index 100%
rename from draft/application/cms/src/core/handler/theme_cms_execution.e
rename to draft/application/cms/src/handler/theme_cms_execution.e
diff --git a/draft/application/cms/src/core/hooks/cms_hook.e b/draft/application/cms/src/hooks/cms_hook.e
similarity index 100%
rename from draft/application/cms/src/core/hooks/cms_hook.e
rename to draft/application/cms/src/hooks/cms_hook.e
diff --git a/draft/application/cms/src/hooks/cms_hook_auto_register.e b/draft/application/cms/src/hooks/cms_hook_auto_register.e
new file mode 100644
index 00000000..0bb95c75
--- /dev/null
+++ b/draft/application/cms/src/hooks/cms_hook_auto_register.e
@@ -0,0 +1,29 @@
+note
+ description: "[
+ Summary description for {CMS_HOOK_AUTO_REGISTER}.
+ When inheriting from this class, the declared hooks are automatically
+ registered, otherwise, each descendant has to add it to the cms service
+ itself.
+ ]"
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred class
+ CMS_HOOK_AUTO_REGISTER
+
+inherit
+ CMS_HOOK
+
+feature -- Hook
+
+ hook_auto_register (a_service: CMS_SERVICE)
+ do
+ if attached {CMS_HOOK_MENU_ALTER} Current as h_menu_alter then
+ a_service.add_menu_alter_hook (h_menu_alter)
+ end
+ if attached {CMS_HOOK_BLOCK} Current as h_block then
+ a_service.add_block_hook (h_block)
+ end
+ end
+
+end
diff --git a/draft/application/cms/src/core/hooks/cms_hook_block.e b/draft/application/cms/src/hooks/cms_hook_block.e
similarity index 100%
rename from draft/application/cms/src/core/hooks/cms_hook_block.e
rename to draft/application/cms/src/hooks/cms_hook_block.e
diff --git a/draft/application/cms/src/core/hooks/cms_hook_form_alter.e b/draft/application/cms/src/hooks/cms_hook_form_alter.e
similarity index 100%
rename from draft/application/cms/src/core/hooks/cms_hook_form_alter.e
rename to draft/application/cms/src/hooks/cms_hook_form_alter.e
diff --git a/draft/application/cms/src/core/hooks/cms_hook_menu_alter.e b/draft/application/cms/src/hooks/cms_hook_menu_alter.e
similarity index 100%
rename from draft/application/cms/src/core/hooks/cms_hook_menu_alter.e
rename to draft/application/cms/src/hooks/cms_hook_menu_alter.e
diff --git a/draft/application/cms/src/core/kernel/api/cms_api_options.e b/draft/application/cms/src/kernel/api/cms_api_options.e
similarity index 78%
rename from draft/application/cms/src/core/kernel/api/cms_api_options.e
rename to draft/application/cms/src/kernel/api/cms_api_options.e
index e33c5164..fb698024 100644
--- a/draft/application/cms/src/core/kernel/api/cms_api_options.e
+++ b/draft/application/cms/src/kernel/api/cms_api_options.e
@@ -7,6 +7,9 @@ note
class
CMS_API_OPTIONS
+inherit
+ TABLE_ITERABLE [detachable ANY, STRING]
+
create
make,
make_from_manifest
@@ -70,6 +73,25 @@ feature -- Access
table: HASH_TABLE [detachable ANY, STRING]
+feature -- Change
+
+ import (a_opts: CMS_API_OPTIONS)
+ do
+ across
+ a_opts as c
+ loop
+ force (c.item, c.key)
+ end
+ end
+
+feature -- Access
+
+ new_cursor: TABLE_ITERATION_CURSOR [detachable ANY, STRING]
+ -- Fresh cursor associated with current structure
+ do
+ Result := table.new_cursor
+ end
+
invariant
end
diff --git a/draft/application/cms/src/core/kernel/api/cms_common_api.e b/draft/application/cms/src/kernel/api/cms_common_api.e
similarity index 68%
rename from draft/application/cms/src/core/kernel/api/cms_common_api.e
rename to draft/application/cms/src/kernel/api/cms_common_api.e
index 03855975..e6422cde 100644
--- a/draft/application/cms/src/core/kernel/api/cms_common_api.e
+++ b/draft/application/cms/src/kernel/api/cms_common_api.e
@@ -15,7 +15,8 @@ feature {NONE} -- Access
base_url: detachable READABLE_STRING_8
-- Base url if any.
- deferred
+ do
+ Result := service.script_url
end
based_path (p: STRING): STRING
@@ -23,7 +24,14 @@ feature {NONE} -- Access
do
if attached base_url as l_base_url then
create Result.make_from_string (l_base_url)
- Result.append (p)
+ if p.is_empty then
+ else
+ if p[1] = '/' then
+ Result.append (p.substring (2, p.count))
+ else
+ Result.append (p)
+ end
+ end
else
Result := p
end
@@ -55,24 +63,45 @@ feature -- Access
end
end
- link (a_text: READABLE_STRING_GENERAL; a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
+ link (a_text: detachable READABLE_STRING_GENERAL; a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
local
l_html: BOOLEAN
+ t: READABLE_STRING_GENERAL
do
l_html := True
if opts /= Void then
l_html := opts.boolean_item ("html", l_html)
end
Result := ""
- if l_html then
- if attached {READABLE_STRING_8} a_text as t then
- Result.append (t)
- else
- Result.append (a_text.to_string_8)
- end
+ if a_text = Void then
+ t := a_path
else
- Result.append (checked_plain (a_text))
+ t := a_text
end
+ if l_html then
+ Result.append (html_encoded (t))
+ else
+ Result.append (checked_plain (t))
+ end
+ Result.append ("")
+ end
+
+ link_with_raw_text (a_text: detachable READABLE_STRING_8; a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
+ local
+ l_html: BOOLEAN
+ t: READABLE_STRING_8
+ do
+ l_html := True
+ if opts /= Void then
+ l_html := opts.boolean_item ("html", l_html)
+ end
+ Result := ""
+ if a_text = Void then
+ t := a_path
+ else
+ t := a_text
+ end
+ Result.append (t)
Result.append ("")
end
@@ -83,7 +112,7 @@ feature -- Access
node_link (n: CMS_NODE): like link
do
- Result := link (html_encoded (n.title), "/node/" + n.id.out, Void)
+ Result := link (n.title, "/node/" + n.id.out, Void)
end
user_url (u: CMS_USER): like url
@@ -96,6 +125,18 @@ feature -- Access
Result := url ("/node/" + n.id.out, Void)
end
+ absolute_url (a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
+ local
+ l_opts: detachable CMS_API_OPTIONS
+ do
+ l_opts := opts
+ if l_opts = Void then
+ create l_opts.make (1)
+ end
+ l_opts.force (True, "absolute")
+ Result := url (a_path, l_opts)
+ end
+
url (a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
local
q,f: detachable STRING_8
@@ -103,7 +144,6 @@ feature -- Access
do
l_abs := False
- Result := based_path (a_path)
if opts /= Void then
l_abs := opts.boolean_item ("absolute", l_abs)
if attached opts.item ("query") as l_query then
@@ -128,17 +168,36 @@ feature -- Access
f := s_frag
end
end
+ if l_abs then
+ if a_path.substring_index ("://", 1) = 0 then
+ create Result.make_from_string (service.site_url)
+ if a_path.is_empty then
+ elseif Result.ends_with ("/") then
+ if a_path[1] = '/' then
+ Result.append_string (a_path.substring (2, a_path.count))
+ else
+ Result.append_string (a_path)
+ end
+ else
+ if a_path[1] = '/' then
+ Result.append_string (a_path)
+ else
+ Result.append_character ('/')
+ Result.append_string (a_path)
+ end
+ end
+ else
+ Result := a_path
+ end
+ else
+ Result := based_path (a_path)
+ end
if q /= Void then
Result.append ("?" + q)
end
if f /= Void then
Result.append ("#" + f)
end
- if l_abs then
- if Result.substring_index ("://", 1) = 0 then
- Result.prepend (service.site_url)
- end
- end
end
checked_url (a_url: STRING): STRING
diff --git a/draft/application/cms/src/core/kernel/api/cms_url_api_options.e b/draft/application/cms/src/kernel/api/cms_url_api_options.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/api/cms_url_api_options.e
rename to draft/application/cms/src/kernel/api/cms_url_api_options.e
diff --git a/draft/application/cms/src/core/kernel/auth/cms_auth_engine.e b/draft/application/cms/src/kernel/auth/cms_auth_engine.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/auth/cms_auth_engine.e
rename to draft/application/cms/src/kernel/auth/cms_auth_engine.e
diff --git a/draft/application/cms/src/core/kernel/auth/cms_storage_auth_engine.e b/draft/application/cms/src/kernel/auth/cms_storage_auth_engine.e
similarity index 69%
rename from draft/application/cms/src/core/kernel/auth/cms_storage_auth_engine.e
rename to draft/application/cms/src/kernel/auth/cms_storage_auth_engine.e
index 1dc7b0ba..f213f56a 100644
--- a/draft/application/cms/src/core/kernel/auth/cms_storage_auth_engine.e
+++ b/draft/application/cms/src/kernel/auth/cms_storage_auth_engine.e
@@ -26,9 +26,7 @@ feature -- Status
valid_credential (u,p: READABLE_STRING_32): BOOLEAN
do
- if attached storage.user_by_name (u) as l_user then
- Result := attached l_user.encoded_password as l_pass and then l_pass.same_string (storage.encoded_password (p))
- end
+ Result := storage.is_valid_credential (u, p)
end
end
diff --git a/draft/application/cms/src/kernel/cms_css.e b/draft/application/cms/src/kernel/cms_css.e
new file mode 100644
index 00000000..d3cc9ff3
--- /dev/null
+++ b/draft/application/cms/src/kernel/cms_css.e
@@ -0,0 +1,65 @@
+note
+ description: "Summary description for {CMS_CSS}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ CMS_CSS
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make
+ do
+ create items.make (3)
+ end
+
+feature -- Access
+
+ items: ARRAYED_LIST [TUPLE [selectors: ITERABLE [CMS_CSS_SELECTOR]; style: CMS_CSS_STYLE]]
+
+feature -- Conversion
+
+ string: READABLE_STRING_8
+ local
+ s: STRING_8
+ do
+ create s.make (64)
+ append_to (s)
+ Result := s
+ end
+
+ append_to (a_target: STRING_8)
+ local
+ s: STRING_8
+ s_selectors: STRING_8
+ do
+ create s.make (64)
+ create s_selectors.make (10)
+ across
+ items as c
+ loop
+ s_selectors.wipe_out
+ across
+ c.item.selectors as cs
+ loop
+ if not s_selectors.is_empty then
+ s_selectors.append_character (',')
+ end
+ s_selectors.append (cs.item.string)
+ end
+ if not s_selectors.is_empty then
+ a_target.append (s_selectors)
+ a_target.append_character (' ')
+ a_target.append_character ('{')
+ c.item.style.append_text_to (a_target)
+ a_target.append_character ('}')
+ a_target.append_character ('%N')
+ end
+ end
+ end
+
+end
diff --git a/draft/application/cms/src/kernel/cms_css_selector.e b/draft/application/cms/src/kernel/cms_css_selector.e
new file mode 100644
index 00000000..14bc1dcf
--- /dev/null
+++ b/draft/application/cms/src/kernel/cms_css_selector.e
@@ -0,0 +1,24 @@
+note
+ description: "Summary description for {CMS_CSS_SELECTOR}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ CMS_CSS_SELECTOR
+
+create
+ make_from_string
+
+feature {NONE} -- Initialization
+
+ make_from_string (s: READABLE_STRING_8)
+ do
+ string := s
+ end
+
+feature -- Conversion
+
+ string: READABLE_STRING_8
+
+end
diff --git a/draft/application/cms/src/kernel/cms_css_style.e b/draft/application/cms/src/kernel/cms_css_style.e
new file mode 100644
index 00000000..d0bd4c05
--- /dev/null
+++ b/draft/application/cms/src/kernel/cms_css_style.e
@@ -0,0 +1,451 @@
+note
+ description: "Summary description for {CMS_CSS_STYLE}."
+ date: "$Date$"
+ revision: "$Revision$"
+ EIS: "name=CSS reference", "protocol=URI", "src=http://www.w3schools.com/cssref/"
+
+class
+ CMS_CSS_STYLE
+
+inherit
+ ITERABLE [READABLE_STRING_8]
+
+create
+ make,
+ make_with_string,
+ make_with_items
+
+convert
+ make_with_string ({READABLE_STRING_8, STRING_8})
+
+feature {NONE} -- Initialization
+
+ make
+ do
+ make_with_items (create {like items}.make (3))
+ end
+
+ make_with_string (s: READABLE_STRING_8)
+ do
+ make_with_items (s.split (';'))
+ end
+
+ make_with_items (lst: ITERABLE [READABLE_STRING_8])
+ do
+ create items.make (5)
+ across
+ lst as c
+ loop
+ if attached {IMMUTABLE_STRING_8} c.item as imm then
+ items.force (imm)
+ else
+ items.force (create {IMMUTABLE_STRING_8}.make_from_string (c.item))
+ end
+ end
+ end
+
+ items: ARRAYED_LIST [IMMUTABLE_STRING_8]
+
+feature -- Access
+
+ count: INTEGER
+ -- Count of style entities.
+
+ new_cursor: ITERATION_CURSOR [READABLE_STRING_8]
+ do
+ Result := items.new_cursor
+ end
+
+feature -- Element change
+
+ plus alias "+" (a_other: CMS_CSS_STYLE): like Current
+ --
+ local
+ lst: ARRAYED_LIST [READABLE_STRING_8]
+ do
+ create lst.make (count + a_other.count)
+ lst.append (items)
+ across
+ a_other as c
+ loop
+ lst.force (c.item)
+ end
+ create Result.make_with_items (lst)
+ end
+
+ append (a_other: CMS_CSS_STYLE)
+ -- Append style from `a_other' into Current
+ do
+ across
+ a_other as c
+ loop
+ items.force (c.item)
+ end
+ end
+
+feature -- Change
+
+ put_key_value (k,v: READABLE_STRING_8)
+ do
+ items.force (k + ": " + v)
+ end
+
+feature -- Property: colors
+
+ put_color (v: READABLE_STRING_8)
+ do
+ put_key_value ("color", v)
+ end
+
+ put_background (v: READABLE_STRING_8)
+ --| ex: #00ff00 url('smiley.gif') no-repeat fixed center;
+ do
+ put_key_value ("background", v)
+ end
+
+ put_background_color (v: READABLE_STRING_8)
+ do
+ put_key_value ("background-color", v)
+ end
+
+feature -- Property: fonts
+
+ put_font (v: READABLE_STRING_8)
+ do
+ put_key_value ("font", v)
+ end
+
+ put_font_family (v: READABLE_STRING_8)
+ do
+ put_key_value ("font-family", v)
+ end
+
+ put_font_size (v: READABLE_STRING_8)
+ do
+ put_key_value ("font-size", v)
+ end
+
+ put_font_style (v: READABLE_STRING_8)
+ do
+ put_key_value ("font-style", v)
+ end
+
+ put_font_weight (v: READABLE_STRING_8)
+ do
+ put_key_value ("font-weight", v)
+ end
+
+ put_font_bold
+ do
+ put_font_weight ("bold")
+ end
+
+ put_font_italic
+ do
+ put_font_style ("italic")
+ end
+
+ put_text_decoration (v: READABLE_STRING_8)
+ do
+ put_key_value ("text-decoration", v)
+ end
+
+ put_text_decoration_none
+ do
+ put_text_decoration ("none")
+ end
+
+ put_text_decoration_underline
+ do
+ put_text_decoration ("underline")
+ end
+
+ put_text_decoration_strike
+ do
+ put_text_decoration ("strike")
+ end
+
+ put_text_align (v: READABLE_STRING_8)
+ do
+ put_key_value ("text-align", v)
+ end
+
+ put_white_space (v: READABLE_STRING_8)
+ --| normal Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. This is default
+ --| nowrap Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. The text continues on the same line until a
tag is encountered
+ --| pre Whitespace is preserved by the browser. Text will only wrap on line breaks Acts like the tag in HTML
+ --| pre-line Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks
+ --| pre-wrap Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks
+ --| inherit Specifies that the value of the white-space property should be inherited from the parent element
+ do
+ put_key_value ("white-space", v)
+ end
+
+ put_white_space_nowrap
+ do
+ put_white_space ("nowrap")
+ end
+
+ put_white_space_pre
+ do
+ put_white_space ("pre")
+ end
+
+
+feature -- Property: margin
+
+ put_margin (a_top, a_right, a_bottom, a_left: detachable READABLE_STRING_8)
+ local
+ v: STRING
+ do
+ create v.make (10)
+ if a_left /= Void then
+ v.append (a_left)
+ end
+ if not v.is_empty then
+ v.prepend_character (' ')
+ end
+ if a_bottom /= Void then
+ v.prepend (a_bottom)
+ else
+ v.prepend_character ('0')
+ end
+ if not v.is_empty then
+ v.prepend_character (' ')
+ end
+ if a_right /= Void then
+ v.prepend (a_right)
+ else
+ v.prepend_character ('0')
+ end
+ if not v.is_empty then
+ v.prepend_character (' ')
+ end
+ if a_top /= Void then
+ v.prepend (a_top)
+ else
+ v.prepend_character ('0')
+ end
+ put_key_value ("margin", v)
+ end
+
+ put_margin_top (v: READABLE_STRING_8)
+ do
+ put_key_value ("margin-top", v)
+ end
+
+ put_margin_right (v: READABLE_STRING_8)
+ do
+ put_key_value ("margin-right", v)
+ end
+
+ put_margin_bottom (v: READABLE_STRING_8)
+ do
+ put_key_value ("margin-bottom", v)
+ end
+
+ put_margin_left (v: READABLE_STRING_8)
+ do
+ put_key_value ("margin-left", v)
+ end
+
+feature -- Property: padding
+
+ put_padding (a_top, a_right, a_bottom, a_left: detachable READABLE_STRING_8)
+ local
+ v: STRING
+ do
+ create v.make (10)
+ if a_left /= Void then
+ v.append (a_left)
+ end
+ if not v.is_empty then
+ v.prepend_character (' ')
+ end
+ if a_bottom /= Void then
+ v.prepend (a_bottom)
+ else
+ v.prepend_character ('0')
+ end
+ if not v.is_empty then
+ v.prepend_character (' ')
+ end
+ if a_right /= Void then
+ v.prepend (a_right)
+ else
+ v.prepend_character ('0')
+ end
+ if not v.is_empty then
+ v.prepend_character (' ')
+ end
+ if a_top /= Void then
+ v.prepend (a_top)
+ else
+ v.prepend_character ('0')
+ end
+ put_key_value ("padding", v)
+ end
+
+ put_padding_top (v: READABLE_STRING_8)
+ do
+ put_key_value ("padding-top", v)
+ end
+
+ put_padding_right (v: READABLE_STRING_8)
+ do
+ put_key_value ("padding-right", v)
+ end
+
+ put_padding_bottom (v: READABLE_STRING_8)
+ do
+ put_key_value ("padding-bottom", v)
+ end
+
+ put_padding_left (v: READABLE_STRING_8)
+ do
+ put_key_value ("padding-left", v)
+ end
+
+feature -- Properties: layout
+
+ put_width (v: READABLE_STRING_8)
+ do
+ put_key_value ("width", v)
+ end
+
+ put_height (v: READABLE_STRING_8)
+ do
+ put_key_value ("height", v)
+ end
+
+ put_z_index (v: READABLE_STRING_8)
+ do
+ put_key_value ("z-index", v)
+ end
+
+feature -- Property: border
+
+ put_border (a_border: detachable READABLE_STRING_8; a_style: READABLE_STRING_8; a_size: READABLE_STRING_8; a_color: READABLE_STRING_8)
+ -- "solid 1px color"
+ require
+ a_border /= Void implies (a_border.same_string ("top") or a_border.same_string ("right") or a_border.same_string ("bottom") or a_border.same_string ("left"))
+ local
+ k: STRING
+ do
+ k := "border"
+ if a_border /= Void then
+ k.append_character ('-')
+ k.append (a_border)
+ end
+ put_key_value (k, a_style + " " + a_size + " " + a_color)
+ end
+
+ put_border_style (a_style: READABLE_STRING_8)
+ -- "solid 1px color"
+ do
+ put_key_value ("border-style", a_style)
+ end
+
+ put_border_style_none (a_style: READABLE_STRING_8)
+ -- "solid 1px color"
+ do
+ put_border_style ("none")
+ end
+
+feature -- Property: display
+
+ put_display (v: READABLE_STRING_8)
+ do
+ put_key_value ("display", v)
+ end
+
+ put_display_none
+ do
+ put_display ("none")
+ end
+
+ put_display_block
+ do
+ put_display ("block")
+ end
+
+ put_display_inline
+ do
+ put_display ("inline")
+ end
+
+ put_display_inline_block
+ do
+ put_display ("inline-block")
+ end
+
+ put_list_style (v: READABLE_STRING_8)
+ --| ex: list-style:square url("sqpurple.gif");
+ do
+ put_key_value ("list-style", v)
+ end
+
+ put_list_style_type (v: READABLE_STRING_8)
+ --circle The marker is a circle
+ --decimal The marker is a number. This is default for
+ --decimal-leading-zero The marker is a number with leading zeros (01, 02, 03, etc.)
+ --disc The marker is a filled circle. This is default for
+ --lower-alpha The marker is lower-alpha (a, b, c, d, e, etc.)
+ --lower-greek The marker is lower-greek
+ --lower-latin The marker is lower-latin (a, b, c, d, e, etc.)
+ --lower-roman The marker is lower-roman (i, ii, iii, iv, v, etc.)
+ --none No marker is shown
+ --square The marker is a square
+ --upper-alpha The marker is upper-alpha (A, B, C, D, E, etc.)
+ --upper-latin The marker is upper-latin (A, B, C, D, E, etc.)
+ --upper-roman The marker is upper-roman (I, II, III, IV, V, etc.)
+ do
+ put_key_value ("list-style-type", v)
+ end
+
+feature -- Property: float ...
+
+ put_float (v: READABLE_STRING_8)
+ do
+ put_key_value ("float", v)
+ end
+
+ put_clear (v: READABLE_STRING_8)
+ do
+ put_key_value ("clear", v)
+ end
+
+feature -- Conversion
+
+ append_inline_to (s: STRING_8)
+ do
+ append_to (s, False)
+ end
+
+ append_text_to (s: STRING_8)
+ do
+ append_to (s, True)
+ end
+
+ append_to (s: STRING_8; a_multiline: BOOLEAN)
+ local
+ n: INTEGER
+ do
+ n := 0
+ across
+ items as c
+ loop
+ if n > 0 then
+ if a_multiline then
+ s.append_character ('%N')
+ else
+ s.append_character (' ')
+ end
+ end
+ s.append (c.item)
+ s.append_character (';')
+ n := n + 1
+ end
+ end
+
+end
diff --git a/draft/application/cms/src/core/kernel/cms_html_page.e b/draft/application/cms/src/kernel/cms_html_page.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/cms_html_page.e
rename to draft/application/cms/src/kernel/cms_html_page.e
diff --git a/draft/application/cms/src/core/kernel/cms_session_controler.e b/draft/application/cms/src/kernel/cms_session_controler.e
similarity index 90%
rename from draft/application/cms/src/core/kernel/cms_session_controler.e
rename to draft/application/cms/src/kernel/cms_session_controler.e
index 9a7eac2c..9f78ac6f 100644
--- a/draft/application/cms/src/core/kernel/cms_session_controler.e
+++ b/draft/application/cms/src/kernel/cms_session_controler.e
@@ -18,8 +18,9 @@ create
feature -- Initialization
- make (req: WSF_REQUEST; a_mngr: like session_manager)
+ make (req: WSF_REQUEST; a_mngr: like session_manager; a_site_id: READABLE_STRING_8)
do
+ site_id := a_site_id
session_manager := a_mngr
initialize
create discarded_sessions.make
@@ -28,9 +29,13 @@ feature -- Initialization
initialize
do
+ session_id_name := "_EWF_CMS_SESSID__" + site_id
end
-feature -- Session access
+feature -- Session access
+
+ site_id: READABLE_STRING_8
+ -- Associated CMS site id.
session: WSF_SESSION
@@ -129,6 +134,6 @@ feature -- Session internal
session_request_variable_name: STRING = "_EWF_CMS_SESSION_"
- session_id_name: STRING = "_EWF_CMS_SESSID"
+ session_id_name: READABLE_STRING_8
end
diff --git a/draft/application/cms/src/core/kernel/cms_user.e b/draft/application/cms/src/kernel/cms_user.e
similarity index 97%
rename from draft/application/cms/src/core/kernel/cms_user.e
rename to draft/application/cms/src/kernel/cms_user.e
index 182447f8..135d3f04 100644
--- a/draft/application/cms/src/core/kernel/cms_user.e
+++ b/draft/application/cms/src/kernel/cms_user.e
@@ -24,7 +24,7 @@ feature {NONE} -- Initialization
creation_date := dt
name := n
ensure
- valid_password: password = Void and encoded_password /= Void
+ valid_password: password = Void
end
make_new (n: like name)
@@ -46,8 +46,6 @@ feature -- Access
password: detachable READABLE_STRING_32
- encoded_password: detachable READABLE_STRING_8
-
email: detachable READABLE_STRING_8
profile: detachable CMS_USER_PROFILE
@@ -99,11 +97,6 @@ feature -- Element change
password := p
end
- set_encoded_password (p: like encoded_password)
- do
- encoded_password := p
- end
-
set_email (m: like email)
do
email := m
@@ -155,4 +148,13 @@ feature -- Element change
set_last_login_date (create {DATE_TIME}.make_now_utc)
end
+feature {CMS_STORAGE} -- Security
+
+ encoded_password: detachable READABLE_STRING_8
+
+ set_encoded_password (p: like encoded_password)
+ do
+ encoded_password := p
+ end
+
end
diff --git a/draft/application/cms/src/core/kernel/cms_user_profile.e b/draft/application/cms/src/kernel/cms_user_profile.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/cms_user_profile.e
rename to draft/application/cms/src/kernel/cms_user_profile.e
diff --git a/draft/application/cms/src/core/kernel/content/cms_block.e b/draft/application/cms/src/kernel/content/cms_block.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/cms_block.e
rename to draft/application/cms/src/kernel/content/cms_block.e
diff --git a/draft/application/cms/src/core/kernel/content/cms_content_block.e b/draft/application/cms/src/kernel/content/cms_content_block.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/cms_content_block.e
rename to draft/application/cms/src/kernel/content/cms_content_block.e
diff --git a/draft/application/cms/src/core/kernel/content/cms_content_type.e b/draft/application/cms/src/kernel/content/cms_content_type.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/cms_content_type.e
rename to draft/application/cms/src/kernel/content/cms_content_type.e
diff --git a/draft/application/cms/src/core/kernel/content/cms_menu_block.e b/draft/application/cms/src/kernel/content/cms_menu_block.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/cms_menu_block.e
rename to draft/application/cms/src/kernel/content/cms_menu_block.e
diff --git a/draft/application/cms/src/core/kernel/content/cms_node.e b/draft/application/cms/src/kernel/content/cms_node.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/cms_node.e
rename to draft/application/cms/src/kernel/content/cms_node.e
diff --git a/draft/application/cms/src/core/kernel/content/format/cms_filtered_html_format.e b/draft/application/cms/src/kernel/content/format/cms_filtered_html_format.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/cms_filtered_html_format.e
rename to draft/application/cms/src/kernel/content/format/cms_filtered_html_format.e
diff --git a/draft/application/cms/src/core/kernel/content/format/cms_format.e b/draft/application/cms/src/kernel/content/format/cms_format.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/cms_format.e
rename to draft/application/cms/src/kernel/content/format/cms_format.e
diff --git a/draft/application/cms/src/core/kernel/content/format/cms_formats.e b/draft/application/cms/src/kernel/content/format/cms_formats.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/cms_formats.e
rename to draft/application/cms/src/kernel/content/format/cms_formats.e
diff --git a/draft/application/cms/src/core/kernel/content/format/cms_full_html_format.e b/draft/application/cms/src/kernel/content/format/cms_full_html_format.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/cms_full_html_format.e
rename to draft/application/cms/src/kernel/content/format/cms_full_html_format.e
diff --git a/draft/application/cms/src/core/kernel/content/format/cms_plain_text_format.e b/draft/application/cms/src/kernel/content/format/cms_plain_text_format.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/cms_plain_text_format.e
rename to draft/application/cms/src/kernel/content/format/cms_plain_text_format.e
diff --git a/draft/application/cms/src/core/kernel/content/format/filters/cms_filter.e b/draft/application/cms/src/kernel/content/format/filters/cms_filter.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/filters/cms_filter.e
rename to draft/application/cms/src/kernel/content/format/filters/cms_filter.e
diff --git a/draft/application/cms/src/core/kernel/content/format/filters/cms_html_filter.e b/draft/application/cms/src/kernel/content/format/filters/cms_html_filter.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/filters/cms_html_filter.e
rename to draft/application/cms/src/kernel/content/format/filters/cms_html_filter.e
diff --git a/draft/application/cms/src/core/kernel/content/format/filters/cms_html_to_text_filter.e b/draft/application/cms/src/kernel/content/format/filters/cms_html_to_text_filter.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/filters/cms_html_to_text_filter.e
rename to draft/application/cms/src/kernel/content/format/filters/cms_html_to_text_filter.e
diff --git a/draft/application/cms/src/core/kernel/content/format/filters/cms_line_break_converter_filter.e b/draft/application/cms/src/kernel/content/format/filters/cms_line_break_converter_filter.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/filters/cms_line_break_converter_filter.e
rename to draft/application/cms/src/kernel/content/format/filters/cms_line_break_converter_filter.e
diff --git a/draft/application/cms/src/core/kernel/content/format/filters/cms_no_html_filter.e b/draft/application/cms/src/kernel/content/format/filters/cms_no_html_filter.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/filters/cms_no_html_filter.e
rename to draft/application/cms/src/kernel/content/format/filters/cms_no_html_filter.e
diff --git a/draft/application/cms/src/core/kernel/content/format/filters/cms_url_filter.e b/draft/application/cms/src/kernel/content/format/filters/cms_url_filter.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/content/format/filters/cms_url_filter.e
rename to draft/application/cms/src/kernel/content/format/filters/cms_url_filter.e
diff --git a/draft/application/cms/src/kernel/form/cms_form.e b/draft/application/cms/src/kernel/form/cms_form.e
new file mode 100644
index 00000000..988c522d
--- /dev/null
+++ b/draft/application/cms/src/kernel/form/cms_form.e
@@ -0,0 +1,252 @@
+note
+ description: "Summary description for {CMS_FORM}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ CMS_FORM
+
+inherit
+ ITERABLE [CMS_FORM_ITEM]
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make (a_action: READABLE_STRING_8; a_id: READABLE_STRING_8)
+ do
+ action := a_action
+ id := a_id
+
+ create html_classes.make (2)
+ create items.make (10)
+ set_method_post
+ end
+
+feature -- Access
+
+ action: READABLE_STRING_8
+ -- URL for the web form
+
+ id: READABLE_STRING_8
+ -- Id of the form
+
+ count: INTEGER
+ do
+ Result := items.count
+ end
+
+ is_get_method: BOOLEAN
+ do
+ Result := method.same_string ("GET")
+ end
+
+ is_post_method: BOOLEAN
+ do
+ Result := not is_get_method
+ end
+
+ method: READABLE_STRING_8
+ -- Form's method
+ --| GET or POST
+
+feature -- Validation
+
+ validation_action: detachable PROCEDURE [ANY, TUPLE [CMS_FORM_DATA]]
+ -- Procedure to validate the data
+ -- report error if not valid
+
+-- submit_callbacks_actions: HASH_TABLE [PROCEDURE [ANY, TUPLE [CMS_FORM_DATA]], STRING]
+-- -- Submit callbacks indexed by submit names
+
+feature -- Element change
+
+ set_method_get
+ do
+ method := "GET"
+ end
+
+ set_method_post
+ do
+ method := "POST"
+ end
+
+ set_validation_action (act: like validation_action)
+ do
+ validation_action := act
+ end
+
+feature -- Access
+
+ new_cursor: ITERATION_CURSOR [CMS_FORM_ITEM]
+ -- Fresh cursor associated with current structure
+ do
+ Result := items.new_cursor
+ end
+
+feature -- Optional
+
+ html_classes: ARRAYED_LIST [STRING_8]
+
+feature -- Items
+
+ has_field (a_name: READABLE_STRING_GENERAL): BOOLEAN
+ do
+ Result := container_has_field (Current, a_name)
+ end
+
+ fields_by_name (a_name: READABLE_STRING_GENERAL): detachable LIST [CMS_FORM_FIELD]
+ do
+ Result := fields_by_name_from (Current, a_name)
+ end
+
+ items_by_css_id (a_id: READABLE_STRING_GENERAL): detachable LIST [CMS_FORM_ITEM]
+ do
+ Result := items_by_css_id_from (Current, a_id)
+ end
+
+ first_item_by_css_id (a_id: READABLE_STRING_GENERAL): detachable CMS_FORM_ITEM
+ do
+ if attached items_by_css_id_from (Current, a_id) as lst then
+ if not lst.is_empty then
+ Result := lst.first
+ end
+ end
+ end
+
+feature {NONE} -- Implementation: Items
+
+ container_has_field (a_container: ITERABLE [CMS_FORM_ITEM]; a_name: READABLE_STRING_GENERAL): BOOLEAN
+ do
+ across
+ a_container as i
+ until
+ Result
+ loop
+ if attached {CMS_FORM_FIELD} i.item as l_field and then l_field.name.same_string_general (a_name) then
+ Result := True
+ elseif attached {ITERABLE [CMS_FORM_ITEM]} i.item as l_cont then
+ Result := container_has_field (l_cont, a_name)
+ end
+ end
+ end
+
+ fields_by_name_from (a_container: ITERABLE [CMS_FORM_ITEM]; a_name: READABLE_STRING_GENERAL): detachable ARRAYED_LIST [CMS_FORM_FIELD]
+ local
+ res: detachable ARRAYED_LIST [CMS_FORM_FIELD]
+ do
+ across
+ a_container as i
+ loop
+ if attached {CMS_FORM_FIELD} i.item as l_field and then l_field.name.same_string_general (a_name) then
+ if res = Void then
+ create res.make (1)
+ end
+ res.force (l_field)
+ elseif attached {ITERABLE [CMS_FORM_ITEM]} i.item as l_cont then
+ if attached fields_by_name_from (l_cont, a_name) as lst then
+ if res = Void then
+ res := lst
+ else
+ res.append (lst)
+ end
+ end
+ end
+ end
+ Result := res
+ end
+
+ items_by_css_id_from (a_container: ITERABLE [CMS_FORM_ITEM]; a_id: READABLE_STRING_GENERAL): detachable ARRAYED_LIST [CMS_FORM_ITEM]
+ local
+ res: detachable ARRAYED_LIST [CMS_FORM_ITEM]
+ do
+ across
+ a_container as i
+ loop
+ if
+ attached {WITH_CSS_ID} i.item as l_with_css_id and then
+ attached l_with_css_id.css_id as l_css_id and then
+ l_css_id.same_string_general (a_id)
+ then
+ if res = Void then
+ create res.make (1)
+ end
+ res.force (i.item)
+ elseif attached {ITERABLE [CMS_FORM_ITEM]} i.item as l_cont then
+ if attached items_by_css_id_from (l_cont, a_id) as lst then
+ if res = Void then
+ res := lst
+ else
+ res.append (lst)
+ end
+ end
+ end
+ end
+ Result := res
+ end
+
+feature -- Change
+
+ extend (i: CMS_FORM_ITEM)
+ local
+ n: READABLE_STRING_8
+ do
+ if attached {CMS_FORM_FIELD} i as l_field then
+ n := l_field.name
+ if n.is_empty then
+ n := (items.count + 1).out
+ l_field.update_name (n)
+ end
+ end
+ items.force (i)
+ end
+
+ extend_text (t: READABLE_STRING_8)
+ do
+ extend (create {CMS_FORM_RAW_TEXT}.make (t))
+ end
+
+feature -- Conversion
+
+ append_to_html (a_theme: CMS_THEME; a_html: STRING_8)
+ local
+ s: STRING_8
+ do
+ a_html.append ("
%N")
+ end
+
+ to_html (a_theme: CMS_THEME): STRING_8
+ do
+ create Result.make_empty
+ append_to_html (a_theme, Result)
+ end
+
+feature {NONE} -- Implementation
+
+ items: ARRAYED_LIST [CMS_FORM_ITEM]
+ -- name => item
+
+invariant
+
+end
diff --git a/draft/application/cms/src/core/kernel/form/cms_form_button_input.e b/draft/application/cms/src/kernel/form/cms_form_button_input.e
similarity index 100%
rename from draft/application/cms/src/core/kernel/form/cms_form_button_input.e
rename to draft/application/cms/src/kernel/form/cms_form_button_input.e
diff --git a/draft/application/cms/src/kernel/form/cms_form_checkbox_input.e b/draft/application/cms/src/kernel/form/cms_form_checkbox_input.e
new file mode 100644
index 00000000..83ba26ea
--- /dev/null
+++ b/draft/application/cms/src/kernel/form/cms_form_checkbox_input.e
@@ -0,0 +1,110 @@
+note
+ description: "Summary description for {CMS_FORM_CHECKBOX_INPUT}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ CMS_FORM_CHECKBOX_INPUT
+
+inherit
+ CMS_FORM_INPUT
+ rename
+ default_value as value
+ redefine
+ set_value,
+ specific_input_attributes_string,
+ append_child_to_html
+ end
+
+ CMS_FORM_SELECTABLE_ITEM
+ rename
+ is_selected as checked,
+ set_is_selected as set_checked
+ end
+
+create
+ make,
+ make_with_text
+
+feature -- Access
+
+ checked: BOOLEAN
+ -- Current element should be preselected when the page loads
+
+ input_type: STRING = "checkbox"
+
+ text: detachable READABLE_STRING_32
+
+ raw_text: detachable READABLE_STRING_8
+
+feature -- Status report
+
+ is_same_value (v: READABLE_STRING_32): BOOLEAN
+ do
+ Result := attached value as l_value and then v.same_string (l_value)
+ end
+
+feature -- Change
+
+ set_text (t: detachable READABLE_STRING_32)
+ do
+ text := t
+ end
+
+ set_raw_text (t: detachable READABLE_STRING_8)
+ do
+ raw_text := t
+ end
+
+ set_checked (b: like checked)
+ do
+ checked := b
+ end
+
+ set_value (v: detachable WSF_VALUE)
+ -- Set value `v' if applicable to Current
+ do
+ if attached {ITERABLE [WSF_VALUE]} v as lst then
+ across
+ lst as c
+ loop
+ if
+ attached {WSF_STRING} c.item as s and then
+ is_same_value (s.value)
+ then
+ set_checked (True)
+ end
+ end
+ else
+ Precursor (v)
+ end
+ end
+
+feature {NONE} -- Implementation
+
+ append_child_to_html (a_theme: CMS_THEME; a_html: STRING_8)
+ -- Specific child element if any.
+ --| To redefine if needed
+ do
+ if attached raw_text as t then
+ a_html.append (t)
+ elseif attached text as t then
+ a_html.append (a_theme.html_encoded (t))
+ elseif attached value as v then
+ a_html.append (a_theme.html_encoded (v))
+ end
+ end
+
+ specific_input_attributes_string: detachable STRING_8
+ -- Specific input attributes if any.
+ -- To redefine if needed
+ do
+ if checked then
+ Result := "checked=%"checked%""
+ end
+ end
+
+invariant
+
+end
diff --git a/draft/application/cms/src/core/kernel/form/cms_form_data.e b/draft/application/cms/src/kernel/form/cms_form_data.e
similarity index 59%
rename from draft/application/cms/src/core/kernel/form/cms_form_data.e
rename to draft/application/cms/src/kernel/form/cms_form_data.e
index cf6ebdf2..79896b8e 100644
--- a/draft/application/cms/src/core/kernel/form/cms_form_data.e
+++ b/draft/application/cms/src/kernel/form/cms_form_data.e
@@ -49,6 +49,12 @@ feature -- Access
end
end
+-- table_item (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
+-- do
+-- FIXME
+-- Result := items.item (a_name.as_string_8 + "[]")
+-- end
+
integer_item (a_name: READABLE_STRING_GENERAL): INTEGER
do
if attached {WSF_STRING} item (a_name) as s and then s.is_integer then
@@ -108,14 +114,28 @@ feature -- Basic operation
across
form as i
loop
- if attached {CMS_FORM_FIELD} i.item as l_field then
- if not attached {CMS_FORM_SUBMIT_INPUT} l_field then
- if l_field.name.same_string (c.key) then
- l_field.set_value (c.item)
- end
- end
+ apply_to_associated_form_item (c.key, c.item, i.item)
+ end
+ end
+ end
+
+feature {NONE} -- Implementation: apply
+
+ apply_to_associated_form_item (a_name: READABLE_STRING_8; a_value: detachable WSF_VALUE; i: CMS_FORM_ITEM)
+ local
+ do
+ if attached {CMS_FORM_FIELD} i as l_field then
+ if not attached {CMS_FORM_SUBMIT_INPUT} l_field then
+ if l_field.name.same_string (a_name) then
+ l_field.set_value (a_value)
end
end
+ elseif attached {ITERABLE [CMS_FORM_ITEM]} i as l_set then
+ across
+ l_set as c
+ loop
+ apply_to_associated_form_item (a_name, a_value, c.item)
+ end
end
end
@@ -151,27 +171,68 @@ feature {NONE} -- Implementation
end
get_form_items (req: WSF_REQUEST; lst: ITERABLE [CMS_FORM_ITEM])
- local
- n: READABLE_STRING_8
- v: detachable WSF_VALUE
do
across
lst as c
loop
if attached {CMS_FORM_FIELD} c.item as l_field then
- n := l_field.name
- v := req.form_parameter (n)
- if l_field.is_required and (v = Void or else v.is_empty) then
- add_error (l_field, "Field %"" + l_field.name + "%" is required")
- else
- items.force (v, n)
- end
- elseif attached {CMS_FORM_FIELD_SET} c.item as l_fieldset then
- get_form_items (req, l_fieldset)
+ get_form_field_item (req, l_field, l_field.name)
+ elseif attached {ITERABLE [CMS_FORM_ITEM]} c.item as l_set then
+ get_form_items (req, l_set)
end
end
end
+ get_form_field_item (req: WSF_REQUEST; i: CMS_FORM_FIELD; n: READABLE_STRING_8)
+ local
+ v: detachable WSF_VALUE
+-- tb: detachable WSF_TABLE
+ do
+ if form.is_post_method then
+ v := req.form_parameter (n)
+ else
+ v := req.query_parameter (n)
+ end
+ if v = Void and then n.ends_with_general ("[]") then
+ if form.is_post_method then
+ v := req.form_parameter (n.substring (1, n.count - 2))
+ else
+ v := req.query_parameter (n.substring (1, n.count - 2))
+ end
+ end
+ if i.is_required and (v = Void or else v.is_empty) then
+ add_error (i, "Field %"" + n + "%" is required")
+ else
+-- if attached {WSF_TABLE} v then
+-- -- `v' overwrite any previous values if any
+-- -- since it is already a WSF_TABLE
+-- else
+-- attached items.item (n) as ov then
+-- if attached {WSF_TABLE} ov as vtb then
+-- tb := vtb
+-- elseif attached {WSF_MULTIPLE_STRING} ov as vm then
+-- if tb = Void then
+-- create tb.make (n)
+-- end
+-- across
+-- vm as c
+-- loop
+-- tb.add_value (c.item, (tb.count + 1).out)
+-- end
+-- else
+-- create tb.make (n)
+---- create v_multi.make_with_value (ov)
+-- end
+-- if v /= Void then
+-- tb.add_value (v, (tb.count + 1).out)
+---- v_multi.add_value (v)
+-- end
+-- v := tb
+-- end
+ items.force (v, n)
+ end
+ end
+
add_error (a_field: detachable CMS_FORM_FIELD; a_msg: detachable READABLE_STRING_8)
local
err: like errors
diff --git a/draft/application/cms/src/core/kernel/form/cms_form_field_set.e b/draft/application/cms/src/kernel/form/cms_form_div.e
similarity index 50%
rename from draft/application/cms/src/core/kernel/form/cms_form_field_set.e
rename to draft/application/cms/src/kernel/form/cms_form_div.e
index 9b3588b7..65dec274 100644
--- a/draft/application/cms/src/core/kernel/form/cms_form_field_set.e
+++ b/draft/application/cms/src/kernel/form/cms_form_div.e
@@ -5,15 +5,20 @@ note
revision : "$Revision$"
class
- CMS_FORM_FIELD_SET
+ CMS_FORM_DIV
inherit
CMS_FORM_ITEM
ITERABLE [CMS_FORM_ITEM]
+ WITH_CSS_ID
+
create
- make
+ make,
+ make_with_item,
+ make_with_items,
+ make_with_text
feature {NONE} -- Initialization
@@ -23,9 +28,26 @@ feature {NONE} -- Initialization
create items.make (0)
end
-feature -- Access
+ make_with_text (s: READABLE_STRING_8)
+ do
+ make_with_item (create {CMS_FORM_RAW_TEXT}.make (s))
+ end
- legend: detachable READABLE_STRING_8
+ make_with_item (i: CMS_FORM_ITEM)
+ do
+ create items.make (1)
+ extend (i)
+ end
+
+ make_with_items (it: ITERABLE [CMS_FORM_ITEM])
+ do
+ create items.make (2)
+ across
+ it as c
+ loop
+ extend (c.item)
+ end
+ end
feature -- Access
@@ -37,11 +59,6 @@ feature -- Access
feature -- Change
- set_legend (v: like legend)
- do
- legend := v
- end
-
extend (i: CMS_FORM_ITEM)
do
items.force (i)
@@ -49,18 +66,20 @@ feature -- Change
feature -- Conversion
- to_html (a_theme: CMS_THEME): STRING_8
+ append_to_html (a_theme: CMS_THEME; a_html: STRING_8)
do
- Result := "