author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
171 files changed, 15003 insertions, 2237 deletions
diff --git a/frontend/gamma/js/Bookmarklet.js b/frontend/gamma/js/Bookmarklet.js index bcdcc46..9e74ae9 100644 --- a/frontend/gamma/js/Bookmarklet.js +++ b/frontend/gamma/js/Bookmarklet.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | clipperz_copiedContentToClipboard = false; | 24 | clipperz_copiedContentToClipboard = false; |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | // Simple Set Clipboard System | 28 | // Simple Set Clipboard System |
diff --git a/frontend/gamma/js/BookmarkletHash.js b/frontend/gamma/js/BookmarkletHash.js index c3039f5..11b472f 100644 --- a/frontend/gamma/js/BookmarkletHash.js +++ b/frontend/gamma/js/BookmarkletHash.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //18f820faffcdb5e847d4c5d5c4a1de6743baa1a0 | 24 | //18f820faffcdb5e847d4c5d5c4a1de6743baa1a0 |
27 | //9b30434c73fb009b15fecaa904b44f9ced807577 | 25 | //9b30434c73fb009b15fecaa904b44f9ced807577 |
28 | //9b30434c73fb009b15fecaa904b44f9ced807577 | 26 | //9b30434c73fb009b15fecaa904b44f9ced807577 |
29 | varxh; | 27 | varxh; |
30 | vardocumentText; | 28 | vardocumentText; |
diff --git a/frontend/gamma/js/Bookmarklet_1.js b/frontend/gamma/js/Bookmarklet_1.js index c7c7ae6..89b83b1 100644 --- a/frontend/gamma/js/Bookmarklet_1.js +++ b/frontend/gamma/js/Bookmarklet_1.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | _cble = null; | 24 | _cble = null; |
27 | 25 | ||
28 | //----------------------------------------------------------------------------- | 26 | //----------------------------------------------------------------------------- |
29 | 27 | ||
30 | isLoginForm = function(aForm) { | 28 | isLoginForm = function(aForm) { |
diff --git a/frontend/gamma/js/Bookmarklet_2.js b/frontend/gamma/js/Bookmarklet_2.js index 02f7de8..de1bbfa 100644 --- a/frontend/gamma/js/Bookmarklet_2.js +++ b/frontend/gamma/js/Bookmarklet_2.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | clipperz_copiedContentToClipboard = false; | 24 | clipperz_copiedContentToClipboard = false; |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | // Simple Set Clipboard System | 28 | // Simple Set Clipboard System |
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-affix.js b/frontend/gamma/js/Bootstrap/bootstrap-affix.js new file mode 100644 index 0000000..052ecad --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-affix.js | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ========================================================== | ||
25 | * bootstrap-affix.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#affix | ||
27 | * ========================================================== | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ========================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* AFFIX CLASS DEFINITION | ||
50 | * ====================== */ | ||
51 | |||
52 | var Affix = function (element, options) { | ||
53 | this.options = $.extend({}, $.fn.affix.defaults, options) | ||
54 | this.$window = $(window) | ||
55 | .on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) | ||
56 | .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this)) | ||
57 | this.$element = $(element) | ||
58 | this.checkPosition() | ||
59 | } | ||
60 | |||
61 | Affix.prototype.checkPosition = function () { | ||
62 | if (!this.$element.is(':visible')) return | ||
63 | |||
64 | var scrollHeight = $(document).height() | ||
65 | , scrollTop = this.$window.scrollTop() | ||
66 | , position = this.$element.offset() | ||
67 | , offset = this.options.offset | ||
68 | , offsetBottom = offset.bottom | ||
69 | , offsetTop = offset.top | ||
70 | , reset = 'affix affix-top affix-bottom' | ||
71 | , affix | ||
72 | |||
73 | if (typeof offset != 'object') offsetBottom = offsetTop = offset | ||
74 | if (typeof offsetTop == 'function') offsetTop = offset.top() | ||
75 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() | ||
76 | |||
77 | affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? | ||
78 | false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? | ||
79 | 'bottom' : offsetTop != null && scrollTop <= offsetTop ? | ||
80 | 'top' : false | ||
81 | |||
82 | if (this.affixed === affix) return | ||
83 | |||
84 | this.affixed = affix | ||
85 | this.unpin = affix == 'bottom' ? position.top - scrollTop : null | ||
86 | |||
87 | this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : '')) | ||
88 | } | ||
89 | |||
90 | |||
91 | /* AFFIX PLUGIN DEFINITION | ||
92 | * ======================= */ | ||
93 | |||
94 | var old = $.fn.affix | ||
95 | |||
96 | $.fn.affix = function (option) { | ||
97 | return this.each(function () { | ||
98 | var $this = $(this) | ||
99 | , data = $this.data('affix') | ||
100 | , options = typeof option == 'object' && option | ||
101 | if (!data) $this.data('affix', (data = new Affix(this, options))) | ||
102 | if (typeof option == 'string') data[option]() | ||
103 | }) | ||
104 | } | ||
105 | |||
106 | $.fn.affix.Constructor = Affix | ||
107 | |||
108 | $.fn.affix.defaults = { | ||
109 | offset: 0 | ||
110 | } | ||
111 | |||
112 | |||
113 | /* AFFIX NO CONFLICT | ||
114 | * ================= */ | ||
115 | |||
116 | $.fn.affix.noConflict = function () { | ||
117 | $.fn.affix = old | ||
118 | return this | ||
119 | } | ||
120 | |||
121 | |||
122 | /* AFFIX DATA-API | ||
123 | * ============== */ | ||
124 | |||
125 | $(window).on('load', function () { | ||
126 | $('[data-spy="affix"]').each(function () { | ||
127 | var $spy = $(this) | ||
128 | , data = $spy.data() | ||
129 | |||
130 | data.offset = data.offset || {} | ||
131 | |||
132 | data.offsetBottom && (data.offset.bottom = data.offsetBottom) | ||
133 | data.offsetTop && (data.offset.top = data.offsetTop) | ||
134 | |||
135 | $spy.affix(data) | ||
136 | }) | ||
137 | }) | ||
138 | |||
139 | |||
140 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-alert.js b/frontend/gamma/js/Bootstrap/bootstrap-alert.js new file mode 100644 index 0000000..63028f2 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-alert.js | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ========================================================== | ||
25 | * bootstrap-alert.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#alerts | ||
27 | * ========================================================== | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ========================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* ALERT CLASS DEFINITION | ||
50 | * ====================== */ | ||
51 | |||
52 | var dismiss = '[data-dismiss="alert"]' | ||
53 | , Alert = function (el) { | ||
54 | $(el).on('click', dismiss, this.close) | ||
55 | } | ||
56 | |||
57 | Alert.prototype.close = function (e) { | ||
58 | var $this = $(this) | ||
59 | , selector = $this.attr('data-target') | ||
60 | , $parent | ||
61 | |||
62 | if (!selector) { | ||
63 | selector = $this.attr('href') | ||
64 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
65 | } | ||
66 | |||
67 | $parent = $(selector) | ||
68 | |||
69 | e && e.preventDefault() | ||
70 | |||
71 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) | ||
72 | |||
73 | $parent.trigger(e = $.Event('close')) | ||
74 | |||
75 | if (e.isDefaultPrevented()) return | ||
76 | |||
77 | $parent.removeClass('in') | ||
78 | |||
79 | function removeElement() { | ||
80 | $parent | ||
81 | .trigger('closed') | ||
82 | .remove() | ||
83 | } | ||
84 | |||
85 | $.support.transition && $parent.hasClass('fade') ? | ||
86 | $parent.on($.support.transition.end, removeElement) : | ||
87 | removeElement() | ||
88 | } | ||
89 | |||
90 | |||
91 | /* ALERT PLUGIN DEFINITION | ||
92 | * ======================= */ | ||
93 | |||
94 | var old = $.fn.alert | ||
95 | |||
96 | $.fn.alert = function (option) { | ||
97 | return this.each(function () { | ||
98 | var $this = $(this) | ||
99 | , data = $this.data('alert') | ||
100 | if (!data) $this.data('alert', (data = new Alert(this))) | ||
101 | if (typeof option == 'string') data[option].call($this) | ||
102 | }) | ||
103 | } | ||
104 | |||
105 | $.fn.alert.Constructor = Alert | ||
106 | |||
107 | |||
108 | /* ALERT NO CONFLICT | ||
109 | * ================= */ | ||
110 | |||
111 | $.fn.alert.noConflict = function () { | ||
112 | $.fn.alert = old | ||
113 | return this | ||
114 | } | ||
115 | |||
116 | |||
117 | /* ALERT DATA-API | ||
118 | * ============== */ | ||
119 | |||
120 | $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) | ||
121 | |||
122 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-button.js b/frontend/gamma/js/Bootstrap/bootstrap-button.js new file mode 100644 index 0000000..2c1226e --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-button.js | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ============================================================ | ||
25 | * bootstrap-button.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#buttons | ||
27 | * ============================================================ | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ============================================================ */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* BUTTON PUBLIC CLASS DEFINITION | ||
50 | * ============================== */ | ||
51 | |||
52 | var Button = function (element, options) { | ||
53 | this.$element = $(element) | ||
54 | this.options = $.extend({}, $.fn.button.defaults, options) | ||
55 | } | ||
56 | |||
57 | Button.prototype.setState = function (state) { | ||
58 | var d = 'disabled' | ||
59 | , $el = this.$element | ||
60 | , data = $el.data() | ||
61 | , val = $el.is('input') ? 'val' : 'html' | ||
62 | |||
63 | state = state + 'Text' | ||
64 | data.resetText || $el.data('resetText', $el[val]()) | ||
65 | |||
66 | $el[val](data[state] || this.options[state]) | ||
67 | |||
68 | // push to event loop to allow forms to submit | ||
69 | setTimeout(function () { | ||
70 | state == 'loadingText' ? | ||
71 | $el.addClass(d).attr(d, d) : | ||
72 | $el.removeClass(d).removeAttr(d) | ||
73 | }, 0) | ||
74 | } | ||
75 | |||
76 | Button.prototype.toggle = function () { | ||
77 | var $parent = this.$element.closest('[data-toggle="buttons-radio"]') | ||
78 | |||
79 | $parent && $parent | ||
80 | .find('.active') | ||
81 | .removeClass('active') | ||
82 | |||
83 | this.$element.toggleClass('active') | ||
84 | } | ||
85 | |||
86 | |||
87 | /* BUTTON PLUGIN DEFINITION | ||
88 | * ======================== */ | ||
89 | |||
90 | var old = $.fn.button | ||
91 | |||
92 | $.fn.button = function (option) { | ||
93 | return this.each(function () { | ||
94 | var $this = $(this) | ||
95 | , data = $this.data('button') | ||
96 | , options = typeof option == 'object' && option | ||
97 | if (!data) $this.data('button', (data = new Button(this, options))) | ||
98 | if (option == 'toggle') data.toggle() | ||
99 | else if (option) data.setState(option) | ||
100 | }) | ||
101 | } | ||
102 | |||
103 | $.fn.button.defaults = { | ||
104 | loadingText: 'loading...' | ||
105 | } | ||
106 | |||
107 | $.fn.button.Constructor = Button | ||
108 | |||
109 | |||
110 | /* BUTTON NO CONFLICT | ||
111 | * ================== */ | ||
112 | |||
113 | $.fn.button.noConflict = function () { | ||
114 | $.fn.button = old | ||
115 | return this | ||
116 | } | ||
117 | |||
118 | |||
119 | /* BUTTON DATA-API | ||
120 | * =============== */ | ||
121 | |||
122 | $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { | ||
123 | var $btn = $(e.target) | ||
124 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') | ||
125 | $btn.button('toggle') | ||
126 | }) | ||
127 | |||
128 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-carousel.js b/frontend/gamma/js/Bootstrap/bootstrap-carousel.js new file mode 100644 index 0000000..e127bc7 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-carousel.js | |||
@@ -0,0 +1,208 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ========================================================== | ||
25 | * bootstrap-carousel.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#carousel | ||
27 | * ========================================================== | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ========================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* CAROUSEL CLASS DEFINITION | ||
50 | * ========================= */ | ||
51 | |||
52 | var Carousel = function (element, options) { | ||
53 | this.$element = $(element) | ||
54 | this.options = options | ||
55 | this.options.pause == 'hover' && this.$element | ||
56 | .on('mouseenter', $.proxy(this.pause, this)) | ||
57 | .on('mouseleave', $.proxy(this.cycle, this)) | ||
58 | } | ||
59 | |||
60 | Carousel.prototype = { | ||
61 | |||
62 | cycle: function (e) { | ||
63 | if (!e) this.paused = false | ||
64 | this.options.interval | ||
65 | && !this.paused | ||
66 | && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) | ||
67 | return this | ||
68 | } | ||
69 | |||
70 | , to: function (pos) { | ||
71 | var $active = this.$element.find('.item.active') | ||
72 | , children = $active.parent().children() | ||
73 | , activePos = children.index($active) | ||
74 | , that = this | ||
75 | |||
76 | if (pos > (children.length - 1) || pos < 0) return | ||
77 | |||
78 | if (this.sliding) { | ||
79 | return this.$element.one('slid', function () { | ||
80 | that.to(pos) | ||
81 | }) | ||
82 | } | ||
83 | |||
84 | if (activePos == pos) { | ||
85 | return this.pause().cycle() | ||
86 | } | ||
87 | |||
88 | return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) | ||
89 | } | ||
90 | |||
91 | , pause: function (e) { | ||
92 | if (!e) this.paused = true | ||
93 | if (this.$element.find('.next, .prev').length && $.support.transition.end) { | ||
94 | this.$element.trigger($.support.transition.end) | ||
95 | this.cycle() | ||
96 | } | ||
97 | clearInterval(this.interval) | ||
98 | this.interval = null | ||
99 | return this | ||
100 | } | ||
101 | |||
102 | , next: function () { | ||
103 | if (this.sliding) return | ||
104 | return this.slide('next') | ||
105 | } | ||
106 | |||
107 | , prev: function () { | ||
108 | if (this.sliding) return | ||
109 | return this.slide('prev') | ||
110 | } | ||
111 | |||
112 | , slide: function (type, next) { | ||
113 | var $active = this.$element.find('.item.active') | ||
114 | , $next = next || $active[type]() | ||
115 | , isCycling = this.interval | ||
116 | , direction = type == 'next' ? 'left' : 'right' | ||
117 | , fallback = type == 'next' ? 'first' : 'last' | ||
118 | , that = this | ||
119 | , e | ||
120 | |||
121 | this.sliding = true | ||
122 | |||
123 | isCycling && this.pause() | ||
124 | |||
125 | $next = $next.length ? $next : this.$element.find('.item')[fallback]() | ||
126 | |||
127 | e = $.Event('slide', { | ||
128 | relatedTarget: $next[0] | ||
129 | }) | ||
130 | |||
131 | if ($next.hasClass('active')) return | ||
132 | |||
133 | if ($.support.transition && this.$element.hasClass('slide')) { | ||
134 | this.$element.trigger(e) | ||
135 | if (e.isDefaultPrevented()) return | ||
136 | $next.addClass(type) | ||
137 | $next[0].offsetWidth // force reflow | ||
138 | $active.addClass(direction) | ||
139 | $next.addClass(direction) | ||
140 | this.$element.one($.support.transition.end, function () { | ||
141 | $next.removeClass([type, direction].join(' ')).addClass('active') | ||
142 | $active.removeClass(['active', direction].join(' ')) | ||
143 | that.sliding = false | ||
144 | setTimeout(function () { that.$element.trigger('slid') }, 0) | ||
145 | }) | ||
146 | } else { | ||
147 | this.$element.trigger(e) | ||
148 | if (e.isDefaultPrevented()) return | ||
149 | $active.removeClass('active') | ||
150 | $next.addClass('active') | ||
151 | this.sliding = false | ||
152 | this.$element.trigger('slid') | ||
153 | } | ||
154 | |||
155 | isCycling && this.cycle() | ||
156 | |||
157 | return this | ||
158 | } | ||
159 | |||
160 | } | ||
161 | |||
162 | |||
163 | /* CAROUSEL PLUGIN DEFINITION | ||
164 | * ========================== */ | ||
165 | |||
166 | var old = $.fn.carousel | ||
167 | |||
168 | $.fn.carousel = function (option) { | ||
169 | return this.each(function () { | ||
170 | var $this = $(this) | ||
171 | , data = $this.data('carousel') | ||
172 | , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) | ||
173 | , action = typeof option == 'string' ? option : options.slide | ||
174 | if (!data) $this.data('carousel', (data = new Carousel(this, options))) | ||
175 | if (typeof option == 'number') data.to(option) | ||
176 | else if (action) data[action]() | ||
177 | else if (options.interval) data.cycle() | ||
178 | }) | ||
179 | } | ||
180 | |||
181 | $.fn.carousel.defaults = { | ||
182 | interval: 5000 | ||
183 | , pause: 'hover' | ||
184 | } | ||
185 | |||
186 | $.fn.carousel.Constructor = Carousel | ||
187 | |||
188 | |||
189 | /* CAROUSEL NO CONFLICT | ||
190 | * ==================== */ | ||
191 | |||
192 | $.fn.carousel.noConflict = function () { | ||
193 | $.fn.carousel = old | ||
194 | return this | ||
195 | } | ||
196 | |||
197 | /* CAROUSEL DATA-API | ||
198 | * ================= */ | ||
199 | |||
200 | $(document).on('click.carousel.data-api', '[data-slide]', function (e) { | ||
201 | var $this = $(this), href | ||
202 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 | ||
203 | , options = $.extend({}, $target.data(), $this.data()) | ||
204 | $target.carousel(options) | ||
205 | e.preventDefault() | ||
206 | }) | ||
207 | |||
208 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-collapse.js b/frontend/gamma/js/Bootstrap/bootstrap-collapse.js new file mode 100644 index 0000000..31b7168 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-collapse.js | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ============================================================= | ||
25 | * bootstrap-collapse.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#collapse | ||
27 | * ============================================================= | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ============================================================ */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* COLLAPSE PUBLIC CLASS DEFINITION | ||
50 | * ================================ */ | ||
51 | |||
52 | var Collapse = function (element, options) { | ||
53 | this.$element = $(element) | ||
54 | this.options = $.extend({}, $.fn.collapse.defaults, options) | ||
55 | |||
56 | if (this.options.parent) { | ||
57 | this.$parent = $(this.options.parent) | ||
58 | } | ||
59 | |||
60 | this.options.toggle && this.toggle() | ||
61 | } | ||
62 | |||
63 | Collapse.prototype = { | ||
64 | |||
65 | constructor: Collapse | ||
66 | |||
67 | , dimension: function () { | ||
68 | var hasWidth = this.$element.hasClass('width') | ||
69 | return hasWidth ? 'width' : 'height' | ||
70 | } | ||
71 | |||
72 | , show: function () { | ||
73 | var dimension | ||
74 | , scroll | ||
75 | , actives | ||
76 | , hasData | ||
77 | |||
78 | if (this.transitioning) return | ||
79 | |||
80 | dimension = this.dimension() | ||
81 | scroll = $.camelCase(['scroll', dimension].join('-')) | ||
82 | actives = this.$parent && this.$parent.find('> .accordion-group > .in') | ||
83 | |||
84 | if (actives && actives.length) { | ||
85 | hasData = actives.data('collapse') | ||
86 | if (hasData && hasData.transitioning) return | ||
87 | actives.collapse('hide') | ||
88 | hasData || actives.data('collapse', null) | ||
89 | } | ||
90 | |||
91 | this.$element[dimension](0) | ||
92 | this.transition('addClass', $.Event('show'), 'shown') | ||
93 | $.support.transition && this.$element[dimension](this.$element[0][scroll]) | ||
94 | } | ||
95 | |||
96 | , hide: function () { | ||
97 | var dimension | ||
98 | if (this.transitioning) return | ||
99 | dimension = this.dimension() | ||
100 | this.reset(this.$element[dimension]()) | ||
101 | this.transition('removeClass', $.Event('hide'), 'hidden') | ||
102 | this.$element[dimension](0) | ||
103 | } | ||
104 | |||
105 | , reset: function (size) { | ||
106 | var dimension = this.dimension() | ||
107 | |||
108 | this.$element | ||
109 | .removeClass('collapse') | ||
110 | [dimension](size || 'auto') | ||
111 | [0].offsetWidth | ||
112 | |||
113 | this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') | ||
114 | |||
115 | return this | ||
116 | } | ||
117 | |||
118 | , transition: function (method, startEvent, completeEvent) { | ||
119 | var that = this | ||
120 | , complete = function () { | ||
121 | if (startEvent.type == 'show') that.reset() | ||
122 | that.transitioning = 0 | ||
123 | that.$element.trigger(completeEvent) | ||
124 | } | ||
125 | |||
126 | this.$element.trigger(startEvent) | ||
127 | |||
128 | if (startEvent.isDefaultPrevented()) return | ||
129 | |||
130 | this.transitioning = 1 | ||
131 | |||
132 | this.$element[method]('in') | ||
133 | |||
134 | $.support.transition && this.$element.hasClass('collapse') ? | ||
135 | this.$element.one($.support.transition.end, complete) : | ||
136 | complete() | ||
137 | } | ||
138 | |||
139 | , toggle: function () { | ||
140 | this[this.$element.hasClass('in') ? 'hide' : 'show']() | ||
141 | } | ||
142 | |||
143 | } | ||
144 | |||
145 | |||
146 | /* COLLAPSE PLUGIN DEFINITION | ||
147 | * ========================== */ | ||
148 | |||
149 | var old = $.fn.collapse | ||
150 | |||
151 | $.fn.collapse = function (option) { | ||
152 | return this.each(function () { | ||
153 | var $this = $(this) | ||
154 | , data = $this.data('collapse') | ||
155 | , options = typeof option == 'object' && option | ||
156 | if (!data) $this.data('collapse', (data = new Collapse(this, options))) | ||
157 | if (typeof option == 'string') data[option]() | ||
158 | }) | ||
159 | } | ||
160 | |||
161 | $.fn.collapse.defaults = { | ||
162 | toggle: true | ||
163 | } | ||
164 | |||
165 | $.fn.collapse.Constructor = Collapse | ||
166 | |||
167 | |||
168 | /* COLLAPSE NO CONFLICT | ||
169 | * ==================== */ | ||
170 | |||
171 | $.fn.collapse.noConflict = function () { | ||
172 | $.fn.collapse = old | ||
173 | return this | ||
174 | } | ||
175 | |||
176 | |||
177 | /* COLLAPSE DATA-API | ||
178 | * ================= */ | ||
179 | |||
180 | $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { | ||
181 | var $this = $(this), href | ||
182 | , target = $this.attr('data-target') | ||
183 | || e.preventDefault() | ||
184 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 | ||
185 | , option = $(target).data('collapse') ? 'toggle' : $this.data() | ||
186 | $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') | ||
187 | $(target).collapse(option) | ||
188 | }) | ||
189 | |||
190 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-dropdown.js b/frontend/gamma/js/Bootstrap/bootstrap-dropdown.js new file mode 100644 index 0000000..3b77bb3 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-dropdown.js | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ============================================================ | ||
25 | * bootstrap-dropdown.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns | ||
27 | * ============================================================ | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ============================================================ */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* DROPDOWN CLASS DEFINITION | ||
50 | * ========================= */ | ||
51 | |||
52 | var toggle = '[data-toggle=dropdown]' | ||
53 | , Dropdown = function (element) { | ||
54 | var $el = $(element).on('click.dropdown.data-api', this.toggle) | ||
55 | $('html').on('click.dropdown.data-api', function () { | ||
56 | $el.parent().removeClass('open') | ||
57 | }) | ||
58 | } | ||
59 | |||
60 | Dropdown.prototype = { | ||
61 | |||
62 | constructor: Dropdown | ||
63 | |||
64 | , toggle: function (e) { | ||
65 | var $this = $(this) | ||
66 | , $parent | ||
67 | , isActive | ||
68 | |||
69 | if ($this.is('.disabled, :disabled')) return | ||
70 | |||
71 | $parent = getParent($this) | ||
72 | |||
73 | isActive = $parent.hasClass('open') | ||
74 | |||
75 | clearMenus() | ||
76 | |||
77 | if (!isActive) { | ||
78 | $parent.toggleClass('open') | ||
79 | } | ||
80 | |||
81 | $this.focus() | ||
82 | |||
83 | return false | ||
84 | } | ||
85 | |||
86 | , keydown: function (e) { | ||
87 | var $this | ||
88 | , $items | ||
89 | , $active | ||
90 | , $parent | ||
91 | , isActive | ||
92 | , index | ||
93 | |||
94 | if (!/(38|40|27)/.test(e.keyCode)) return | ||
95 | |||
96 | $this = $(this) | ||
97 | |||
98 | e.preventDefault() | ||
99 | e.stopPropagation() | ||
100 | |||
101 | if ($this.is('.disabled, :disabled')) return | ||
102 | |||
103 | $parent = getParent($this) | ||
104 | |||
105 | isActive = $parent.hasClass('open') | ||
106 | |||
107 | if (!isActive || (isActive && e.keyCode == 27)) return $this.click() | ||
108 | |||
109 | $items = $('[role=menu] li:not(.divider):visible a', $parent) | ||
110 | |||
111 | if (!$items.length) return | ||
112 | |||
113 | index = $items.index($items.filter(':focus')) | ||
114 | |||
115 | if (e.keyCode == 38 && index > 0) index-- // up | ||
116 | if (e.keyCode == 40 && index < $items.length - 1) index++ // down | ||
117 | if (!~index) index = 0 | ||
118 | |||
119 | $items | ||
120 | .eq(index) | ||
121 | .focus() | ||
122 | } | ||
123 | |||
124 | } | ||
125 | |||
126 | function clearMenus() { | ||
127 | $(toggle).each(function () { | ||
128 | getParent($(this)).removeClass('open') | ||
129 | }) | ||
130 | } | ||
131 | |||
132 | function getParent($this) { | ||
133 | var selector = $this.attr('data-target') | ||
134 | , $parent | ||
135 | |||
136 | if (!selector) { | ||
137 | selector = $this.attr('href') | ||
138 | selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
139 | } | ||
140 | |||
141 | $parent = $(selector) | ||
142 | $parent.length || ($parent = $this.parent()) | ||
143 | |||
144 | return $parent | ||
145 | } | ||
146 | |||
147 | |||
148 | /* DROPDOWN PLUGIN DEFINITION | ||
149 | * ========================== */ | ||
150 | |||
151 | var old = $.fn.dropdown | ||
152 | |||
153 | $.fn.dropdown = function (option) { | ||
154 | return this.each(function () { | ||
155 | var $this = $(this) | ||
156 | , data = $this.data('dropdown') | ||
157 | if (!data) $this.data('dropdown', (data = new Dropdown(this))) | ||
158 | if (typeof option == 'string') data[option].call($this) | ||
159 | }) | ||
160 | } | ||
161 | |||
162 | $.fn.dropdown.Constructor = Dropdown | ||
163 | |||
164 | |||
165 | /* DROPDOWN NO CONFLICT | ||
166 | * ==================== */ | ||
167 | |||
168 | $.fn.dropdown.noConflict = function () { | ||
169 | $.fn.dropdown = old | ||
170 | return this | ||
171 | } | ||
172 | |||
173 | |||
174 | /* APPLY TO STANDARD DROPDOWN ELEMENTS | ||
175 | * =================================== */ | ||
176 | |||
177 | $(document) | ||
178 | .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) | ||
179 | .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) | ||
180 | .on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) { e.stopPropagation() }) | ||
181 | .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) | ||
182 | .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) | ||
183 | |||
184 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-modal.js b/frontend/gamma/js/Bootstrap/bootstrap-modal.js new file mode 100644 index 0000000..fd7e337 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-modal.js | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ========================================================= | ||
25 | * bootstrap-modal.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#modals | ||
27 | * ========================================================= | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ========================================================= */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* MODAL CLASS DEFINITION | ||
50 | * ====================== */ | ||
51 | |||
52 | var Modal = function (element, options) { | ||
53 | this.options = options | ||
54 | this.$element = $(element) | ||
55 | .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) | ||
56 | this.options.remote && this.$element.find('.modal-body').load(this.options.remote) | ||
57 | } | ||
58 | |||
59 | Modal.prototype = { | ||
60 | |||
61 | constructor: Modal | ||
62 | |||
63 | , toggle: function () { | ||
64 | return this[!this.isShown ? 'show' : 'hide']() | ||
65 | } | ||
66 | |||
67 | , show: function () { | ||
68 | var that = this | ||
69 | , e = $.Event('show') | ||
70 | |||
71 | this.$element.trigger(e) | ||
72 | |||
73 | if (this.isShown || e.isDefaultPrevented()) return | ||
74 | |||
75 | this.isShown = true | ||
76 | |||
77 | this.escape() | ||
78 | |||
79 | this.backdrop(function () { | ||
80 | var transition = $.support.transition && that.$element.hasClass('fade') | ||
81 | |||
82 | if (!that.$element.parent().length) { | ||
83 | that.$element.appendTo(document.body) //don't move modals dom position | ||
84 | } | ||
85 | |||
86 | that.$element | ||
87 | .show() | ||
88 | |||
89 | if (transition) { | ||
90 | that.$element[0].offsetWidth // force reflow | ||
91 | } | ||
92 | |||
93 | that.$element | ||
94 | .addClass('in') | ||
95 | .attr('aria-hidden', false) | ||
96 | |||
97 | that.enforceFocus() | ||
98 | |||
99 | transition ? | ||
100 | that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : | ||
101 | that.$element.focus().trigger('shown') | ||
102 | |||
103 | }) | ||
104 | } | ||
105 | |||
106 | , hide: function (e) { | ||
107 | e && e.preventDefault() | ||
108 | |||
109 | var that = this | ||
110 | |||
111 | e = $.Event('hide') | ||
112 | |||
113 | this.$element.trigger(e) | ||
114 | |||
115 | if (!this.isShown || e.isDefaultPrevented()) return | ||
116 | |||
117 | this.isShown = false | ||
118 | |||
119 | this.escape() | ||
120 | |||
121 | $(document).off('focusin.modal') | ||
122 | |||
123 | this.$element | ||
124 | .removeClass('in') | ||
125 | .attr('aria-hidden', true) | ||
126 | |||
127 | $.support.transition && this.$element.hasClass('fade') ? | ||
128 | this.hideWithTransition() : | ||
129 | this.hideModal() | ||
130 | } | ||
131 | |||
132 | , enforceFocus: function () { | ||
133 | var that = this | ||
134 | $(document).on('focusin.modal', function (e) { | ||
135 | if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { | ||
136 | that.$element.focus() | ||
137 | } | ||
138 | }) | ||
139 | } | ||
140 | |||
141 | , escape: function () { | ||
142 | var that = this | ||
143 | if (this.isShown && this.options.keyboard) { | ||
144 | this.$element.on('keyup.dismiss.modal', function ( e ) { | ||
145 | e.which == 27 && that.hide() | ||
146 | }) | ||
147 | } else if (!this.isShown) { | ||
148 | this.$element.off('keyup.dismiss.modal') | ||
149 | } | ||
150 | } | ||
151 | |||
152 | , hideWithTransition: function () { | ||
153 | var that = this | ||
154 | , timeout = setTimeout(function () { | ||
155 | that.$element.off($.support.transition.end) | ||
156 | that.hideModal() | ||
157 | }, 500) | ||
158 | |||
159 | this.$element.one($.support.transition.end, function () { | ||
160 | clearTimeout(timeout) | ||
161 | that.hideModal() | ||
162 | }) | ||
163 | } | ||
164 | |||
165 | , hideModal: function (that) { | ||
166 | this.$element | ||
167 | .hide() | ||
168 | .trigger('hidden') | ||
169 | |||
170 | this.backdrop() | ||
171 | } | ||
172 | |||
173 | , removeBackdrop: function () { | ||
174 | this.$backdrop.remove() | ||
175 | this.$backdrop = null | ||
176 | } | ||
177 | |||
178 | , backdrop: function (callback) { | ||
179 | var that = this | ||
180 | , animate = this.$element.hasClass('fade') ? 'fade' : '' | ||
181 | |||
182 | if (this.isShown && this.options.backdrop) { | ||
183 | var doAnimate = $.support.transition && animate | ||
184 | |||
185 | this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') | ||
186 | .appendTo(document.body) | ||
187 | |||
188 | this.$backdrop.click( | ||
189 | this.options.backdrop == 'static' ? | ||
190 | $.proxy(this.$element[0].focus, this.$element[0]) | ||
191 | : $.proxy(this.hide, this) | ||
192 | ) | ||
193 | |||
194 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow | ||
195 | |||
196 | this.$backdrop.addClass('in') | ||
197 | |||
198 | doAnimate ? | ||
199 | this.$backdrop.one($.support.transition.end, callback) : | ||
200 | callback() | ||
201 | |||
202 | } else if (!this.isShown && this.$backdrop) { | ||
203 | this.$backdrop.removeClass('in') | ||
204 | |||
205 | $.support.transition && this.$element.hasClass('fade')? | ||
206 | this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) : | ||
207 | this.removeBackdrop() | ||
208 | |||
209 | } else if (callback) { | ||
210 | callback() | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | |||
215 | |||
216 | /* MODAL PLUGIN DEFINITION | ||
217 | * ======================= */ | ||
218 | |||
219 | var old = $.fn.modal | ||
220 | |||
221 | $.fn.modal = function (option) { | ||
222 | return this.each(function () { | ||
223 | var $this = $(this) | ||
224 | , data = $this.data('modal') | ||
225 | , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) | ||
226 | if (!data) $this.data('modal', (data = new Modal(this, options))) | ||
227 | if (typeof option == 'string') data[option]() | ||
228 | else if (options.show) data.show() | ||
229 | }) | ||
230 | } | ||
231 | |||
232 | $.fn.modal.defaults = { | ||
233 | backdrop: true | ||
234 | , keyboard: true | ||
235 | , show: true | ||
236 | } | ||
237 | |||
238 | $.fn.modal.Constructor = Modal | ||
239 | |||
240 | |||
241 | /* MODAL NO CONFLICT | ||
242 | * ================= */ | ||
243 | |||
244 | $.fn.modal.noConflict = function () { | ||
245 | $.fn.modal = old | ||
246 | return this | ||
247 | } | ||
248 | |||
249 | |||
250 | /* MODAL DATA-API | ||
251 | * ============== */ | ||
252 | |||
253 | $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { | ||
254 | var $this = $(this) | ||
255 | , href = $this.attr('href') | ||
256 | , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 | ||
257 | , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) | ||
258 | |||
259 | e.preventDefault() | ||
260 | |||
261 | $target | ||
262 | .modal(option) | ||
263 | .one('hide', function () { | ||
264 | $this.focus() | ||
265 | }) | ||
266 | }) | ||
267 | |||
268 | }(window.jQuery); | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-popover.js b/frontend/gamma/js/Bootstrap/bootstrap-popover.js new file mode 100644 index 0000000..89e1edb --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-popover.js | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* =========================================================== | ||
25 | * bootstrap-popover.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#popovers | ||
27 | * =========================================================== | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * =========================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* POPOVER PUBLIC CLASS DEFINITION | ||
50 | * =============================== */ | ||
51 | |||
52 | var Popover = function (element, options) { | ||
53 | this.init('popover', element, options) | ||
54 | } | ||
55 | |||
56 | |||
57 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js | ||
58 | ========================================== */ | ||
59 | |||
60 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { | ||
61 | |||
62 | constructor: Popover | ||
63 | |||
64 | , setContent: function () { | ||
65 | var $tip = this.tip() | ||
66 | , title = this.getTitle() | ||
67 | , content = this.getContent() | ||
68 | |||
69 | $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) | ||
70 | $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) | ||
71 | |||
72 | $tip.removeClass('fade top bottom left right in') | ||
73 | } | ||
74 | |||
75 | , hasContent: function () { | ||
76 | return this.getTitle() || this.getContent() | ||
77 | } | ||
78 | |||
79 | , getContent: function () { | ||
80 | var content | ||
81 | , $e = this.$element | ||
82 | , o = this.options | ||
83 | |||
84 | content = $e.attr('data-content') | ||
85 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) | ||
86 | |||
87 | return content | ||
88 | } | ||
89 | |||
90 | , tip: function () { | ||
91 | if (!this.$tip) { | ||
92 | this.$tip = $(this.options.template) | ||
93 | } | ||
94 | return this.$tip | ||
95 | } | ||
96 | |||
97 | , destroy: function () { | ||
98 | this.hide().$element.off('.' + this.type).removeData(this.type) | ||
99 | } | ||
100 | |||
101 | }) | ||
102 | |||
103 | |||
104 | /* POPOVER PLUGIN DEFINITION | ||
105 | * ======================= */ | ||
106 | |||
107 | var old = $.fn.popover | ||
108 | |||
109 | $.fn.popover = function (option) { | ||
110 | return this.each(function () { | ||
111 | var $this = $(this) | ||
112 | , data = $this.data('popover') | ||
113 | , options = typeof option == 'object' && option | ||
114 | if (!data) $this.data('popover', (data = new Popover(this, options))) | ||
115 | if (typeof option == 'string') data[option]() | ||
116 | }) | ||
117 | } | ||
118 | |||
119 | $.fn.popover.Constructor = Popover | ||
120 | |||
121 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { | ||
122 | placement: 'right' | ||
123 | , trigger: 'click' | ||
124 | , content: '' | ||
125 | , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>' | ||
126 | }) | ||
127 | |||
128 | |||
129 | /* POPOVER NO CONFLICT | ||
130 | * =================== */ | ||
131 | |||
132 | $.fn.popover.noConflict = function () { | ||
133 | $.fn.popover = old | ||
134 | return this | ||
135 | } | ||
136 | |||
137 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-scrollspy.js b/frontend/gamma/js/Bootstrap/bootstrap-scrollspy.js new file mode 100644 index 0000000..4366f26 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-scrollspy.js | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ============================================================= | ||
25 | * bootstrap-scrollspy.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy | ||
27 | * ============================================================= | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ============================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* SCROLLSPY CLASS DEFINITION | ||
50 | * ========================== */ | ||
51 | |||
52 | function ScrollSpy(element, options) { | ||
53 | var process = $.proxy(this.process, this) | ||
54 | , $element = $(element).is('body') ? $(window) : $(element) | ||
55 | , href | ||
56 | this.options = $.extend({}, $.fn.scrollspy.defaults, options) | ||
57 | this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) | ||
58 | this.selector = (this.options.target | ||
59 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 | ||
60 | || '') + ' .nav li > a' | ||
61 | this.$body = $('body') | ||
62 | this.refresh() | ||
63 | this.process() | ||
64 | } | ||
65 | |||
66 | ScrollSpy.prototype = { | ||
67 | |||
68 | constructor: ScrollSpy | ||
69 | |||
70 | , refresh: function () { | ||
71 | var self = this | ||
72 | , $targets | ||
73 | |||
74 | this.offsets = $([]) | ||
75 | this.targets = $([]) | ||
76 | |||
77 | $targets = this.$body | ||
78 | .find(this.selector) | ||
79 | .map(function () { | ||
80 | var $el = $(this) | ||
81 | , href = $el.data('target') || $el.attr('href') | ||
82 | , $href = /^#\w/.test(href) && $(href) | ||
83 | return ( $href | ||
84 | && $href.length | ||
85 | && [[ $href.position().top + self.$scrollElement.scrollTop(), href ]] ) || null | ||
86 | }) | ||
87 | .sort(function (a, b) { return a[0] - b[0] }) | ||
88 | .each(function () { | ||
89 | self.offsets.push(this[0]) | ||
90 | self.targets.push(this[1]) | ||
91 | }) | ||
92 | } | ||
93 | |||
94 | , process: function () { | ||
95 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset | ||
96 | , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight | ||
97 | , maxScroll = scrollHeight - this.$scrollElement.height() | ||
98 | , offsets = this.offsets | ||
99 | , targets = this.targets | ||
100 | , activeTarget = this.activeTarget | ||
101 | , i | ||
102 | |||
103 | if (scrollTop >= maxScroll) { | ||
104 | return activeTarget != (i = targets.last()[0]) | ||
105 | && this.activate ( i ) | ||
106 | } | ||
107 | |||
108 | for (i = offsets.length; i--;) { | ||
109 | activeTarget != targets[i] | ||
110 | && scrollTop >= offsets[i] | ||
111 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) | ||
112 | && this.activate( targets[i] ) | ||
113 | } | ||
114 | } | ||
115 | |||
116 | , activate: function (target) { | ||
117 | var active | ||
118 | , selector | ||
119 | |||
120 | this.activeTarget = target | ||
121 | |||
122 | $(this.selector) | ||
123 | .parent('.active') | ||
124 | .removeClass('active') | ||
125 | |||
126 | selector = this.selector | ||
127 | + '[data-target="' + target + '"],' | ||
128 | + this.selector + '[href="' + target + '"]' | ||
129 | |||
130 | active = $(selector) | ||
131 | .parent('li') | ||
132 | .addClass('active') | ||
133 | |||
134 | if (active.parent('.dropdown-menu').length) { | ||
135 | active = active.closest('li.dropdown').addClass('active') | ||
136 | } | ||
137 | |||
138 | active.trigger('activate') | ||
139 | } | ||
140 | |||
141 | } | ||
142 | |||
143 | |||
144 | /* SCROLLSPY PLUGIN DEFINITION | ||
145 | * =========================== */ | ||
146 | |||
147 | var old = $.fn.scrollspy | ||
148 | |||
149 | $.fn.scrollspy = function (option) { | ||
150 | return this.each(function () { | ||
151 | var $this = $(this) | ||
152 | , data = $this.data('scrollspy') | ||
153 | , options = typeof option == 'object' && option | ||
154 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) | ||
155 | if (typeof option == 'string') data[option]() | ||
156 | }) | ||
157 | } | ||
158 | |||
159 | $.fn.scrollspy.Constructor = ScrollSpy | ||
160 | |||
161 | $.fn.scrollspy.defaults = { | ||
162 | offset: 10 | ||
163 | } | ||
164 | |||
165 | |||
166 | /* SCROLLSPY NO CONFLICT | ||
167 | * ===================== */ | ||
168 | |||
169 | $.fn.scrollspy.noConflict = function () { | ||
170 | $.fn.scrollspy = old | ||
171 | return this | ||
172 | } | ||
173 | |||
174 | |||
175 | /* SCROLLSPY DATA-API | ||
176 | * ================== */ | ||
177 | |||
178 | $(window).on('load', function () { | ||
179 | $('[data-spy="scroll"]').each(function () { | ||
180 | var $spy = $(this) | ||
181 | $spy.scrollspy($spy.data()) | ||
182 | }) | ||
183 | }) | ||
184 | |||
185 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-tab.js b/frontend/gamma/js/Bootstrap/bootstrap-tab.js new file mode 100644 index 0000000..d7c7fc7 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-tab.js | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ======================================================== | ||
25 | * bootstrap-tab.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#tabs | ||
27 | * ======================================================== | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ======================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* TAB CLASS DEFINITION | ||
50 | * ==================== */ | ||
51 | |||
52 | var Tab = function (element) { | ||
53 | this.element = $(element) | ||
54 | } | ||
55 | |||
56 | Tab.prototype = { | ||
57 | |||
58 | constructor: Tab | ||
59 | |||
60 | , show: function () { | ||
61 | var $this = this.element | ||
62 | , $ul = $this.closest('ul:not(.dropdown-menu)') | ||
63 | , selector = $this.attr('data-target') | ||
64 | , previous | ||
65 | , $target | ||
66 | , e | ||
67 | |||
68 | if (!selector) { | ||
69 | selector = $this.attr('href') | ||
70 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
71 | } | ||
72 | |||
73 | if ( $this.parent('li').hasClass('active') ) return | ||
74 | |||
75 | previous = $ul.find('.active:last a')[0] | ||
76 | |||
77 | e = $.Event('show', { | ||
78 | relatedTarget: previous | ||
79 | }) | ||
80 | |||
81 | $this.trigger(e) | ||
82 | |||
83 | if (e.isDefaultPrevented()) return | ||
84 | |||
85 | $target = $(selector) | ||
86 | |||
87 | this.activate($this.parent('li'), $ul) | ||
88 | this.activate($target, $target.parent(), function () { | ||
89 | $this.trigger({ | ||
90 | type: 'shown' | ||
91 | , relatedTarget: previous | ||
92 | }) | ||
93 | }) | ||
94 | } | ||
95 | |||
96 | , activate: function ( element, container, callback) { | ||
97 | var $active = container.find('> .active') | ||
98 | , transition = callback | ||
99 | && $.support.transition | ||
100 | && $active.hasClass('fade') | ||
101 | |||
102 | function next() { | ||
103 | $active | ||
104 | .removeClass('active') | ||
105 | .find('> .dropdown-menu > .active') | ||
106 | .removeClass('active') | ||
107 | |||
108 | element.addClass('active') | ||
109 | |||
110 | if (transition) { | ||
111 | element[0].offsetWidth // reflow for transition | ||
112 | element.addClass('in') | ||
113 | } else { | ||
114 | element.removeClass('fade') | ||
115 | } | ||
116 | |||
117 | if ( element.parent('.dropdown-menu') ) { | ||
118 | element.closest('li.dropdown').addClass('active') | ||
119 | } | ||
120 | |||
121 | callback && callback() | ||
122 | } | ||
123 | |||
124 | transition ? | ||
125 | $active.one($.support.transition.end, next) : | ||
126 | next() | ||
127 | |||
128 | $active.removeClass('in') | ||
129 | } | ||
130 | } | ||
131 | |||
132 | |||
133 | /* TAB PLUGIN DEFINITION | ||
134 | * ===================== */ | ||
135 | |||
136 | var old = $.fn.tab | ||
137 | |||
138 | $.fn.tab = function ( option ) { | ||
139 | return this.each(function () { | ||
140 | var $this = $(this) | ||
141 | , data = $this.data('tab') | ||
142 | if (!data) $this.data('tab', (data = new Tab(this))) | ||
143 | if (typeof option == 'string') data[option]() | ||
144 | }) | ||
145 | } | ||
146 | |||
147 | $.fn.tab.Constructor = Tab | ||
148 | |||
149 | |||
150 | /* TAB NO CONFLICT | ||
151 | * =============== */ | ||
152 | |||
153 | $.fn.tab.noConflict = function () { | ||
154 | $.fn.tab = old | ||
155 | return this | ||
156 | } | ||
157 | |||
158 | |||
159 | /* TAB DATA-API | ||
160 | * ============ */ | ||
161 | |||
162 | $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { | ||
163 | e.preventDefault() | ||
164 | $(this).tab('show') | ||
165 | }) | ||
166 | |||
167 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-tooltip.js b/frontend/gamma/js/Bootstrap/bootstrap-tooltip.js new file mode 100644 index 0000000..bdcff7d --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-tooltip.js | |||
@@ -0,0 +1,310 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* =========================================================== | ||
25 | * bootstrap-tooltip.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#tooltips | ||
27 | * Inspired by the original jQuery.tipsy by Jason Frame | ||
28 | * =========================================================== | ||
29 | * Copyright 2012 Twitter, Inc. | ||
30 | * | ||
31 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
32 | * you may not use this file except in compliance with the License. | ||
33 | * You may obtain a copy of the License at | ||
34 | * | ||
35 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
36 | * | ||
37 | * Unless required by applicable law or agreed to in writing, software | ||
38 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
39 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
40 | * See the License for the specific language governing permissions and | ||
41 | * limitations under the License. | ||
42 | * ========================================================== */ | ||
43 | |||
44 | |||
45 | !function ($) { | ||
46 | |||
47 | "use strict"; // jshint ;_; | ||
48 | |||
49 | |||
50 | /* TOOLTIP PUBLIC CLASS DEFINITION | ||
51 | * =============================== */ | ||
52 | |||
53 | var Tooltip = function (element, options) { | ||
54 | this.init('tooltip', element, options) | ||
55 | } | ||
56 | |||
57 | Tooltip.prototype = { | ||
58 | |||
59 | constructor: Tooltip | ||
60 | |||
61 | , init: function (type, element, options) { | ||
62 | var eventIn | ||
63 | , eventOut | ||
64 | |||
65 | this.type = type | ||
66 | this.$element = $(element) | ||
67 | this.options = this.getOptions(options) | ||
68 | this.enabled = true | ||
69 | |||
70 | if (this.options.trigger == 'click') { | ||
71 | this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) | ||
72 | } else if (this.options.trigger != 'manual') { | ||
73 | eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' | ||
74 | eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' | ||
75 | this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) | ||
76 | this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) | ||
77 | } | ||
78 | |||
79 | this.options.selector ? | ||
80 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : | ||
81 | this.fixTitle() | ||
82 | } | ||
83 | |||
84 | , getOptions: function (options) { | ||
85 | options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) | ||
86 | |||
87 | if (options.delay && typeof options.delay == 'number') { | ||
88 | options.delay = { | ||
89 | show: options.delay | ||
90 | , hide: options.delay | ||
91 | } | ||
92 | } | ||
93 | |||
94 | return options | ||
95 | } | ||
96 | |||
97 | , enter: function (e) { | ||
98 | var self = $(e.currentTarget)[this.type](this._options).data(this.type) | ||
99 | |||
100 | if (!self.options.delay || !self.options.delay.show) return self.show() | ||
101 | |||
102 | clearTimeout(this.timeout) | ||
103 | self.hoverState = 'in' | ||
104 | this.timeout = setTimeout(function() { | ||
105 | if (self.hoverState == 'in') self.show() | ||
106 | }, self.options.delay.show) | ||
107 | } | ||
108 | |||
109 | , leave: function (e) { | ||
110 | var self = $(e.currentTarget)[this.type](this._options).data(this.type) | ||
111 | |||
112 | if (this.timeout) clearTimeout(this.timeout) | ||
113 | if (!self.options.delay || !self.options.delay.hide) return self.hide() | ||
114 | |||
115 | self.hoverState = 'out' | ||
116 | this.timeout = setTimeout(function() { | ||
117 | if (self.hoverState == 'out') self.hide() | ||
118 | }, self.options.delay.hide) | ||
119 | } | ||
120 | |||
121 | , show: function () { | ||
122 | var $tip | ||
123 | , inside | ||
124 | , pos | ||
125 | , actualWidth | ||
126 | , actualHeight | ||
127 | , placement | ||
128 | , tp | ||
129 | |||
130 | if (this.hasContent() && this.enabled) { | ||
131 | $tip = this.tip() | ||
132 | this.setContent() | ||
133 | |||
134 | if (this.options.animation) { | ||
135 | $tip.addClass('fade') | ||
136 | } | ||
137 | |||
138 | placement = typeof this.options.placement == 'function' ? | ||
139 | this.options.placement.call(this, $tip[0], this.$element[0]) : | ||
140 | this.options.placement | ||
141 | |||
142 | inside = /in/.test(placement) | ||
143 | |||
144 | $tip | ||
145 | .detach() | ||
146 | .css({ top: 0, left: 0, display: 'block' }) | ||
147 | .insertAfter(this.$element) | ||
148 | |||
149 | pos = this.getPosition(inside) | ||
150 | |||
151 | actualWidth = $tip[0].offsetWidth | ||
152 | actualHeight = $tip[0].offsetHeight | ||
153 | |||
154 | switch (inside ? placement.split(' ')[1] : placement) { | ||
155 | case 'bottom': | ||
156 | tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} | ||
157 | break | ||
158 | case 'top': | ||
159 | tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} | ||
160 | break | ||
161 | case 'left': | ||
162 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} | ||
163 | break | ||
164 | case 'right': | ||
165 | tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} | ||
166 | break | ||
167 | } | ||
168 | |||
169 | $tip | ||
170 | .offset(tp) | ||
171 | .addClass(placement) | ||
172 | .addClass('in') | ||
173 | } | ||
174 | } | ||
175 | |||
176 | , setContent: function () { | ||
177 | var $tip = this.tip() | ||
178 | , title = this.getTitle() | ||
179 | |||
180 | $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) | ||
181 | $tip.removeClass('fade in top bottom left right') | ||
182 | } | ||
183 | |||
184 | , hide: function () { | ||
185 | var that = this | ||
186 | , $tip = this.tip() | ||
187 | |||
188 | $tip.removeClass('in') | ||
189 | |||
190 | function removeWithAnimation() { | ||
191 | var timeout = setTimeout(function () { | ||
192 | $tip.off($.support.transition.end).detach() | ||
193 | }, 500) | ||
194 | |||
195 | $tip.one($.support.transition.end, function () { | ||
196 | clearTimeout(timeout) | ||
197 | $tip.detach() | ||
198 | }) | ||
199 | } | ||
200 | |||
201 | $.support.transition && this.$tip.hasClass('fade') ? | ||
202 | removeWithAnimation() : | ||
203 | $tip.detach() | ||
204 | |||
205 | return this | ||
206 | } | ||
207 | |||
208 | , fixTitle: function () { | ||
209 | var $e = this.$element | ||
210 | if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { | ||
211 | $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') | ||
212 | } | ||
213 | } | ||
214 | |||
215 | , hasContent: function () { | ||
216 | return this.getTitle() | ||
217 | } | ||
218 | |||
219 | , getPosition: function (inside) { | ||
220 | return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { | ||
221 | width: this.$element[0].offsetWidth | ||
222 | , height: this.$element[0].offsetHeight | ||
223 | }) | ||
224 | } | ||
225 | |||
226 | , getTitle: function () { | ||
227 | var title | ||
228 | , $e = this.$element | ||
229 | , o = this.options | ||
230 | |||
231 | title = $e.attr('data-original-title') | ||
232 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) | ||
233 | |||
234 | return title | ||
235 | } | ||
236 | |||
237 | , tip: function () { | ||
238 | return this.$tip = this.$tip || $(this.options.template) | ||
239 | } | ||
240 | |||
241 | , validate: function () { | ||
242 | if (!this.$element[0].parentNode) { | ||
243 | this.hide() | ||
244 | this.$element = null | ||
245 | this.options = null | ||
246 | } | ||
247 | } | ||
248 | |||
249 | , enable: function () { | ||
250 | this.enabled = true | ||
251 | } | ||
252 | |||
253 | , disable: function () { | ||
254 | this.enabled = false | ||
255 | } | ||
256 | |||
257 | , toggleEnabled: function () { | ||
258 | this.enabled = !this.enabled | ||
259 | } | ||
260 | |||
261 | , toggle: function (e) { | ||
262 | var self = $(e.currentTarget)[this.type](this._options).data(this.type) | ||
263 | self[self.tip().hasClass('in') ? 'hide' : 'show']() | ||
264 | } | ||
265 | |||
266 | , destroy: function () { | ||
267 | this.hide().$element.off('.' + this.type).removeData(this.type) | ||
268 | } | ||
269 | |||
270 | } | ||
271 | |||
272 | |||
273 | /* TOOLTIP PLUGIN DEFINITION | ||
274 | * ========================= */ | ||
275 | |||
276 | var old = $.fn.tooltip | ||
277 | |||
278 | $.fn.tooltip = function ( option ) { | ||
279 | return this.each(function () { | ||
280 | var $this = $(this) | ||
281 | , data = $this.data('tooltip') | ||
282 | , options = typeof option == 'object' && option | ||
283 | if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) | ||
284 | if (typeof option == 'string') data[option]() | ||
285 | }) | ||
286 | } | ||
287 | |||
288 | $.fn.tooltip.Constructor = Tooltip | ||
289 | |||
290 | $.fn.tooltip.defaults = { | ||
291 | animation: true | ||
292 | , placement: 'top' | ||
293 | , selector: false | ||
294 | , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' | ||
295 | , trigger: 'hover' | ||
296 | , title: '' | ||
297 | , delay: 0 | ||
298 | , html: false | ||
299 | } | ||
300 | |||
301 | |||
302 | /* TOOLTIP NO CONFLICT | ||
303 | * =================== */ | ||
304 | |||
305 | $.fn.tooltip.noConflict = function () { | ||
306 | $.fn.tooltip = old | ||
307 | return this | ||
308 | } | ||
309 | |||
310 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-transition.js b/frontend/gamma/js/Bootstrap/bootstrap-transition.js new file mode 100644 index 0000000..820d232 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-transition.js | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* =================================================== | ||
25 | * bootstrap-transition.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#transitions | ||
27 | * =================================================== | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ========================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) | ||
50 | * ======================================================= */ | ||
51 | |||
52 | $(function () { | ||
53 | |||
54 | $.support.transition = (function () { | ||
55 | |||
56 | var transitionEnd = (function () { | ||
57 | |||
58 | var el = document.createElement('bootstrap') | ||
59 | , transEndEventNames = { | ||
60 | 'WebkitTransition' : 'webkitTransitionEnd' | ||
61 | , 'MozTransition' : 'transitionend' | ||
62 | , 'OTransition' : 'oTransitionEnd otransitionend' | ||
63 | , 'transition' : 'transitionend' | ||
64 | } | ||
65 | , name | ||
66 | |||
67 | for (name in transEndEventNames){ | ||
68 | if (el.style[name] !== undefined) { | ||
69 | return transEndEventNames[name] | ||
70 | } | ||
71 | } | ||
72 | |||
73 | }()) | ||
74 | |||
75 | return transitionEnd && { | ||
76 | end: transitionEnd | ||
77 | } | ||
78 | |||
79 | })() | ||
80 | |||
81 | }) | ||
82 | |||
83 | }(window.jQuery); \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-typeahead.js b/frontend/gamma/js/Bootstrap/bootstrap-typeahead.js new file mode 100644 index 0000000..d3d8d32 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-typeahead.js | |||
@@ -0,0 +1,346 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ============================================================= | ||
25 | * bootstrap-typeahead.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#typeahead | ||
27 | * ============================================================= | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ============================================================ */ | ||
42 | |||
43 | |||
44 | !function($){ | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* TYPEAHEAD PUBLIC CLASS DEFINITION | ||
50 | * ================================= */ | ||
51 | |||
52 | var Typeahead = function (element, options) { | ||
53 | this.$element = $(element) | ||
54 | this.options = $.extend({}, $.fn.typeahead.defaults, options) | ||
55 | this.matcher = this.options.matcher || this.matcher | ||
56 | this.sorter = this.options.sorter || this.sorter | ||
57 | this.highlighter = this.options.highlighter || this.highlighter | ||
58 | this.updater = this.options.updater || this.updater | ||
59 | this.source = this.options.source | ||
60 | this.$menu = $(this.options.menu) | ||
61 | this.shown = false | ||
62 | this.listen() | ||
63 | } | ||
64 | |||
65 | Typeahead.prototype = { | ||
66 | |||
67 | constructor: Typeahead | ||
68 | |||
69 | , select: function () { | ||
70 | var val = this.$menu.find('.active').attr('data-value') | ||
71 | this.$element | ||
72 | .val(this.updater(val)) | ||
73 | .change() | ||
74 | return this.hide() | ||
75 | } | ||
76 | |||
77 | , updater: function (item) { | ||
78 | return item | ||
79 | } | ||
80 | |||
81 | , show: function () { | ||
82 | var pos = $.extend({}, this.$element.position(), { | ||
83 | height: this.$element[0].offsetHeight | ||
84 | }) | ||
85 | |||
86 | this.$menu | ||
87 | .insertAfter(this.$element) | ||
88 | .css({ | ||
89 | top: pos.top + pos.height | ||
90 | , left: pos.left | ||
91 | }) | ||
92 | .show() | ||
93 | |||
94 | this.shown = true | ||
95 | return this | ||
96 | } | ||
97 | |||
98 | , hide: function () { | ||
99 | this.$menu.hide() | ||
100 | this.shown = false | ||
101 | return this | ||
102 | } | ||
103 | |||
104 | , lookup: function (event) { | ||
105 | var items | ||
106 | |||
107 | this.query = this.$element.val() | ||
108 | |||
109 | if (!this.query || this.query.length < this.options.minLength) { | ||
110 | return this.shown ? this.hide() : this | ||
111 | } | ||
112 | |||
113 | items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source | ||
114 | |||
115 | return items ? this.process(items) : this | ||
116 | } | ||
117 | |||
118 | , process: function (items) { | ||
119 | var that = this | ||
120 | |||
121 | items = $.grep(items, function (item) { | ||
122 | return that.matcher(item) | ||
123 | }) | ||
124 | |||
125 | items = this.sorter(items) | ||
126 | |||
127 | if (!items.length) { | ||
128 | return this.shown ? this.hide() : this | ||
129 | } | ||
130 | |||
131 | return this.render(items.slice(0, this.options.items)).show() | ||
132 | } | ||
133 | |||
134 | , matcher: function (item) { | ||
135 | return ~item.toLowerCase().indexOf(this.query.toLowerCase()) | ||
136 | } | ||
137 | |||
138 | , sorter: function (items) { | ||
139 | var beginswith = [] | ||
140 | , caseSensitive = [] | ||
141 | , caseInsensitive = [] | ||
142 | , item | ||
143 | |||
144 | while (item = items.shift()) { | ||
145 | if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item) | ||
146 | else if (~item.indexOf(this.query)) caseSensitive.push(item) | ||
147 | else caseInsensitive.push(item) | ||
148 | } | ||
149 | |||
150 | return beginswith.concat(caseSensitive, caseInsensitive) | ||
151 | } | ||
152 | |||
153 | , highlighter: function (item) { | ||
154 | var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&') | ||
155 | return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { | ||
156 | return '<strong>' + match + '</strong>' | ||
157 | }) | ||
158 | } | ||
159 | |||
160 | , render: function (items) { | ||
161 | var that = this | ||
162 | |||
163 | items = $(items).map(function (i, item) { | ||
164 | i = $(that.options.item).attr('data-value', item) | ||
165 | i.find('a').html(that.highlighter(item)) | ||
166 | return i[0] | ||
167 | }) | ||
168 | |||
169 | items.first().addClass('active') | ||
170 | this.$menu.html(items) | ||
171 | return this | ||
172 | } | ||
173 | |||
174 | , next: function (event) { | ||
175 | var active = this.$menu.find('.active').removeClass('active') | ||
176 | , next = active.next() | ||
177 | |||
178 | if (!next.length) { | ||
179 | next = $(this.$menu.find('li')[0]) | ||
180 | } | ||
181 | |||
182 | next.addClass('active') | ||
183 | } | ||
184 | |||
185 | , prev: function (event) { | ||
186 | var active = this.$menu.find('.active').removeClass('active') | ||
187 | , prev = active.prev() | ||
188 | |||
189 | if (!prev.length) { | ||
190 | prev = this.$menu.find('li').last() | ||
191 | } | ||
192 | |||
193 | prev.addClass('active') | ||
194 | } | ||
195 | |||
196 | , listen: function () { | ||
197 | this.$element | ||
198 | .on('blur', $.proxy(this.blur, this)) | ||
199 | .on('keypress', $.proxy(this.keypress, this)) | ||
200 | .on('keyup', $.proxy(this.keyup, this)) | ||
201 | |||
202 | if (this.eventSupported('keydown')) { | ||
203 | this.$element.on('keydown', $.proxy(this.keydown, this)) | ||
204 | } | ||
205 | |||
206 | this.$menu | ||
207 | .on('click', $.proxy(this.click, this)) | ||
208 | .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) | ||
209 | } | ||
210 | |||
211 | , eventSupported: function(eventName) { | ||
212 | var isSupported = eventName in this.$element | ||
213 | if (!isSupported) { | ||
214 | this.$element.setAttribute(eventName, 'return;') | ||
215 | isSupported = typeof this.$element[eventName] === 'function' | ||
216 | } | ||
217 | return isSupported | ||
218 | } | ||
219 | |||
220 | , move: function (e) { | ||
221 | if (!this.shown) return | ||
222 | |||
223 | switch(e.keyCode) { | ||
224 | case 9: // tab | ||
225 | case 13: // enter | ||
226 | case 27: // escape | ||
227 | e.preventDefault() | ||
228 | break | ||
229 | |||
230 | case 38: // up arrow | ||
231 | e.preventDefault() | ||
232 | this.prev() | ||
233 | break | ||
234 | |||
235 | case 40: // down arrow | ||
236 | e.preventDefault() | ||
237 | this.next() | ||
238 | break | ||
239 | } | ||
240 | |||
241 | e.stopPropagation() | ||
242 | } | ||
243 | |||
244 | , keydown: function (e) { | ||
245 | this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27]) | ||
246 | this.move(e) | ||
247 | } | ||
248 | |||
249 | , keypress: function (e) { | ||
250 | if (this.suppressKeyPressRepeat) return | ||
251 | this.move(e) | ||
252 | } | ||
253 | |||
254 | , keyup: function (e) { | ||
255 | switch(e.keyCode) { | ||
256 | case 40: // down arrow | ||
257 | case 38: // up arrow | ||
258 | case 16: // shift | ||
259 | case 17: // ctrl | ||
260 | case 18: // alt | ||
261 | break | ||
262 | |||
263 | case 9: // tab | ||
264 | case 13: // enter | ||
265 | if (!this.shown) return | ||
266 | this.select() | ||
267 | break | ||
268 | |||
269 | case 27: // escape | ||
270 | if (!this.shown) return | ||
271 | this.hide() | ||
272 | break | ||
273 | |||
274 | default: | ||
275 | this.lookup() | ||
276 | } | ||
277 | |||
278 | e.stopPropagation() | ||
279 | e.preventDefault() | ||
280 | } | ||
281 | |||
282 | , blur: function (e) { | ||
283 | var that = this | ||
284 | setTimeout(function () { that.hide() }, 150) | ||
285 | } | ||
286 | |||
287 | , click: function (e) { | ||
288 | e.stopPropagation() | ||
289 | e.preventDefault() | ||
290 | this.select() | ||
291 | } | ||
292 | |||
293 | , mouseenter: function (e) { | ||
294 | this.$menu.find('.active').removeClass('active') | ||
295 | $(e.currentTarget).addClass('active') | ||
296 | } | ||
297 | |||
298 | } | ||
299 | |||
300 | |||
301 | /* TYPEAHEAD PLUGIN DEFINITION | ||
302 | * =========================== */ | ||
303 | |||
304 | var old = $.fn.typeahead | ||
305 | |||
306 | $.fn.typeahead = function (option) { | ||
307 | return this.each(function () { | ||
308 | var $this = $(this) | ||
309 | , data = $this.data('typeahead') | ||
310 | , options = typeof option == 'object' && option | ||
311 | if (!data) $this.data('typeahead', (data = new Typeahead(this, options))) | ||
312 | if (typeof option == 'string') data[option]() | ||
313 | }) | ||
314 | } | ||
315 | |||
316 | $.fn.typeahead.defaults = { | ||
317 | source: [] | ||
318 | , items: 8 | ||
319 | , menu: '<ul class="typeahead dropdown-menu"></ul>' | ||
320 | , item: '<li><a href="#"></a></li>' | ||
321 | , minLength: 1 | ||
322 | } | ||
323 | |||
324 | $.fn.typeahead.Constructor = Typeahead | ||
325 | |||
326 | |||
327 | /* TYPEAHEAD NO CONFLICT | ||
328 | * =================== */ | ||
329 | |||
330 | $.fn.typeahead.noConflict = function () { | ||
331 | $.fn.typeahead = old | ||
332 | return this | ||
333 | } | ||
334 | |||
335 | |||
336 | /* TYPEAHEAD DATA-API | ||
337 | * ================== */ | ||
338 | |||
339 | $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { | ||
340 | var $this = $(this) | ||
341 | if ($this.data('typeahead')) return | ||
342 | e.preventDefault() | ||
343 | $this.typeahead($this.data()) | ||
344 | }) | ||
345 | |||
346 | }(window.jQuery); | ||
diff --git a/frontend/gamma/js/Clipperz/Async.js b/frontend/gamma/js/Clipperz/Async.js index f7a9517..d525453 100644 --- a/frontend/gamma/js/Clipperz/Async.js +++ b/frontend/gamma/js/Clipperz/Async.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //Clipperz.Async = MochiKit.Async; | 24 | //Clipperz.Async = MochiKit.Async; |
27 | 25 | ||
28 | 26 | ||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 27 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.Async) == 'undefined') { Clipperz.Async = {}; } | 28 | if (typeof(Clipperz.Async) == 'undefined') { Clipperz.Async = {}; } |
@@ -57,18 +55,17 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { | |||
57 | 'args': function () { | 55 | 'args': function () { |
58 | return this._args; | 56 | return this._args; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | //----------------------------------------------------------------------------- | 59 | //----------------------------------------------------------------------------- |
62 | 60 | ||
63 | 'callback': function (aValue) { | 61 | 'callback': function (aValue) { |
64 | if (this._shouldTrace) { | 62 | if (this._shouldTrace) { |
65 | //Clipperz.log("CALLBACK " + this._name, aValue); | 63 | Clipperz.log("CALLBACK " + this._name, aValue); |
66 | console.log("CALLBACK " + this._name, aValue); | ||
67 | } | 64 | } |
68 | 65 | ||
69 | if (this.chained == false) { | 66 | if (this.chained == false) { |
70 | var message; | 67 | var message; |
71 | 68 | ||
72 | message = "ERROR [" + this._name + "]"; | 69 | message = "ERROR [" + this._name + "]"; |
73 | this.addErrback(function(aResult) { | 70 | this.addErrback(function(aResult) { |
74 | if (! (aResult instanceof MochiKit.Async.CancelledError)) { | 71 | if (! (aResult instanceof MochiKit.Async.CancelledError)) { |
@@ -78,19 +75,17 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { | |||
78 | }); | 75 | }); |
79 | 76 | ||
80 | if (this._shouldTrace) { | 77 | if (this._shouldTrace) { |
81 | var resultMessage; | 78 | var resultMessage; |
82 | 79 | ||
83 | resultMessage = "RESULT " + this._name + " <=="; | 80 | resultMessage = "RESULT " + this._name + " <=="; |
84 | // this.addCallback(function(aResult) { | 81 | // this.addCallback(function(aResult) { |
85 | Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) { | 82 | Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) { |
86 | //Clipperz.log(resultMessage, aResult); | 83 | Clipperz.log(resultMessage, aResult); |
87 | console.log(resultMessage, aResult); | ||
88 | |||
89 | return aResult; | 84 | return aResult; |
90 | }); | 85 | }); |
91 | } | 86 | } |
92 | } | 87 | } |
93 | 88 | ||
94 | if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) { | 89 | if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) { |
95 | Clipperz.log("callback " + this._name, this); | 90 | Clipperz.log("callback " + this._name, this); |
96 | } | 91 | } |
@@ -103,32 +98,28 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { | |||
103 | 'addCallback': function () { | 98 | 'addCallback': function () { |
104 | var message; | 99 | var message; |
105 | 100 | ||
106 | if (this._shouldTrace) { | 101 | if (this._shouldTrace) { |
107 | this._count ++; | 102 | this._count ++; |
108 | message = "[" + this._count + "] " + this._name + " "; | 103 | message = "[" + this._count + "] " + this._name + " "; |
109 | // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;}); | 104 | // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;}); |
110 | this.addCallbacks( | 105 | this.addCallbacks( |
111 | //function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, | 106 | function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, |
112 | function(aResult) {console.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, | 107 | function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} |
113 | //function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} | ||
114 | function(aResult) {console.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} | ||
115 | ); | 108 | ); |
116 | } | 109 | } |
117 | 110 | ||
118 | Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments); | 111 | Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments); |
119 | 112 | ||
120 | if (this._shouldTrace) { | 113 | if (this._shouldTrace) { |
121 | // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;}); | 114 | // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;}); |
122 | this.addCallbacks( | 115 | this.addCallbacks( |
123 | //function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;}, | 116 | function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;}, |
124 | function(aResult) {console.log("-OK- " + message + "<--", aResult); return aResult;}, | 117 | function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;} |
125 | //function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;} | ||
126 | function(aResult) {console.log("FAIL " + message + "<--", aResult); return aResult;} | ||
127 | ); | 118 | ); |
128 | } | 119 | } |
129 | }, | 120 | }, |
130 | 121 | ||
131 | //============================================================================= | 122 | //============================================================================= |
132 | 123 | ||
133 | 'addCallbackPass': function() { | 124 | 'addCallbackPass': function() { |
134 | var passFunction; | 125 | var passFunction; |
@@ -207,17 +198,16 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { | |||
207 | this.addCallback(MochiKit.Base.methodcaller.apply(this, arguments)); | 198 | this.addCallback(MochiKit.Base.methodcaller.apply(this, arguments)); |
208 | }, | 199 | }, |
209 | 200 | ||
210 | //============================================================================= | 201 | //============================================================================= |
211 | 202 | ||
212 | 'addLog': function (aLog) { | 203 | 'addLog': function (aLog) { |
213 | if (CLIPPERZ_DEFERRED_LOGGING_ENABLED) { | 204 | if (CLIPPERZ_DEFERRED_LOGGING_ENABLED) { |
214 | this.addBothPass(function(res) {Clipperz.log(aLog + " ", res);}); | 205 | this.addBothPass(function(res) {Clipperz.log(aLog + " ", res);}); |
215 | // this.addBothPass(function(res) {console.log(aLog + " ", res);}); | ||
216 | } | 206 | } |
217 | }, | 207 | }, |
218 | 208 | ||
219 | //============================================================================= | 209 | //============================================================================= |
220 | 210 | ||
221 | 'acquireLock': function (aLock) { | 211 | 'acquireLock': function (aLock) { |
222 | // this.addCallback(function (aResult) { | 212 | // this.addCallback(function (aResult) { |
223 | // return Clipperz.Async.callbacks("Clipperz.Async.acquireLock", [ | 213 | // return Clipperz.Async.callbacks("Clipperz.Async.acquireLock", [ |
@@ -232,17 +222,17 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { | |||
232 | 'releaseLock': function (aLock) { | 222 | 'releaseLock': function (aLock) { |
233 | // this.addCallback(function (aResult) { | 223 | // this.addCallback(function (aResult) { |
234 | // return Clipperz.Async.callbacks("Clipperz.Async.release <ok>", [ | 224 | // return Clipperz.Async.callbacks("Clipperz.Async.release <ok>", [ |
235 | // MochiKit.Base.method(aLock, 'release'), | 225 | // MochiKit.Base.method(aLock, 'release'), |
236 | // MochiKit.Base.partial(MochiKit.Async.succeed, aResult) | 226 | // MochiKit.Base.partial(MochiKit.Async.succeed, aResult) |
237 | // ], {trace:false}); | 227 | // ], {trace:false}); |
238 | // }); | 228 | // }); |
239 | // this.addErrback(function (aResult) { | 229 | // this.addErrback(function (aResult) { |
240 | ///console.log("releaseLock.addErrback:", aResult); | 230 | ///Clipperz.log("releaseLock.addErrback:", aResult); |
241 | // return Clipperz.Async.callbacks("Clipperz.Async.release <fail>", [ | 231 | // return Clipperz.Async.callbacks("Clipperz.Async.release <fail>", [ |
242 | // MochiKit.Base.method(aLock, 'release'), | 232 | // MochiKit.Base.method(aLock, 'release'), |
243 | // MochiKit.Base.partial(MochiKit.Async.fail, aResult) | 233 | // MochiKit.Base.partial(MochiKit.Async.fail, aResult) |
244 | // ], {trace:false}); | 234 | // ], {trace:false}); |
245 | // }); | 235 | // }); |
246 | 236 | ||
247 | // this.addBothPass(MochiKit.Base.method(aLock, 'release')); | 237 | // this.addBothPass(MochiKit.Base.method(aLock, 'release')); |
248 | this.addCallbackPass(MochiKit.Base.method(aLock, 'release')); | 238 | this.addCallbackPass(MochiKit.Base.method(aLock, 'release')); |
@@ -372,17 +362,17 @@ MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, { | |||
372 | args = args || {}; | 362 | args = args || {}; |
373 | 363 | ||
374 | c = this.methods().length; | 364 | c = this.methods().length; |
375 | for (i=0; i<c; i++) { | 365 | for (i=0; i<c; i++) { |
376 | var deferredResult; | 366 | var deferredResult; |
377 | varmethodCalls; | 367 | varmethodCalls; |
378 | var ii, cc; | 368 | var ii, cc; |
379 | 369 | ||
380 | //console.log("TYPEOF", typeof(this.methods()[i])); | 370 | //Clipperz.log("TYPEOF", typeof(this.methods()[i])); |
381 | if (typeof(this.methods()[i]) == 'function') { | 371 | if (typeof(this.methods()[i]) == 'function') { |
382 | methodCalls = [ this.methods()[i] ]; | 372 | methodCalls = [ this.methods()[i] ]; |
383 | } else { | 373 | } else { |
384 | methodCalls = this.methods()[i]; | 374 | methodCalls = this.methods()[i]; |
385 | } | 375 | } |
386 | 376 | ||
387 | cc = methodCalls.length; | 377 | cc = methodCalls.length; |
388 | deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.DeferredSynchronizer.run => " + this.name() + "[" + i + "]", args); | 378 | deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.DeferredSynchronizer.run => " + this.name() + "[" + i + "]", args); |
@@ -632,17 +622,17 @@ MochiKit.Base.update(Clipperz.Async, { | |||
632 | var deferredResult; | 622 | var deferredResult; |
633 | var i, c; | 623 | var i, c; |
634 | 624 | ||
635 | deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.deferredSort", {trace:false}); | 625 | deferredResult = new Clipperz.Async.Deferred("Clipperz.Async.deferredSort", {trace:false}); |
636 | c = someObjects.length; | 626 | c = someObjects.length; |
637 | for (i=0; i<c; i++) { | 627 | for (i=0; i<c; i++) { |
638 | deferredResult.addCallback(Clipperz.Async.insertIntoSortedArray, someObjects[i], aDeferredComparator); | 628 | deferredResult.addCallback(Clipperz.Async.insertIntoSortedArray, someObjects[i], aDeferredComparator); |
639 | if ((i % 50) == 0) { | 629 | if ((i % 50) == 0) { |
640 | //console.log("######### sort wait ##########"); | 630 | //Clipperz.log("######### sort wait ##########"); |
641 | deferredResult.addCallback(MochiKit.Async.wait, 0.5); | 631 | deferredResult.addCallback(MochiKit.Async.wait, 0.5); |
642 | } | 632 | } |
643 | } | 633 | } |
644 | deferredResult.callback([]); | 634 | deferredResult.callback([]); |
645 | 635 | ||
646 | return deferredResult; | 636 | return deferredResult; |
647 | }, | 637 | }, |
648 | 638 | ||
@@ -683,17 +673,17 @@ MochiKit.Base.update(Clipperz.Async, { | |||
683 | }, | 673 | }, |
684 | 674 | ||
685 | //========================================================================= | 675 | //========================================================================= |
686 | 676 | ||
687 | 'or': function (someValues) { | 677 | 'or': function (someValues) { |
688 | return Clipperz.Async.callbacks("Clipperz.Async.or", [ | 678 | return Clipperz.Async.callbacks("Clipperz.Async.or", [ |
689 | MochiKit.Base.values, | 679 | MochiKit.Base.values, |
690 | MochiKit.Base.flattenArguments, | 680 | MochiKit.Base.flattenArguments, |
691 | //function (aValue) { console.log("Record.hasAnyCleanTextData - flatten", aValue); return aValue; }, | 681 | //function (aValue) { Clipperz.log("Record.hasAnyCleanTextData - flatten", aValue); return aValue; }, |
692 | function(someInnerValues) { | 682 | function(someInnerValues) { |
693 | return MochiKit.Iter.some(someInnerValues, MochiKit.Base.operator.identity); | 683 | return MochiKit.Iter.some(someInnerValues, MochiKit.Base.operator.identity); |
694 | } | 684 | } |
695 | ], {trace:false}, someValues); | 685 | ], {trace:false}, someValues); |
696 | }, | 686 | }, |
697 | 687 | ||
698 | //========================================================================= | 688 | //========================================================================= |
699 | 689 | ||
diff --git a/frontend/gamma/js/Clipperz/Base.js b/frontend/gamma/js/Clipperz/Base.js index 9d399d9..84b2172 100644 --- a/frontend/gamma/js/Clipperz/Base.js +++ b/frontend/gamma/js/Clipperz/Base.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Base) == 'undefined') { Clipperz.Base = {}; } | 25 | if (typeof(Clipperz.Base) == 'undefined') { Clipperz.Base = {}; } |
28 | 26 | ||
29 | Clipperz.Base.VERSION = "0.2"; | 27 | Clipperz.Base.VERSION = "0.2"; |
30 | Clipperz.Base.NAME = "Clipperz.Base"; | 28 | Clipperz.Base.NAME = "Clipperz.Base"; |
@@ -436,27 +434,24 @@ MochiKit.Base.update(Clipperz.Base, { | |||
436 | 434 | ||
437 | 'module': function(aValue) { | 435 | 'module': function(aValue) { |
438 | // aValue = 'Clipperz.PM.Compact' | 436 | // aValue = 'Clipperz.PM.Compact' |
439 | // | 437 | // |
440 | // if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 438 | // if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
441 | // if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 439 | // if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
442 | // if (typeof(Clipperz.PM.UI.Common.Components) == 'undefined') { Clipperz.PM.UI.Common.Components = {}; } | 440 | // if (typeof(Clipperz.PM.UI.Common.Components) == 'undefined') { Clipperz.PM.UI.Common.Components = {}; } |
443 | 441 | ||
444 | //console.log(">>> module: " + aValue); | ||
445 | var currentScope; | 442 | var currentScope; |
446 | var pathElements; | 443 | var pathElements; |
447 | var i,c; | 444 | var i,c; |
448 | 445 | ||
449 | currentScope = window; | 446 | currentScope = window; |
450 | pathElements = aValue.split('.'); | 447 | pathElements = aValue.split('.'); |
451 | c = pathElements.length; | 448 | c = pathElements.length; |
452 | for (i=0; i<c; i++) { | 449 | for (i=0; i<c; i++) { |
453 | //console.log("--- current path element: " + pathElements[i]); | ||
454 | //console.log("--- current scope", currentScope); | ||
455 | if (typeof(currentScope[pathElements[i]]) == 'undefined') { | 450 | if (typeof(currentScope[pathElements[i]]) == 'undefined') { |
456 | currentScope[pathElements[i]] = {}; | 451 | currentScope[pathElements[i]] = {}; |
457 | } | 452 | } |
458 | 453 | ||
459 | currentScope = currentScope[pathElements[i]]; | 454 | currentScope = currentScope[pathElements[i]]; |
460 | } | 455 | } |
461 | }, | 456 | }, |
462 | 457 | ||
@@ -495,39 +490,25 @@ MochiKit.Base.registerComparator('Object dummy comparator', | |||
495 | function(a, b) { | 490 | function(a, b) { |
496 | return ((a.constructor == Object) && (b.constructor == Object)); | 491 | return ((a.constructor == Object) && (b.constructor == Object)); |
497 | }, | 492 | }, |
498 | function(a, b) { | 493 | function(a, b) { |
499 | var result; | 494 | var result; |
500 | var aKeys; | 495 | var aKeys; |
501 | var bKeys; | 496 | var bKeys; |
502 | 497 | ||
503 | //MochiKit.Logging.logDebug(">>> comparator"); | ||
504 | //MochiKit.Logging.logDebug("- a: " + Clipperz.Base.serializeJSON(a)); | ||
505 | //MochiKit.Logging.logDebug("- b: " + Clipperz.Base.serializeJSON(a)); | ||
506 | aKeys = MochiKit.Base.keys(a).sort(); | 498 | aKeys = MochiKit.Base.keys(a).sort(); |
507 | bKeys = MochiKit.Base.keys(b).sort(); | 499 | bKeys = MochiKit.Base.keys(b).sort(); |
508 | |||
509 | result = MochiKit.Base.compare(aKeys, bKeys); | 500 | result = MochiKit.Base.compare(aKeys, bKeys); |
510 | //if (result != 0) { | 501 | |
511 | //MochiKit.Logging.logDebug("- comparator 'keys':"); | ||
512 | //MochiKit.Logging.logDebug("- comparator aKeys: " + Clipperz.Base.serializeJSON(aKeys)); | ||
513 | //MochiKit.Logging.logDebug("- comparator bKeys: " + Clipperz.Base.serializeJSON(bKeys)); | ||
514 | //} | ||
515 | if (result == 0) { | 502 | if (result == 0) { |
516 | vari, c; | 503 | vari, c; |
517 | 504 | ||
518 | c = aKeys.length; | 505 | c = aKeys.length; |
519 | for (i=0; (i<c) && (result == 0); i++) { | 506 | for (i=0; (i<c) && (result == 0); i++) { |
520 | result = MochiKit.Base.compare(a[aKeys[i]], b[bKeys[i]]); | 507 | result = MochiKit.Base.compare(a[aKeys[i]], b[bKeys[i]]); |
521 | //if (result != 0) { | ||
522 | //MochiKit.Logging.logDebug("- comparator 'values':"); | ||
523 | //MochiKit.Logging.logDebug("- comparator a[aKeys[i]]: " + Clipperz.Base.serializeJSON(a[aKeys[i]])); | ||
524 | //MochiKit.Logging.logDebug("- comparator b[bKeys[i]]: " + Clipperz.Base.serializeJSON(b[bKeys[i]])); | ||
525 | //} | ||
526 | } | 508 | } |
527 | } | 509 | } |
528 | 510 | ||
529 | //MochiKit.Logging.logDebug("<<< comparator - result: " + result); | ||
530 | return result; | 511 | return result; |
531 | }, | 512 | }, |
532 | true | 513 | true |
533 | ); | 514 | ); |
diff --git a/frontend/gamma/js/Clipperz/ByteArray.js b/frontend/gamma/js/Clipperz/ByteArray.js index ae586e7..22c7c6e 100644 --- a/frontend/gamma/js/Clipperz/ByteArray.js +++ b/frontend/gamma/js/Clipperz/ByteArray.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | 25 | ||
28 | //============================================================================= | 26 | //============================================================================= |
29 | 27 | ||
30 | Clipperz.ByteArray_abstract = function(args) { | 28 | Clipperz.ByteArray_abstract = function(args) { |
@@ -84,21 +82,18 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
84 | 82 | ||
85 | 'length': function() { | 83 | 'length': function() { |
86 | throw Clipperz.Base.exception.AbstractMethod; | 84 | throw Clipperz.Base.exception.AbstractMethod; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | //------------------------------------------------------------------------- | 87 | //------------------------------------------------------------------------- |
90 | 88 | ||
91 | 'checkByteValue': function(aValue) { | 89 | 'checkByteValue': function(aValue) { |
92 | //Clipperz.log("aValue", aValue.toString(16)); | ||
93 | //Clipperz.log("(aValue & 0xff)", (aValue & 0xff).toString(16)); | ||
94 | |||
95 | if ((aValue & 0xff) != aValue) { | 90 | if ((aValue & 0xff) != aValue) { |
96 | MochiKit.Logging.logError("Clipperz.ByteArray.appendByte: the provided value (0x" + aValue.toString(16) + ") is not a byte value."); | 91 | Clipperz.logError("Clipperz.ByteArray.appendByte: the provided value (0x" + aValue.toString(16) + ") is not a byte value."); |
97 | throw Clipperz.ByteArray.exception.InvalidValue; | 92 | throw Clipperz.ByteArray.exception.InvalidValue; |
98 | } | 93 | } |
99 | }, | 94 | }, |
100 | 95 | ||
101 | //------------------------------------------------------------------------- | 96 | //------------------------------------------------------------------------- |
102 | 97 | ||
103 | 'xorMergeWithBlock': function(aBlock, anAllignment, paddingMode) { | 98 | 'xorMergeWithBlock': function(aBlock, anAllignment, paddingMode) { |
104 | var result; | 99 | var result; |
@@ -139,38 +134,26 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
139 | if (anAllignment == 'left') { | 134 | if (anAllignment == 'left') { |
140 | b = b.appendBlock(padding); | 135 | b = b.appendBlock(padding); |
141 | } else { | 136 | } else { |
142 | b = padding.appendBlock(b); | 137 | b = padding.appendBlock(b); |
143 | } | 138 | } |
144 | } | 139 | } |
145 | } | 140 | } |
146 | 141 | ||
147 | |||
148 | // result = new Clipperz.ByteArray(); | ||
149 | result = this.newInstance(); | 142 | result = this.newInstance(); |
150 | c = a.length(); | 143 | c = a.length(); |
151 | for (i=0; i<c; i++) { | 144 | for (i=0; i<c; i++) { |
152 | result.appendByte(a.byteAtIndex(i) ^ b.byteAtIndex(i)); | 145 | result.appendByte(a.byteAtIndex(i) ^ b.byteAtIndex(i)); |
153 | } | 146 | } |
154 | 147 | ||
155 | return result; | 148 | return result; |
156 | }, | 149 | }, |
157 | 150 | ||
158 | //------------------------------------------------------------------------- | 151 | //------------------------------------------------------------------------- |
159 | /* | ||
160 | 'shiftLeft': function(aNumberOfBitsToShift) { | ||
161 | var result; | ||
162 | |||
163 | result = this.clone(); //??????????? | ||
164 | |||
165 | return result; | ||
166 | }, | ||
167 | */ | ||
168 | //------------------------------------------------------------------------- | ||
169 | 152 | ||
170 | 'appendBlock': function(aBlock) { | 153 | 'appendBlock': function(aBlock) { |
171 | throw Clipperz.Base.exception.AbstractMethod; | 154 | throw Clipperz.Base.exception.AbstractMethod; |
172 | }, | 155 | }, |
173 | 156 | ||
174 | //------------------------------------------------------------------------- | 157 | //------------------------------------------------------------------------- |
175 | 158 | ||
176 | 'appendByte': function(aValue) { | 159 | 'appendByte': function(aValue) { |
@@ -287,17 +270,16 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
287 | selectedByte = this.byteAtIndex(bytePosition); | 270 | selectedByte = this.byteAtIndex(bytePosition); |
288 | 271 | ||
289 | if (bitPositionInSelectedByte > 0) { | 272 | if (bitPositionInSelectedByte > 0) { |
290 | selectedByteMask = (1 << bitPositionInSelectedByte); | 273 | selectedByteMask = (1 << bitPositionInSelectedByte); |
291 | } else { | 274 | } else { |
292 | selectedByteMask = 1; | 275 | selectedByteMask = 1; |
293 | } | 276 | } |
294 | result = selectedByte & selectedByteMask ? 1 : 0; | 277 | result = selectedByte & selectedByteMask ? 1 : 0; |
295 | //console.log("aBitPosition: " + aBitPosition + ", length: " + this.length() + ", bytePosition: " + bytePosition + ", bitPositionInSelectedByte: " + bitPositionInSelectedByte + ", selectedByteMask: " + selectedByteMask); | ||
296 | 278 | ||
297 | return result; | 279 | return result; |
298 | }, | 280 | }, |
299 | 281 | ||
300 | //------------------------------------------------------------------------- | 282 | //------------------------------------------------------------------------- |
301 | 283 | ||
302 | 'bitBlockAtIndexWithSize': function(aBitPosition, aSize) { | 284 | 'bitBlockAtIndexWithSize': function(aBitPosition, aSize) { |
303 | var result; | 285 | var result; |
@@ -316,19 +298,16 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
316 | 298 | ||
317 | //------------------------------------------------------------------------- | 299 | //------------------------------------------------------------------------- |
318 | 300 | ||
319 | 'asString': function() { | 301 | 'asString': function() { |
320 | varresult; | 302 | varresult; |
321 | varlength; | 303 | varlength; |
322 | vari; | 304 | vari; |
323 | 305 | ||
324 | //var startTime = new Date(); | ||
325 | |||
326 | //# result = ""; | ||
327 | result = []; | 306 | result = []; |
328 | 307 | ||
329 | i = 0; | 308 | i = 0; |
330 | length = this.length(); | 309 | length = this.length(); |
331 | 310 | ||
332 | while (i < length) { | 311 | while (i < length) { |
333 | varcurrentCharacter; | 312 | varcurrentCharacter; |
334 | varcurrentByte; | 313 | varcurrentByte; |
@@ -360,75 +339,57 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
360 | i++; currentByte = this.byteAtIndex(i); | 339 | i++; currentByte = this.byteAtIndex(i); |
361 | unicode = unicode | ((currentByte & 0x3f) << 6); | 340 | unicode = unicode | ((currentByte & 0x3f) << 6); |
362 | i++; currentByte = this.byteAtIndex(i); | 341 | i++; currentByte = this.byteAtIndex(i); |
363 | unicode = unicode | (currentByte & 0x3f); | 342 | unicode = unicode | (currentByte & 0x3f); |
364 | 343 | ||
365 | currentCharacter = String.fromCharCode(unicode); | 344 | currentCharacter = String.fromCharCode(unicode); |
366 | } | 345 | } |
367 | 346 | ||
368 | // result += currentCharacter; | ||
369 | result.push(currentCharacter); | 347 | result.push(currentCharacter); |
370 | i++; | 348 | i++; |
371 | } | 349 | } |
372 | 350 | ||
373 | //MochiKit.Logging.logDebug("[" + (new Date() - startTime) + "] ByteArray.asString"); | ||
374 | |||
375 | // return result; | ||
376 | return result.join(""); | 351 | return result.join(""); |
377 | }, | 352 | }, |
378 | 353 | ||
379 | //------------------------------------------------------------------------- | 354 | //------------------------------------------------------------------------- |
380 | 355 | ||
381 | 'toHexString': function() { | 356 | 'toHexString': function() { |
382 | throw Clipperz.Base.exception.AbstractMethod; | 357 | throw Clipperz.Base.exception.AbstractMethod; |
383 | }, | 358 | }, |
384 | 359 | ||
385 | //------------------------------------------------------------------------- | 360 | //------------------------------------------------------------------------- |
386 | 361 | ||
387 | 'base64map': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", | 362 | 'base64map': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", |
388 | 'base64mapIndex': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(''), | 363 | 'base64mapIndex': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(''), |
389 | //'base64mapInvertedIndex': { | ||
390 | // 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9, | ||
391 | // 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19, | ||
392 | // 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29, | ||
393 | // 'e': 30, 'f': 31, 'g': 32, 'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39, | ||
394 | // 'o': 40, 'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47, 'w': 48, 'x': 49, | ||
395 | // 'y': 50, 'z': 51, '0': 52, '1': 53, '2': 54, '3': 55, '4': 56, '5': 57, '6': 58, '7': 59, | ||
396 | // '8': 60, '9': 61, '+': 62, '/': 63, | ||
397 | // "=": -1}, | ||
398 | 364 | ||
399 | //------------------------------------------------------------------------- | 365 | //------------------------------------------------------------------------- |
400 | 366 | ||
401 | 'appendBase64String': function(aValue) { | 367 | 'appendBase64String': function(aValue) { |
402 | var i; | 368 | var i; |
403 | var length; | 369 | var length; |
404 | 370 | ||
405 | length = aValue.length; | 371 | length = aValue.length; |
406 | 372 | ||
407 | if ((length % 4) != 0) { | 373 | if ((length % 4) != 0) { |
408 | MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase64Value' is not correct"); | 374 | Clipperz.logError("the value passed to the 'ByteArray.setBase64Value' is not correct"); |
409 | throw Clipperz.ByteArray.exception.InvalidValue; | 375 | throw Clipperz.ByteArray.exception.InvalidValue; |
410 | } | 376 | } |
411 | 377 | ||
412 | i = 0; | 378 | i = 0; |
413 | while (i<length) { | 379 | while (i<length) { |
414 | var value1, value2, value3, value4; | 380 | var value1, value2, value3, value4; |
415 | var byte1, byte2, byte3; | 381 | var byte1, byte2, byte3; |
416 | 382 | ||
417 | value1 = this.base64map.indexOf(aValue.charAt(i)); | 383 | value1 = this.base64map.indexOf(aValue.charAt(i)); |
418 | value2 = this.base64map.indexOf(aValue.charAt(i+1)); | 384 | value2 = this.base64map.indexOf(aValue.charAt(i+1)); |
419 | value3 = this.base64map.indexOf(aValue.charAt(i+2)); | 385 | value3 = this.base64map.indexOf(aValue.charAt(i+2)); |
420 | value4 = this.base64map.indexOf(aValue.charAt(i+3)); | 386 | value4 = this.base64map.indexOf(aValue.charAt(i+3)); |
421 | 387 | ||
422 | // value1 = this.base64mapInvertedIndex[aValue.charAt(i)]; | ||
423 | // value2 = this.base64mapInvertedIndex[aValue.charAt(i+1)]; | ||
424 | // value3 = this.base64mapInvertedIndex[aValue.charAt(i+2)]; | ||
425 | // value4 = this.base64mapInvertedIndex[aValue.charAt(i+3)]; | ||
426 | |||
427 | byte1 = (value1 << 2) | ((value2 & 0x30) >> 4); | 388 | byte1 = (value1 << 2) | ((value2 & 0x30) >> 4); |
428 | if (value3 != -1) { | 389 | if (value3 != -1) { |
429 | byte2 = ((value2 & 0x0f) << 4) | ((value3 & 0x3c) >> 2); | 390 | byte2 = ((value2 & 0x0f) << 4) | ((value3 & 0x3c) >> 2); |
430 | 391 | ||
431 | if (value4 != -1) { | 392 | if (value4 != -1) { |
432 | byte3 = ((value3 & 0x03) << 6) | (value4); | 393 | byte3 = ((value3 & 0x03) << 6) | (value4); |
433 | } else { | 394 | } else { |
434 | byte3 = null; | 395 | byte3 = null; |
@@ -515,17 +476,17 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
515 | value = aValue.toLowerCase(); | 476 | value = aValue.toLowerCase(); |
516 | value = value.replace(/[\s\-]/g, ''); | 477 | value = value.replace(/[\s\-]/g, ''); |
517 | value = value.replace(/[0o]/g, '0'); | 478 | value = value.replace(/[0o]/g, '0'); |
518 | value = value.replace(/[1il]/g, '1'); | 479 | value = value.replace(/[1il]/g, '1'); |
519 | 480 | ||
520 | length = value.length; | 481 | length = value.length; |
521 | 482 | ||
522 | if ((length % 8) != 0) { | 483 | if ((length % 8) != 0) { |
523 | MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase32Value' is not correct"); | 484 | Clipperz.logError("the value passed to the 'ByteArray.setBase32Value' is not correct"); |
524 | throw Clipperz.ByteArray.exception.InvalidValue; | 485 | throw Clipperz.ByteArray.exception.InvalidValue; |
525 | } | 486 | } |
526 | 487 | ||
527 | i = 0; | 488 | i = 0; |
528 | while (i<length) { | 489 | while (i<length) { |
529 | value1 = this.base32map.indexOf(value.charAt(i)); | 490 | value1 = this.base32map.indexOf(value.charAt(i)); |
530 | value2 = this.base32map.indexOf(value.charAt(i+1)); | 491 | value2 = this.base32map.indexOf(value.charAt(i+1)); |
531 | value3 = this.base32map.indexOf(value.charAt(i+2)); | 492 | value3 = this.base32map.indexOf(value.charAt(i+2)); |
@@ -723,17 +684,17 @@ Clipperz.ByteArray_hex = function (args) { | |||
723 | value = args.substring(2).toLowerCase(); | 684 | value = args.substring(2).toLowerCase(); |
724 | if (/[0123456789abcdef]* /.test(value)) { the space in the regexp shoud be removed if the code is activate | 685 | if (/[0123456789abcdef]* /.test(value)) { the space in the regexp shoud be removed if the code is activate |
725 | if ((value.length % 2) == 0) { | 686 | if ((value.length % 2) == 0) { |
726 | this._value = value; | 687 | this._value = value; |
727 | } else { | 688 | } else { |
728 | this._value = "0" + value; | 689 | this._value = "0" + value; |
729 | } | 690 | } |
730 | } else { | 691 | } else { |
731 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | 692 | Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string."); |
732 | throw Clipperz.ByteArray.exception.InvalidValue; | 693 | throw Clipperz.ByteArray.exception.InvalidValue; |
733 | } | 694 | } |
734 | } else { | 695 | } else { |
735 | varvalue; | 696 | varvalue; |
736 | vari,c; | 697 | vari,c; |
737 | 698 | ||
738 | c = args.length; | 699 | c = args.length; |
739 | value = new Array(c); | 700 | value = new Array(c); |
@@ -909,17 +870,17 @@ Clipperz.ByteArray_array = function (args) { | |||
909 | if (args.indexOf("0x") == 0) { | 870 | if (args.indexOf("0x") == 0) { |
910 | 871 | ||
911 | value = args.substring(2).toLowerCase(); | 872 | value = args.substring(2).toLowerCase(); |
912 | if (/[0123456789abcdef]*/.test(value)) { | 873 | if (/[0123456789abcdef]*/.test(value)) { |
913 | if ((value.length % 2) != 0) { | 874 | if ((value.length % 2) != 0) { |
914 | value = "0" + value; | 875 | value = "0" + value; |
915 | } | 876 | } |
916 | } else { | 877 | } else { |
917 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | 878 | Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string."); |
918 | throw Clipperz.ByteArray.exception.InvalidValue; | 879 | throw Clipperz.ByteArray.exception.InvalidValue; |
919 | } | 880 | } |
920 | 881 | ||
921 | c = value.length / 2 | 882 | c = value.length / 2 |
922 | result = new Array(c); | 883 | result = new Array(c); |
923 | for (i=0; i<c; i++) { | 884 | for (i=0; i<c; i++) { |
924 | result[i] = parseInt(value.substr(i*2, 2), 16); | 885 | result[i] = parseInt(value.substr(i*2, 2), 16); |
925 | } | 886 | } |
@@ -1110,17 +1071,17 @@ Clipperz.ByteArray_string = function (args) { | |||
1110 | if (args.indexOf("0x") == 0) { | 1071 | if (args.indexOf("0x") == 0) { |
1111 | 1072 | ||
1112 | value = args.substring(2).toLowerCase(); | 1073 | value = args.substring(2).toLowerCase(); |
1113 | if (/[0123456789abcdef]* /.test(value)) { the space in the regexp shoud be removed if the code is activated | 1074 | if (/[0123456789abcdef]* /.test(value)) { the space in the regexp shoud be removed if the code is activated |
1114 | if ((value.length % 2) != 0) { | 1075 | if ((value.length % 2) != 0) { |
1115 | value = "0" + value; | 1076 | value = "0" + value; |
1116 | } | 1077 | } |
1117 | } else { | 1078 | } else { |
1118 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | 1079 | Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string."); |
1119 | throw Clipperz.ByteArray.exception.InvalidValue; | 1080 | throw Clipperz.ByteArray.exception.InvalidValue; |
1120 | } | 1081 | } |
1121 | } else { | 1082 | } else { |
1122 | value = ""; | 1083 | value = ""; |
1123 | c = args.length; | 1084 | c = args.length; |
1124 | for (i=0; i<c; i++) { | 1085 | for (i=0; i<c; i++) { |
1125 | value += Clipperz.ByteArray.unicodeToUtf8HexString(args.charCodeAt(i)); | 1086 | value += Clipperz.ByteArray.unicodeToUtf8HexString(args.charCodeAt(i)); |
1126 | } | 1087 | } |
diff --git a/frontend/gamma/js/Clipperz/CSVProcessor.js b/frontend/gamma/js/Clipperz/CSVProcessor.js index 0b18731..1288ed7 100644 --- a/frontend/gamma/js/Clipperz/CSVProcessor.js +++ b/frontend/gamma/js/Clipperz/CSVProcessor.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | 25 | ||
28 | 26 | ||
29 | Clipperz.CSVProcessor = function(args) { | 27 | Clipperz.CSVProcessor = function(args) { |
30 | args = args || {}; | 28 | args = args || {}; |
@@ -90,17 +88,17 @@ Clipperz.CSVProcessor.prototype = MochiKit.Base.update(null, { | |||
90 | 88 | ||
91 | //------------------------------------------------------------------------- | 89 | //------------------------------------------------------------------------- |
92 | /* | 90 | /* |
93 | 'parse': function(aValue) { | 91 | 'parse': function(aValue) { |
94 | var result; | 92 | var result; |
95 | var lines; | 93 | var lines; |
96 | var parameter; | 94 | var parameter; |
97 | 95 | ||
98 | //MochiKit.Logging.logDebug(">>> CSVProcessor.parse"); | 96 | //Clipperz.logDebug(">>> CSVProcessor.parse"); |
99 | result = []; | 97 | result = []; |
100 | 98 | ||
101 | lines = aValue.replace(/\r?\n/g, "\n").replace(/^\n* /g, "").replace(/\n$/g, "");; | 99 | lines = aValue.replace(/\r?\n/g, "\n").replace(/^\n* /g, "").replace(/\n$/g, "");; |
102 | parameter = { | 100 | parameter = { |
103 | line: lines | 101 | line: lines |
104 | } | 102 | } |
105 | 103 | ||
106 | do { | 104 | do { |
@@ -109,20 +107,20 @@ Clipperz.CSVProcessor.prototype = MochiKit.Base.update(null, { | |||
109 | fields = this.parseLine(parameter); | 107 | fields = this.parseLine(parameter); |
110 | 108 | ||
111 | if (fields != null) { | 109 | if (fields != null) { |
112 | result.push(fields); | 110 | result.push(fields); |
113 | } | 111 | } |
114 | 112 | ||
115 | parameter.line = parameter.line.replace(/^\n* /g, "").replace(/\n$/g, ""); | 113 | parameter.line = parameter.line.replace(/^\n* /g, "").replace(/\n$/g, ""); |
116 | 114 | ||
117 | //MochiKit.Logging.logDebug("line: '" + parameter.line + "'"); | 115 | //Clipperz.logDebug("line: '" + parameter.line + "'"); |
118 | } while (parameter.line != ""); | 116 | } while (parameter.line != ""); |
119 | //MochiKit.Logging.logDebug("--- CSVProcessor.parse - result: " + Clipperz.Base.serializeJSON(result)); | 117 | //Clipperz.logDebug("--- CSVProcessor.parse - result: " + Clipperz.Base.serializeJSON(result)); |
120 | //MochiKit.Logging.logDebug("<<< CSVProcessor.parse"); | 118 | //Clipperz.logDebug("<<< CSVProcessor.parse"); |
121 | 119 | ||
122 | return result; | 120 | return result; |
123 | }, | 121 | }, |
124 | */ | 122 | */ |
125 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'deferredParse_core': function(aContext) { | 125 | 'deferredParse_core': function(aContext) { |
128 | var deferredResult; | 126 | var deferredResult; |
@@ -211,17 +209,17 @@ Clipperz.CSVProcessor.prototype = MochiKit.Base.update(null, { | |||
211 | escapedQuoteBeginRegexp = new RegExp("^" + '\\' + this.escapeChar() + '\\' + this.quoteChar()); | 209 | escapedQuoteBeginRegexp = new RegExp("^" + '\\' + this.escapeChar() + '\\' + this.quoteChar()); |
212 | singleQuoteCommaEndRegexp= new RegExp("^" + '\\' + this.quoteChar() + '\\' + this.separatorChar()); | 210 | singleQuoteCommaEndRegexp= new RegExp("^" + '\\' + this.quoteChar() + '\\' + this.separatorChar()); |
213 | singleQuoteNewLineEndRegexp= new RegExp("^" + '\\' + this.quoteChar() + "\n"); | 211 | singleQuoteNewLineEndRegexp= new RegExp("^" + '\\' + this.quoteChar() + "\n"); |
214 | commaBeginRegexp = new RegExp("^" + '\\' + this.separatorChar()); | 212 | commaBeginRegexp = new RegExp("^" + '\\' + this.separatorChar()); |
215 | newlineRegexp = new RegExp("^\n"); | 213 | newlineRegexp = new RegExp("^\n"); |
216 | 214 | ||
217 | inQuotes = false; | 215 | inQuotes = false; |
218 | 216 | ||
219 | //MochiKit.Logging.logDebug("#################################### '" + aParameter.line + "'"); | 217 | //Clipperz.logDebug("#################################### '" + aParameter.line + "'"); |
220 | if (aParameter.line == "") { | 218 | if (aParameter.line == "") { |
221 | if (aParameter.isThereAnEmptyFinalField == true) { | 219 | if (aParameter.isThereAnEmptyFinalField == true) { |
222 | aParameter.isThereAnEmptyFinalField = false; | 220 | aParameter.isThereAnEmptyFinalField = false; |
223 | result = ""; | 221 | result = ""; |
224 | } else { | 222 | } else { |
225 | result = null; | 223 | result = null; |
226 | } | 224 | } |
227 | } else { | 225 | } else { |
@@ -235,80 +233,80 @@ Clipperz.CSVProcessor.prototype = MochiKit.Base.update(null, { | |||
235 | try { | 233 | try { |
236 | var done; | 234 | var done; |
237 | 235 | ||
238 | done = false; | 236 | done = false; |
239 | result = ""; | 237 | result = ""; |
240 | 238 | ||
241 | while (!done) { | 239 | while (!done) { |
242 | if (aParameter.line.length < 1) { | 240 | if (aParameter.line.length < 1) { |
243 | //MochiKit.Logging.logDebug("---> 1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 241 | //Clipperz.logDebug("---> 1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
244 | if (inQuotes == true) { | 242 | if (inQuotes == true) { |
245 | //MochiKit.Logging.logDebug("---> 1.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 243 | //Clipperz.logDebug("---> 1.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
246 | throw new Error("CSV Parsing error; end of string, missing closing double-quote..."); | 244 | throw new Error("CSV Parsing error; end of string, missing closing double-quote..."); |
247 | } else { | 245 | } else { |
248 | //MochiKit.Logging.logDebug("---> 1.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 246 | //Clipperz.logDebug("---> 1.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
249 | done = true; | 247 | done = true; |
250 | } | 248 | } |
251 | } else if (escapedQuoteBeginRegexp.test(aParameter.line)) { | 249 | } else if (escapedQuoteBeginRegexp.test(aParameter.line)) { |
252 | //MochiKit.Logging.logDebug("---> 2.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 250 | //Clipperz.logDebug("---> 2.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
253 | result += this.quoteChar(); | 251 | result += this.quoteChar(); |
254 | aParameter.line = aParameter.line.substr(2, aParameter.line.length - 1); | 252 | aParameter.line = aParameter.line.substr(2, aParameter.line.length - 1); |
255 | //MochiKit.Logging.logDebug("<--- 2.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 253 | //Clipperz.logDebug("<--- 2.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
256 | } else if (singleQuoteBeginRegexp.test(aParameter.line)) { | 254 | } else if (singleQuoteBeginRegexp.test(aParameter.line)) { |
257 | //MochiKit.Logging.logDebug("---> 3: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 255 | //Clipperz.logDebug("---> 3: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
258 | if (inQuotes == true) { | 256 | if (inQuotes == true) { |
259 | if (aParameter.line.length == 1) { | 257 | if (aParameter.line.length == 1) { |
260 | //MochiKit.Logging.logDebug("---> 3.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 258 | //Clipperz.logDebug("---> 3.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
261 | aParameter.line = ''; | 259 | aParameter.line = ''; |
262 | done = true; | 260 | done = true; |
263 | } else if (singleQuoteCommaEndRegexp.test(aParameter.line)) { | 261 | } else if (singleQuoteCommaEndRegexp.test(aParameter.line)) { |
264 | //MochiKit.Logging.logDebug("---> 3.3: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 262 | //Clipperz.logDebug("---> 3.3: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
265 | aParameter.line = aParameter.line.substr(2, aParameter.line.length - 1); | 263 | aParameter.line = aParameter.line.substr(2, aParameter.line.length - 1); |
266 | done = true; | 264 | done = true; |
267 | //MochiKit.Logging.logDebug("<--- 3.3: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 265 | //Clipperz.logDebug("<--- 3.3: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
268 | } else if (singleQuoteNewLineEndRegexp.test(aParameter.line)) { | 266 | } else if (singleQuoteNewLineEndRegexp.test(aParameter.line)) { |
269 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); | 267 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); |
270 | done = true; | 268 | done = true; |
271 | } else { | 269 | } else { |
272 | throw new Error("CSV Parsing error; double-quote, followed by undesirable character (bad character sequence)... " + aParameter.line); | 270 | throw new Error("CSV Parsing error; double-quote, followed by undesirable character (bad character sequence)... " + aParameter.line); |
273 | } | 271 | } |
274 | } else { | 272 | } else { |
275 | //MochiKit.Logging.logDebug("---> 4: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 273 | //Clipperz.logDebug("---> 4: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
276 | if (result == "") { | 274 | if (result == "") { |
277 | //MochiKit.Logging.logDebug("---> 4.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 275 | //Clipperz.logDebug("---> 4.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
278 | inQuotes = true; | 276 | inQuotes = true; |
279 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); | 277 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); |
280 | //MochiKit.Logging.logDebug("<--- 4.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 278 | //Clipperz.logDebug("<--- 4.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
281 | } else { | 279 | } else { |
282 | throw new Error("CSV Parsing error; double-quote, outside of double-quotes (bad character sequence)..."); | 280 | throw new Error("CSV Parsing error; double-quote, outside of double-quotes (bad character sequence)..."); |
283 | } | 281 | } |
284 | } | 282 | } |
285 | } else if (commaBeginRegexp.test(aParameter.line)) { | 283 | } else if (commaBeginRegexp.test(aParameter.line)) { |
286 | //MochiKit.Logging.logDebug("---> 5: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 284 | //Clipperz.logDebug("---> 5: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
287 | if (inQuotes) { | 285 | if (inQuotes) { |
288 | //MochiKit.Logging.logDebug("---> 5.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 286 | //Clipperz.logDebug("---> 5.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
289 | result += aParameter.line.substr(0 ,1); | 287 | result += aParameter.line.substr(0 ,1); |
290 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); | 288 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); |
291 | //MochiKit.Logging.logDebug("<--- 5.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 289 | //Clipperz.logDebug("<--- 5.1: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
292 | } else { | 290 | } else { |
293 | //MochiKit.Logging.logDebug("---> 5.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 291 | //Clipperz.logDebug("---> 5.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
294 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); | 292 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); |
295 | if (newlineRegexp.test(aParameter.line) || aParameter.line == "") { | 293 | if (newlineRegexp.test(aParameter.line) || aParameter.line == "") { |
296 | //MochiKit.Logging.logDebug("######"); | 294 | //Clipperz.logDebug("######"); |
297 | aParameter.isThereAnEmptyFinalField = true; | 295 | aParameter.isThereAnEmptyFinalField = true; |
298 | }; | 296 | }; |
299 | done = true; | 297 | done = true; |
300 | //MochiKit.Logging.logDebug("<--- 5.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 298 | //Clipperz.logDebug("<--- 5.2: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
301 | } | 299 | } |
302 | } else if (validRegexp.test(aParameter.line)) { | 300 | } else if (validRegexp.test(aParameter.line)) { |
303 | //MochiKit.Logging.logDebug("---> 6: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 301 | //Clipperz.logDebug("---> 6: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
304 | result += aParameter.line.substr(0, 1); | 302 | result += aParameter.line.substr(0, 1); |
305 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); | 303 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); |
306 | //MochiKit.Logging.logDebug("<--- 6: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); | 304 | //Clipperz.logDebug("<--- 6: '" + aParameter.line.replace(/\n/g, "\\n") + "'"); |
307 | } else if (newlineRegexp.test(aParameter.line)) { | 305 | } else if (newlineRegexp.test(aParameter.line)) { |
308 | if (inQuotes == true) { | 306 | if (inQuotes == true) { |
309 | result += aParameter.line.substr(0 ,1); | 307 | result += aParameter.line.substr(0 ,1); |
310 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); | 308 | aParameter.line = aParameter.line.substr(1, aParameter.line.length - 1); |
311 | } else { | 309 | } else { |
312 | if (result == "") { | 310 | if (result == "") { |
313 | if (aParameter.isThereAnEmptyFinalField == true) { | 311 | if (aParameter.isThereAnEmptyFinalField == true) { |
314 | aParameter.isThereAnEmptyFinalField = false; | 312 | aParameter.isThereAnEmptyFinalField = false; |
@@ -319,26 +317,26 @@ Clipperz.CSVProcessor.prototype = MochiKit.Base.update(null, { | |||
319 | 317 | ||
320 | done = true; | 318 | done = true; |
321 | } | 319 | } |
322 | } else { | 320 | } else { |
323 | throw new Error("CSV Parsing error; an undesirable character... '" + aParameter.line.substr(0,1) + "'"); | 321 | throw new Error("CSV Parsing error; an undesirable character... '" + aParameter.line.substr(0,1) + "'"); |
324 | } | 322 | } |
325 | } | 323 | } |
326 | } catch(exception) { | 324 | } catch(exception) { |
327 | MochiKit.Logging.logError(exception.message); | 325 | Clipperz.logError(exception.message); |
328 | // result = null; | 326 | // result = null; |
329 | throw exception; | 327 | throw exception; |
330 | } | 328 | } |
331 | } | 329 | } |
332 | 330 | ||
333 | //if (result != null) { | 331 | //if (result != null) { |
334 | //MochiKit.Logging.logDebug("<=== result: '" + result.replace(/\n/g, "\\n") + "'"); | 332 | //Clipperz.logDebug("<=== result: '" + result.replace(/\n/g, "\\n") + "'"); |
335 | //} else { | 333 | //} else { |
336 | //MochiKit.Logging.logDebug("<=== result: NULL"); | 334 | //Clipperz.logDebug("<=== result: NULL"); |
337 | //} | 335 | //} |
338 | 336 | ||
339 | return result; | 337 | return result; |
340 | }, | 338 | }, |
341 | 339 | ||
342 | //------------------------------------------------------------------------- | 340 | //------------------------------------------------------------------------- |
343 | __syntaxFix__: "syntax fix" | 341 | __syntaxFix__: "syntax fix" |
344 | }); | 342 | }); |
diff --git a/frontend/gamma/js/Clipperz/Crypto/AES.js b/frontend/gamma/js/Clipperz/Crypto/AES.js index c811f1c..cb56f11 100644 --- a/frontend/gamma/js/Clipperz/Crypto/AES.js +++ b/frontend/gamma/js/Clipperz/Crypto/AES.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!"; | 25 | throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | //Dependency commented to avoid a circular reference | 28 | //Dependency commented to avoid a circular reference |
@@ -115,17 +113,16 @@ Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(nu | |||
115 | }, | 113 | }, |
116 | 114 | ||
117 | 'pause': function(aValue) { | 115 | 'pause': function(aValue) { |
118 | // return MochiKit.Async.wait(Clipperz.Crypto.AES.DeferredExecution.pauseTime, aValue); | 116 | // return MochiKit.Async.wait(Clipperz.Crypto.AES.DeferredExecution.pauseTime, aValue); |
119 | return MochiKit.Async.wait(this._pauseTime, aValue); | 117 | return MochiKit.Async.wait(this._pauseTime, aValue); |
120 | }, | 118 | }, |
121 | 119 | ||
122 | 'isDone': function () { | 120 | 'isDone': function () { |
123 | //console.log("isDone", this.executionStep(), this.messageLength()); | ||
124 | return (this._executionStep >= this._messageLength); | 121 | return (this._executionStep >= this._messageLength); |
125 | }, | 122 | }, |
126 | 123 | ||
127 | //----------------------------------------------------------------------------- | 124 | //----------------------------------------------------------------------------- |
128 | __syntaxFix__: "syntax fix" | 125 | __syntaxFix__: "syntax fix" |
129 | 126 | ||
130 | }); | 127 | }); |
131 | 128 | ||
@@ -139,17 +136,17 @@ Clipperz.Crypto.AES.Key = function(args) { | |||
139 | 136 | ||
140 | if (this.keySize() == 128/8) { | 137 | if (this.keySize() == 128/8) { |
141 | this._b = 176; | 138 | this._b = 176; |
142 | this._numberOfRounds = 10; | 139 | this._numberOfRounds = 10; |
143 | } else if (this.keySize() == 256/8) { | 140 | } else if (this.keySize() == 256/8) { |
144 | this._b = 240; | 141 | this._b = 240; |
145 | this._numberOfRounds = 14; | 142 | this._numberOfRounds = 14; |
146 | } else { | 143 | } else { |
147 | MochiKit.Logging.logError("AES unsupported key size: " + (this.keySize() * 8) + " bits"); | 144 | Clipperz.logError("AES unsupported key size: " + (this.keySize() * 8) + " bits"); |
148 | throw Clipperz.Crypto.AES.exception.UnsupportedKeySize; | 145 | throw Clipperz.Crypto.AES.exception.UnsupportedKeySize; |
149 | } | 146 | } |
150 | 147 | ||
151 | this._stretchedKey = null; | 148 | this._stretchedKey = null; |
152 | 149 | ||
153 | return this; | 150 | return this; |
154 | } | 151 | } |
155 | 152 | ||
@@ -803,27 +800,25 @@ MochiKit.Base.update(Clipperz.Crypto.AES, { | |||
803 | var key; | 800 | var key; |
804 | 801 | ||
805 | key = new Clipperz.Crypto.AES.Key({key:aKey}); | 802 | key = new Clipperz.Crypto.AES.Key({key:aKey}); |
806 | nonce = aNonce ? aNonce.clone() : Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(128/8); | 803 | nonce = aNonce ? aNonce.clone() : Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(128/8); |
807 | 804 | ||
808 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:someData, nonce:nonce}); | 805 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:someData, nonce:nonce}); |
809 | 806 | ||
810 | deferredResult = new Clipperz.Async.Deferred("AES.deferredEncrypt"); | 807 | deferredResult = new Clipperz.Async.Deferred("AES.deferredEncrypt"); |
811 | //deferredResult.addCallback(function (aValue) { console.log(">>> deferredEncrypt"); return aValue; }); | ||
812 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); | 808 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); |
813 | deferredResult.addCallback(function(anExecutionContext) { | 809 | deferredResult.addCallback(function(anExecutionContext) { |
814 | var result; | 810 | var result; |
815 | 811 | ||
816 | result = anExecutionContext.nonce().clone(); | 812 | result = anExecutionContext.nonce().clone(); |
817 | result.appendBytes(anExecutionContext.resultArray()); | 813 | result.appendBytes(anExecutionContext.resultArray()); |
818 | 814 | ||
819 | return result; | 815 | return result; |
820 | }); | 816 | }); |
821 | //deferredResult.addCallback(function (aValue) { console.log("<<< deferredEncrypt"); return aValue; }); | ||
822 | deferredResult.callback(executionContext) | 817 | deferredResult.callback(executionContext) |
823 | 818 | ||
824 | return deferredResult; | 819 | return deferredResult; |
825 | }, | 820 | }, |
826 | 821 | ||
827 | //----------------------------------------------------------------------------- | 822 | //----------------------------------------------------------------------------- |
828 | 823 | ||
829 | 'deferredDecrypt': function(aKey, someData) { | 824 | 'deferredDecrypt': function(aKey, someData) { |
@@ -833,22 +828,20 @@ MochiKit.Base.update(Clipperz.Crypto.AES, { | |||
833 | var key; | 828 | var key; |
834 | 829 | ||
835 | key = new Clipperz.Crypto.AES.Key({key:aKey}); | 830 | key = new Clipperz.Crypto.AES.Key({key:aKey}); |
836 | nonce = someData.split(0, (128/8)); | 831 | nonce = someData.split(0, (128/8)); |
837 | message = someData.split(128/8); | 832 | message = someData.split(128/8); |
838 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:message, nonce:nonce}); | 833 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:message, nonce:nonce}); |
839 | 834 | ||
840 | deferredResult = new Clipperz.Async.Deferred("AES.deferredDecrypt"); | 835 | deferredResult = new Clipperz.Async.Deferred("AES.deferredDecrypt"); |
841 | //deferredResult.addCallback(function (aValue) { console.log(">>> deferredDecrypt"); return aValue; }); | ||
842 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); | 836 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); |
843 | deferredResult.addCallback(function(anExecutionContext) { | 837 | deferredResult.addCallback(function(anExecutionContext) { |
844 | return anExecutionContext.result(); | 838 | return anExecutionContext.result(); |
845 | }); | 839 | }); |
846 | //deferredResult.addCallback(function (aValue) { console.log("<<< deferredDecrypt"); return aValue; }); | ||
847 | deferredResult.callback(executionContext); | 840 | deferredResult.callback(executionContext); |
848 | 841 | ||
849 | return deferredResult; | 842 | return deferredResult; |
850 | }, | 843 | }, |
851 | 844 | ||
852 | //----------------------------------------------------------------------------- | 845 | //----------------------------------------------------------------------------- |
853 | __syntaxFix__: "syntax fix" | 846 | __syntaxFix__: "syntax fix" |
854 | 847 | ||
diff --git a/frontend/gamma/js/Clipperz/Crypto/Base.js b/frontend/gamma/js/Clipperz/Crypto/Base.js index d3a8e36..9acfc49 100644 --- a/frontend/gamma/js/Clipperz/Crypto/Base.js +++ b/frontend/gamma/js/Clipperz/Crypto/Base.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.Crypto.Base depends on Clipperz.Base!"; | 25 | throw "Clipperz.Crypto.Base depends on Clipperz.Base!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 28 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
diff --git a/frontend/gamma/js/Clipperz/Crypto/BigInt.js b/frontend/gamma/js/Clipperz/Crypto/BigInt.js index 41483a3..031ed30 100644 --- a/frontend/gamma/js/Clipperz/Crypto/BigInt.js +++ b/frontend/gamma/js/Clipperz/Crypto/BigInt.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 25 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
28 | 26 | ||
29 | //############################################################################# | 27 | //############################################################################# |
30 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js | 28 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js |
@@ -1472,17 +1470,16 @@ MochiKit.Base.update(Clipperz.Crypto.BigInt.prototype, { | |||
1472 | } else { | 1470 | } else { |
1473 | base = aBase; | 1471 | base = aBase; |
1474 | } | 1472 | } |
1475 | 1473 | ||
1476 | result = bigInt2str(this.internalValue(), base).toLowerCase(); | 1474 | result = bigInt2str(this.internalValue(), base).toLowerCase(); |
1477 | 1475 | ||
1478 | if ((typeof(minimumLength) != 'undefined') && (result.length < minimumLength)) { | 1476 | if ((typeof(minimumLength) != 'undefined') && (result.length < minimumLength)) { |
1479 | var i, c; | 1477 | var i, c; |
1480 | //MochiKit.Logging.logDebug(">>> FIXING BigInt.asString length issue") | ||
1481 | c = (minimumLength - result.length); | 1478 | c = (minimumLength - result.length); |
1482 | for (i=0; i<c; i++) { | 1479 | for (i=0; i<c; i++) { |
1483 | result = '0' + result; | 1480 | result = '0' + result; |
1484 | } | 1481 | } |
1485 | } | 1482 | } |
1486 | 1483 | ||
1487 | return result; | 1484 | return result; |
1488 | }, | 1485 | }, |
diff --git a/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js b/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js index f91c7e9..bc60330 100644 --- a/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js +++ b/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 25 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
28 | 26 | ||
29 | if (typeof(Leemon) == 'undefined') { Leemon = {}; } | 27 | if (typeof(Leemon) == 'undefined') { Leemon = {}; } |
30 | if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; } | 28 | if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; } |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js index 19f19c2..0d76b9c 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
29 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | 27 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } |
30 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | 28 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } |
@@ -97,74 +95,56 @@ Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | |||
97 | return result; | 95 | return result; |
98 | }, | 96 | }, |
99 | 97 | ||
100 | //----------------------------------------------------------------------------- | 98 | //----------------------------------------------------------------------------- |
101 | 99 | ||
102 | 'add': function(aPointA, aPointB) { | 100 | 'add': function(aPointA, aPointB) { |
103 | var result; | 101 | var result; |
104 | 102 | ||
105 | //console.log(">>> ECC.BinaryField.Curve.add"); | ||
106 | if (aPointA.isZero()) { | 103 | if (aPointA.isZero()) { |
107 | //console.log("--- pointA == zero"); | ||
108 | result = aPointB; | 104 | result = aPointB; |
109 | } else if (aPointB.isZero()) { | 105 | } else if (aPointB.isZero()) { |
110 | //console.log("--- pointB == zero"); | ||
111 | result = aPointA; | 106 | result = aPointA; |
112 | } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) { | 107 | } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) { |
113 | //console.log("compare A.x - B.x: ", aPointA.x().compare(aPointB.x())); | ||
114 | //console.log("compare A.y - B.y: ", (aPointA.y().compare(aPointB.y()) != 0)); | ||
115 | //console.log("compare B.x.isZero(): ", aPointB.x().isZero()); | ||
116 | |||
117 | //console.log("--- result = zero"); | ||
118 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | 108 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); |
119 | } else { | 109 | } else { |
120 | //console.log("--- result = ELSE"); | ||
121 | varf2m; | 110 | varf2m; |
122 | var x, y; | 111 | var x, y; |
123 | var lambda; | 112 | var lambda; |
124 | var aX, aY, bX, bY; | 113 | var aX, aY, bX, bY; |
125 | 114 | ||
126 | aX = aPointA.x()._value; | 115 | aX = aPointA.x()._value; |
127 | aY = aPointA.y()._value; | 116 | aY = aPointA.y()._value; |
128 | bX = aPointB.x()._value; | 117 | bX = aPointB.x()._value; |
129 | bY = aPointB.y()._value; | 118 | bY = aPointB.y()._value; |
130 | 119 | ||
131 | f2m = this.finiteField(); | 120 | f2m = this.finiteField(); |
132 | 121 | ||
133 | if (aPointA.x().compare(aPointB.x()) != 0) { | 122 | if (aPointA.x().compare(aPointB.x()) != 0) { |
134 | //console.log(" a.x != b.x"); | ||
135 | lambda =f2m._fastMultiply( | 123 | lambda =f2m._fastMultiply( |
136 | f2m._add(aY, bY), | 124 | f2m._add(aY, bY), |
137 | f2m._inverse(f2m._add(aX, bX)) | 125 | f2m._inverse(f2m._add(aX, bX)) |
138 | ); | 126 | ); |
139 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 127 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
140 | f2m._overwriteAdd(x, lambda); | 128 | f2m._overwriteAdd(x, lambda); |
141 | f2m._overwriteAdd(x, aX); | 129 | f2m._overwriteAdd(x, aX); |
142 | f2m._overwriteAdd(x, bX); | 130 | f2m._overwriteAdd(x, bX); |
143 | } else { | 131 | } else { |
144 | //console.log(" a.x == b.x"); | ||
145 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); | 132 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); |
146 | //console.log(" lambda: " + lambda.asString(16)); | ||
147 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 133 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
148 | //console.log(" x (step 1): " + x.asString(16)); | ||
149 | f2m._overwriteAdd(x, lambda); | 134 | f2m._overwriteAdd(x, lambda); |
150 | //console.log(" x (step 2): " + x.asString(16)); | ||
151 | } | 135 | } |
152 | 136 | ||
153 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); | 137 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); |
154 | //console.log(" y (step 1): " + y.asString(16)); | ||
155 | f2m._overwriteAdd(y, x); | 138 | f2m._overwriteAdd(y, x); |
156 | //console.log(" y (step 2): " + y.asString(16)); | ||
157 | f2m._overwriteAdd(y, bY); | 139 | f2m._overwriteAdd(y, bY); |
158 | //console.log(" y (step 3): " + y.asString(16)); | ||
159 | 140 | ||
160 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) | 141 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) |
161 | } | 142 | } |
162 | //console.log("<<< ECC.BinaryField.Curve.add"); | ||
163 | 143 | ||
164 | return result; | 144 | return result; |
165 | }, | 145 | }, |
166 | 146 | ||
167 | //----------------------------------------------------------------------------- | 147 | //----------------------------------------------------------------------------- |
168 | 148 | ||
169 | 'addTwice': function(aPointA) { | 149 | 'addTwice': function(aPointA) { |
170 | return this.add(aPointA, aPointA); | 150 | return this.add(aPointA, aPointA); |
@@ -192,48 +172,39 @@ Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | |||
192 | aX = aPointA.x()._value; | 172 | aX = aPointA.x()._value; |
193 | aY = aPointA.y()._value; | 173 | aY = aPointA.y()._value; |
194 | bX = aPointB.x()._value; | 174 | bX = aPointB.x()._value; |
195 | bY = aPointB.y()._value; | 175 | bY = aPointB.y()._value; |
196 | 176 | ||
197 | f2m = this.finiteField(); | 177 | f2m = this.finiteField(); |
198 | 178 | ||
199 | if (aPointA.x().compare(aPointB.x()) != 0) { | 179 | if (aPointA.x().compare(aPointB.x()) != 0) { |
200 | //console.log(" a.x != b.x"); | ||
201 | lambda =f2m._fastMultiply( | 180 | lambda =f2m._fastMultiply( |
202 | f2m._add(aY, bY), | 181 | f2m._add(aY, bY), |
203 | f2m._inverse(f2m._add(aX, bX)) | 182 | f2m._inverse(f2m._add(aX, bX)) |
204 | ); | 183 | ); |
205 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 184 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
206 | f2m._overwriteAdd(x, lambda); | 185 | f2m._overwriteAdd(x, lambda); |
207 | f2m._overwriteAdd(x, aX); | 186 | f2m._overwriteAdd(x, aX); |
208 | f2m._overwriteAdd(x, bX); | 187 | f2m._overwriteAdd(x, bX); |
209 | } else { | 188 | } else { |
210 | //console.log(" a.x == b.x"); | ||
211 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); | 189 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); |
212 | //console.log(" lambda: " + lambda.asString(16)); | ||
213 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 190 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
214 | //console.log(" x (step 1): " + x.asString(16)); | ||
215 | f2m._overwriteAdd(x, lambda); | 191 | f2m._overwriteAdd(x, lambda); |
216 | //console.log(" x (step 2): " + x.asString(16)); | ||
217 | } | 192 | } |
218 | 193 | ||
219 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); | 194 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); |
220 | //console.log(" y (step 1): " + y.asString(16)); | ||
221 | f2m._overwriteAdd(y, x); | 195 | f2m._overwriteAdd(y, x); |
222 | //console.log(" y (step 2): " + y.asString(16)); | ||
223 | f2m._overwriteAdd(y, bY); | 196 | f2m._overwriteAdd(y, bY); |
224 | //console.log(" y (step 3): " + y.asString(16)); | ||
225 | 197 | ||
226 | // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) | 198 | // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) |
227 | aPointA._x._value = x; | 199 | aPointA._x._value = x; |
228 | aPointA._y._value = y; | 200 | aPointA._y._value = y; |
229 | 201 | ||
230 | } | 202 | } |
231 | //console.log("<<< ECC.BinaryField.Curve.add"); | ||
232 | 203 | ||
233 | return result; | 204 | return result; |
234 | }, | 205 | }, |
235 | 206 | ||
236 | //----------------------------------------------------------------------------- | 207 | //----------------------------------------------------------------------------- |
237 | 208 | ||
238 | 'multiply': function(aValue, aPoint) { | 209 | 'multiply': function(aValue, aPoint) { |
239 | var result; | 210 | var result; |
@@ -245,94 +216,81 @@ Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | |||
245 | var k, Q; | 216 | var k, Q; |
246 | var i; | 217 | var i; |
247 | var countIndex; countIndex = 0; | 218 | var countIndex; countIndex = 0; |
248 | 219 | ||
249 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { | 220 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { |
250 | k = aValue; | 221 | k = aValue; |
251 | Q = aPoint; | 222 | Q = aPoint; |
252 | } else { | 223 | } else { |
253 | MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); | 224 | Clipperz.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); |
254 | k = aValue.negate(); | 225 | k = aValue.negate(); |
255 | Q = this.negate(aPoint); | 226 | Q = this.negate(aPoint); |
256 | } | 227 | } |
257 | 228 | ||
258 | //console.log("k: " + k.toString(16)); | ||
259 | //console.log("k.bitSize: " + k.bitSize()); | ||
260 | for (i=k.bitSize()-1; i>=0; i--) { | 229 | for (i=k.bitSize()-1; i>=0; i--) { |
261 | result = this.add(result, result); | 230 | result = this.add(result, result); |
262 | // this.overwriteAdd(result, result); | 231 | // this.overwriteAdd(result, result); |
263 | if (k.isBitSet(i)) { | 232 | if (k.isBitSet(i)) { |
264 | result = this.add(result, Q); | 233 | result = this.add(result, Q); |
265 | // this.overwriteAdd(result, Q); | 234 | // this.overwriteAdd(result, Q); |
266 | } | 235 | } |
267 | 236 | ||
268 | // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++; | 237 | // if (countIndex==100) {Clipperz.log("multiply.break"); break;} else countIndex++; |
269 | } | 238 | } |
270 | } | 239 | } |
271 | //console.profileEnd(); | 240 | //console.profileEnd(); |
272 | 241 | ||
273 | return result; | 242 | return result; |
274 | }, | 243 | }, |
275 | 244 | ||
276 | //----------------------------------------------------------------------------- | 245 | //----------------------------------------------------------------------------- |
277 | 246 | ||
278 | 'deferredMultiply': function(aValue, aPoint) { | 247 | 'deferredMultiply': function(aValue, aPoint) { |
279 | var deferredResult; | 248 | var deferredResult; |
280 | var result; | 249 | var result; |
281 | 250 | ||
282 | MochiKit.Logging.logDebug(">>> deferredMultiply - value: " + aValue + ", point: " + aPoint); | 251 | Clipperz.log(">>> deferredMultiply - value: " + aValue + ", point: " + aPoint); |
283 | //console.profile("ECC.Curve.multiply"); | 252 | //console.profile("ECC.Curve.multiply"); |
284 | deferredResult = new MochiKit.Async.Deferred(); | 253 | deferredResult = new MochiKit.Async.Deferred(); |
285 | //deferredResult.addCallback(function(res) {console.profile("ECC.Curve.deferredMultiply"); return res;} ); | 254 | //deferredResult.addCallback(function(res) {console.profile("ECC.Curve.deferredMultiply"); return res;} ); |
286 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 1: " + res); return res;}); | 255 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("# 1: " + res); return res;}); |
287 | 256 | ||
288 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | 257 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); |
289 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 2: " + res); return res;}); | 258 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("# 2: " + res); return res;}); |
290 | 259 | ||
291 | if (aValue.isZero() == false) { | 260 | if (aValue.isZero() == false) { |
292 | var k, Q; | 261 | var k, Q; |
293 | var i; | 262 | var i; |
294 | var countIndex; countIndex = 0; | 263 | var countIndex; countIndex = 0; |
295 | 264 | ||
296 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { | 265 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { |
297 | k = aValue; | 266 | k = aValue; |
298 | Q = aPoint; | 267 | Q = aPoint; |
299 | } else { | 268 | } else { |
300 | MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); | 269 | Clipperz.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); |
301 | k = aValue.negate(); | 270 | k = aValue.negate(); |
302 | Q = this.negate(aPoint); | 271 | Q = this.negate(aPoint); |
303 | } | 272 | } |
304 | 273 | ||
305 | //console.log("k: " + k.toString(16)); | ||
306 | //console.log("k.bitSize: " + k.bitSize()); | ||
307 | 274 | ||
308 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 3: " + res); return res;}); | ||
309 | for (i=k.bitSize()-1; i>=0; i--) { | 275 | for (i=k.bitSize()-1; i>=0; i--) { |
310 | //MochiKit.Logging.logDebug("====> " + i); | ||
311 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4 > i = " + i + ": " + res); return res;}); | ||
312 | deferredResult.addMethod(this, "addTwice"); | 276 | deferredResult.addMethod(this, "addTwice"); |
313 | //# result = this.add(result, result); | 277 | //# result = this.add(result, result); |
314 | // this.overwriteAdd(result, result); | 278 | // this.overwriteAdd(result, result); |
315 | if (k.isBitSet(i)) { | 279 | if (k.isBitSet(i)) { |
316 | deferredResult.addMethod(this, "add", Q); | 280 | deferredResult.addMethod(this, "add", Q); |
317 | //# result = this.add(result, Q); | 281 | //# result = this.add(result, Q); |
318 | // this.overwriteAdd(result, Q); | 282 | // this.overwriteAdd(result, Q); |
319 | } | 283 | } |
320 | if (i%20 == 0) {deferredResult.addCallback(MochiKit.Async.wait, 0.1);} | 284 | if (i%20 == 0) {deferredResult.addCallback(MochiKit.Async.wait, 0.1);} |
321 | |||
322 | // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++; | ||
323 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4 < i = " + i + ": " + res); return res;}); | ||
324 | } | 285 | } |
325 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4: " + res); return res;}); | ||
326 | } | 286 | } |
327 | //#console.profileEnd(); | 287 | //#console.profileEnd(); |
328 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 5: " + res); return res;}); | ||
329 | //deferredResult.addBoth(function(res) {console.profileEnd(); return res;}); | 288 | //deferredResult.addBoth(function(res) {console.profileEnd(); return res;}); |
330 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 6: " + res); return res;}); | ||
331 | deferredResult.callback(result); | 289 | deferredResult.callback(result); |
332 | 290 | ||
333 | //# return result; | 291 | //# return result; |
334 | return deferredResult; | 292 | return deferredResult; |
335 | }, | 293 | }, |
336 | 294 | ||
337 | //----------------------------------------------------------------------------- | 295 | //----------------------------------------------------------------------------- |
338 | __syntaxFix__: "syntax fix" | 296 | __syntaxFix__: "syntax fix" |
@@ -436,40 +394,37 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
436 | // | 394 | // |
437 | // ------------------------------------------------------------------------- | 395 | // ------------------------------------------------------------------------- |
438 | // | 396 | // |
439 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; | 397 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; |
440 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { | 398 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { |
441 | varresult; | 399 | varresult; |
442 | 400 | ||
443 | if (aValue.bitSize() > 1140) { | 401 | if (aValue.bitSize() > 1140) { |
444 | MochiKit.Logging.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); | 402 | Clipperz.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); |
445 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); | 403 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); |
446 | } else { | 404 | } else { |
447 | varC, T; | 405 | varC, T; |
448 | var i; | 406 | var i; |
449 | 407 | ||
450 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
451 | // C = aValue.value().slice(0); | ||
452 | C = aValue._value.slice(0); | 408 | C = aValue._value.slice(0); |
453 | for (i=35; i>=18; i--) { | 409 | for (i=35; i>=18; i--) { |
454 | T = C[i]; | 410 | T = C[i]; |
455 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); | 411 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); |
456 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); | 412 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); |
457 | } | 413 | } |
458 | T = (C[17] >>> 27); | 414 | T = (C[17] >>> 27); |
459 | C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0); | 415 | C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0); |
460 | C[17] = (C[17] & 0x07ffffff); | 416 | C[17] = (C[17] & 0x07ffffff); |
461 | 417 | ||
462 | for(i=18; i<=35; i++) { | 418 | for(i=18; i<=35; i++) { |
463 | C[i] = 0; | 419 | C[i] = 0; |
464 | } | 420 | } |
465 | 421 | ||
466 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 422 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
467 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
468 | } | 423 | } |
469 | 424 | ||
470 | return result; | 425 | return result; |
471 | }; | 426 | }; |
472 | } | 427 | } |
473 | 428 | ||
474 | return Clipperz.Crypto.ECC.StandardCurves._B571; | 429 | return Clipperz.Crypto.ECC.StandardCurves._B571; |
475 | }, | 430 | }, |
@@ -502,39 +457,37 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
502 | //- Pag: 56, Alorithm 2.43 | 457 | //- Pag: 56, Alorithm 2.43 |
503 | // | 458 | // |
504 | //----------------------------------------------------------------------------- | 459 | //----------------------------------------------------------------------------- |
505 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; | 460 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; |
506 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { | 461 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { |
507 | varresult; | 462 | varresult; |
508 | 463 | ||
509 | if (aValue.bitSize() > 564) { | 464 | if (aValue.bitSize() > 564) { |
510 | MochiKit.Logging.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); | 465 | Clipperz.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); |
511 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); | 466 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); |
512 | } else { | 467 | } else { |
513 | varC, T; | 468 | varC, T; |
514 | var i; | 469 | var i; |
515 | 470 | ||
516 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
517 | C = aValue._value.slice(0); | 471 | C = aValue._value.slice(0); |
518 | for (i=17; i>=9; i--) { | 472 | for (i=17; i>=9; i--) { |
519 | T = C[i]; | 473 | T = C[i]; |
520 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); | 474 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); |
521 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); | 475 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); |
522 | } | 476 | } |
523 | T = (C[8] >>> 27); | 477 | T = (C[8] >>> 27); |
524 | C[0] = ((C[0] ^ T ^ ((T<<5) ^ (T<<7) ^ (T<<12)) & 0xffffffff) >>> 0); | 478 | C[0] = ((C[0] ^ T ^ ((T<<5) ^ (T<<7) ^ (T<<12)) & 0xffffffff) >>> 0); |
525 | C[8] = (C[8] & 0x07ffffff); | 479 | C[8] = (C[8] & 0x07ffffff); |
526 | 480 | ||
527 | for(i=9; i<=17; i++) { | 481 | for(i=9; i<=17; i++) { |
528 | C[i] = 0; | 482 | C[i] = 0; |
529 | } | 483 | } |
530 | 484 | ||
531 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 485 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
532 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
533 | } | 486 | } |
534 | 487 | ||
535 | return result; | 488 | return result; |
536 | }; | 489 | }; |
537 | } | 490 | } |
538 | 491 | ||
539 | return Clipperz.Crypto.ECC.StandardCurves._B283; | 492 | return Clipperz.Crypto.ECC.StandardCurves._B283; |
540 | }, | 493 | }, |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js index 56f257a..7b7c2c6 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
29 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | 27 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } |
30 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | 28 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } |
@@ -48,17 +46,16 @@ Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(nul | |||
48 | return this._modulus; | 46 | return this._modulus; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | //----------------------------------------------------------------------------- | 49 | //----------------------------------------------------------------------------- |
52 | 50 | ||
53 | '_module': function(aValue) { | 51 | '_module': function(aValue) { |
54 | varresult; | 52 | varresult; |
55 | var modulusComparison; | 53 | var modulusComparison; |
56 | //console.log(">>> binaryField.finiteField.(standard)module"); | ||
57 | 54 | ||
58 | modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); | 55 | modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); |
59 | 56 | ||
60 | if (modulusComparison < 0) { | 57 | if (modulusComparison < 0) { |
61 | result = aValue; | 58 | result = aValue; |
62 | } else if (modulusComparison == 0) { | 59 | } else if (modulusComparison == 0) { |
63 | result = [0]; | 60 | result = [0]; |
64 | } else { | 61 | } else { |
@@ -69,17 +66,16 @@ Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(nul | |||
69 | 66 | ||
70 | modulusBitSize = this.modulus().bitSize(); | 67 | modulusBitSize = this.modulus().bitSize(); |
71 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); | 68 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); |
72 | while (resultBitSize >= modulusBitSize) { | 69 | while (resultBitSize >= modulusBitSize) { |
73 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this.modulus()._value, resultBitSize - modulusBitSize)); | 70 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this.modulus()._value, resultBitSize - modulusBitSize)); |
74 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); | 71 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); |
75 | } | 72 | } |
76 | } | 73 | } |
77 | //console.log("<<< binaryField.finiteField.(standard)module"); | ||
78 | 74 | ||
79 | return result; | 75 | return result; |
80 | }, | 76 | }, |
81 | 77 | ||
82 | 'module': function(aValue) { | 78 | 'module': function(aValue) { |
83 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._module(aValue._value.slice(0))); | 79 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._module(aValue._value.slice(0))); |
84 | }, | 80 | }, |
85 | 81 | ||
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js index ffe287b..fef3220 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
29 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | 27 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } |
30 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | 28 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js index b705a20..634772a 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 27 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 28 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
@@ -363,18 +361,16 @@ Clipperz.Crypto.ECC.BinaryField.Value._isBitSet = function(aWordArray, aBitPosit | |||
363 | Clipperz.Crypto.ECC.BinaryField.Value._compare = function(a,b) { | 361 | Clipperz.Crypto.ECC.BinaryField.Value._compare = function(a,b) { |
364 | varresult; | 362 | varresult; |
365 | var i,c; | 363 | var i,c; |
366 | 364 | ||
367 | result = MochiKit.Base.compare(a.length, b.length); | 365 | result = MochiKit.Base.compare(a.length, b.length); |
368 | 366 | ||
369 | c = a.length; | 367 | c = a.length; |
370 | for (i=0; (i<c) && (result==0); i++) { | 368 | for (i=0; (i<c) && (result==0); i++) { |
371 | //console.log("compare[" + c + " - " + i + " - 1] " + this.value()[c-i-1] + ", " + aValue.value()[c-i-1]); | ||
372 | // result = MochiKit.Base.compare(this.value()[c-i-1], aValue.value()[c-i-1]); | ||
373 | result = MochiKit.Base.compare(a[c-i-1], b[c-i-1]); | 369 | result = MochiKit.Base.compare(a[c-i-1], b[c-i-1]); |
374 | } | 370 | } |
375 | 371 | ||
376 | return result; | 372 | return result; |
377 | }; | 373 | }; |
378 | 374 | ||
379 | 375 | ||
380 | Clipperz.Crypto.ECC.BinaryField.Value['exception']= { | 376 | Clipperz.Crypto.ECC.BinaryField.Value['exception']= { |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js b/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js index be197e3..239e264 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //try { if (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) == 'undefined') { throw ""; }} catch (e) { | 24 | //try { if (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) == 'undefined') { throw ""; }} catch (e) { |
27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.BinaryField.Curve!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.BinaryField.Curve!"; |
28 | //} | 26 | //} |
29 | //try { if (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) == 'undefined') { throw ""; }} catch (e) { | 27 | //try { if (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) == 'undefined') { throw ""; }} catch (e) { |
30 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.Koblitz.Curve!"; | 28 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.Koblitz.Curve!"; |
@@ -129,40 +127,37 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
129 | // | 127 | // |
130 | // ------------------------------------------------------------------------- | 128 | // ------------------------------------------------------------------------- |
131 | // | 129 | // |
132 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; | 130 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; |
133 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { | 131 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { |
134 | varresult; | 132 | varresult; |
135 | 133 | ||
136 | if (aValue.bitSize() > 1140) { | 134 | if (aValue.bitSize() > 1140) { |
137 | MochiKit.Logging.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); | 135 | Clipperz.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); |
138 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); | 136 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); |
139 | } else { | 137 | } else { |
140 | varC, T; | 138 | varC, T; |
141 | var i; | 139 | var i; |
142 | 140 | ||
143 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
144 | // C = aValue.value().slice(0); | ||
145 | C = aValue._value.slice(0); | 141 | C = aValue._value.slice(0); |
146 | for (i=35; i>=18; i--) { | 142 | for (i=35; i>=18; i--) { |
147 | T = C[i]; | 143 | T = C[i]; |
148 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); | 144 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); |
149 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); | 145 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); |
150 | } | 146 | } |
151 | T = (C[17] >>> 27); | 147 | T = (C[17] >>> 27); |
152 | C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0); | 148 | C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0); |
153 | C[17] = (C[17] & 0x07ffffff); | 149 | C[17] = (C[17] & 0x07ffffff); |
154 | 150 | ||
155 | for(i=18; i<=35; i++) { | 151 | for(i=18; i<=35; i++) { |
156 | C[i] = 0; | 152 | C[i] = 0; |
157 | } | 153 | } |
158 | 154 | ||
159 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 155 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
160 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
161 | } | 156 | } |
162 | 157 | ||
163 | return result; | 158 | return result; |
164 | }; | 159 | }; |
165 | } | 160 | } |
166 | 161 | ||
167 | return Clipperz.Crypto.ECC.StandardCurves._B571; | 162 | return Clipperz.Crypto.ECC.StandardCurves._B571; |
168 | }, | 163 | }, |
@@ -191,39 +186,37 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
191 | //- Pag: 56, Alorithm 2.43 | 186 | //- Pag: 56, Alorithm 2.43 |
192 | // | 187 | // |
193 | //----------------------------------------------------------------------------- | 188 | //----------------------------------------------------------------------------- |
194 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; | 189 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; |
195 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { | 190 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { |
196 | varresult; | 191 | varresult; |
197 | 192 | ||
198 | if (aValue.bitSize() > 564) { | 193 | if (aValue.bitSize() > 564) { |
199 | MochiKit.Logging.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); | 194 | Clipperz.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); |
200 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); | 195 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); |
201 | } else { | 196 | } else { |
202 | varC, T; | 197 | varC, T; |
203 | var i; | 198 | var i; |
204 | 199 | ||
205 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
206 | C = aValue._value.slice(0); | 200 | C = aValue._value.slice(0); |
207 | for (i=17; i>=9; i--) { | 201 | for (i=17; i>=9; i--) { |
208 | T = C[i]; | 202 | T = C[i]; |
209 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); | 203 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); |
210 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); | 204 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); |
211 | } | 205 | } |
212 | T = (C[8] >>> 27); | 206 | T = (C[8] >>> 27); |
213 | C[0] = ((C[0] ^ T ^ ((T<<5) ^ (T<<7) ^ (T<<12)) & 0xffffffff) >>> 0); | 207 | C[0] = ((C[0] ^ T ^ ((T<<5) ^ (T<<7) ^ (T<<12)) & 0xffffffff) >>> 0); |
214 | C[8] = (C[8] & 0x07ffffff); | 208 | C[8] = (C[8] & 0x07ffffff); |
215 | 209 | ||
216 | for(i=9; i<=17; i++) { | 210 | for(i=9; i<=17; i++) { |
217 | C[i] = 0; | 211 | C[i] = 0; |
218 | } | 212 | } |
219 | 213 | ||
220 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 214 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
221 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
222 | } | 215 | } |
223 | 216 | ||
224 | return result; | 217 | return result; |
225 | }; | 218 | }; |
226 | } | 219 | } |
227 | 220 | ||
228 | return Clipperz.Crypto.ECC.StandardCurves._B283; | 221 | return Clipperz.Crypto.ECC.StandardCurves._B283; |
229 | }, | 222 | }, |
diff --git a/frontend/gamma/js/Clipperz/Crypto/PRNG.js b/frontend/gamma/js/Clipperz/Crypto/PRNG.js index adfdb16..c539f06 100644 --- a/frontend/gamma/js/Clipperz/Crypto/PRNG.js +++ b/frontend/gamma/js/Clipperz/Crypto/PRNG.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | 25 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { | 28 | try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { |
@@ -484,17 +482,16 @@ Clipperz.Crypto.PRNG.Fortuna.prototype = MochiKit.Base.update(null, { | |||
484 | c = this.randomnessSources().length; | 482 | c = this.randomnessSources().length; |
485 | for (i=0; i<c; i++) { | 483 | for (i=0; i<c; i++) { |
486 | this.randomnessSources()[i].setBoostMode(false); | 484 | this.randomnessSources()[i].setBoostMode(false); |
487 | } | 485 | } |
488 | } | 486 | } |
489 | 487 | ||
490 | this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed)); | 488 | this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed)); |
491 | if (reseedCounter == 1) { | 489 | if (reseedCounter == 1) { |
492 | //MochiKit.Logging.logDebug("### PRNG.readyToGenerateRandomBytes"); | ||
493 | Clipperz.log("### PRNG.readyToGenerateRandomBytes"); | 490 | Clipperz.log("### PRNG.readyToGenerateRandomBytes"); |
494 | MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); | 491 | MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); |
495 | } | 492 | } |
496 | MochiKit.Signal.signal(this, 'reseeded'); | 493 | MochiKit.Signal.signal(this, 'reseeded'); |
497 | }, | 494 | }, |
498 | 495 | ||
499 | //------------------------------------------------------------------------- | 496 | //------------------------------------------------------------------------- |
500 | 497 | ||
@@ -555,17 +552,17 @@ Clipperz.log("### PRNG.readyToGenerateRandomBytes"); | |||
555 | 552 | ||
556 | if (result.length() != aSize) { | 553 | if (result.length() != aSize) { |
557 | result = result.split(0, aSize); | 554 | result = result.split(0, aSize); |
558 | } | 555 | } |
559 | 556 | ||
560 | newKey = this.getRandomBlock().appendBlock(this.getRandomBlock()); | 557 | newKey = this.getRandomBlock().appendBlock(this.getRandomBlock()); |
561 | this.setKey(newKey); | 558 | this.setKey(newKey); |
562 | } else { | 559 | } else { |
563 | MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!"); | 560 | Clipperz.logWarning("Fortuna generator has not enough entropy, yet!"); |
564 | throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy; | 561 | throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy; |
565 | } | 562 | } |
566 | 563 | ||
567 | return result; | 564 | return result; |
568 | }, | 565 | }, |
569 | 566 | ||
570 | //------------------------------------------------------------------------- | 567 | //------------------------------------------------------------------------- |
571 | 568 | ||
@@ -605,39 +602,31 @@ MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!"); | |||
605 | } | 602 | } |
606 | }, | 603 | }, |
607 | 604 | ||
608 | //------------------------------------------------------------------------- | 605 | //------------------------------------------------------------------------- |
609 | 606 | ||
610 | 'deferredEntropyCollection': function(aValue) { | 607 | 'deferredEntropyCollection': function(aValue) { |
611 | var result; | 608 | var result; |
612 | 609 | ||
613 | //MochiKit.Logging.logDebug(">>> PRNG.deferredEntropyCollection"); | ||
614 | 610 | ||
615 | if (this.isReadyToGenerateRandomValues()) { | 611 | if (this.isReadyToGenerateRandomValues()) { |
616 | //MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 1"); | ||
617 | result = aValue; | 612 | result = aValue; |
618 | } else { | 613 | } else { |
619 | //MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 2"); | ||
620 | var deferredResult; | 614 | var deferredResult; |
621 | 615 | ||
622 | // Clipperz.NotificationCenter.notify(this, 'updatedProgressState', 'collectingEntropy', true); | ||
623 | |||
624 | deferredResult = new Clipperz.Async.Deferred("PRNG.deferredEntropyCollection"); | 616 | deferredResult = new Clipperz.Async.Deferred("PRNG.deferredEntropyCollection"); |
625 | // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.1 - PRNG.deferredEntropyCollection - 1: " + res); return res;}); | ||
626 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue)); | 617 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue)); |
627 | // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.2 - PRNG.deferredEntropyCollection - 2: " + res); return res;}); | ||
628 | MochiKit.Signal.connect(this, | 618 | MochiKit.Signal.connect(this, |
629 | 'readyToGenerateRandomBytes', | 619 | 'readyToGenerateRandomBytes', |
630 | deferredResult, | 620 | deferredResult, |
631 | 'callback'); | 621 | 'callback'); |
632 | 622 | ||
633 | result = deferredResult; | 623 | result = deferredResult; |
634 | } | 624 | } |
635 | //MochiKit.Logging.logDebug("<<< PRNG.deferredEntropyCollection - result: " + result); | ||
636 | 625 | ||
637 | return result; | 626 | return result; |
638 | }, | 627 | }, |
639 | 628 | ||
640 | //------------------------------------------------------------------------- | 629 | //------------------------------------------------------------------------- |
641 | 630 | ||
642 | 'fastEntropyAccumulationForTestingPurpose': function() { | 631 | 'fastEntropyAccumulationForTestingPurpose': function() { |
643 | while (! this.isReadyToGenerateRandomValues()) { | 632 | while (! this.isReadyToGenerateRandomValues()) { |
diff --git a/frontend/gamma/js/Clipperz/Crypto/RSA.js b/frontend/gamma/js/Clipperz/Crypto/RSA.js index 6844dba..5a480f1 100644 --- a/frontend/gamma/js/Clipperz/Crypto/RSA.js +++ b/frontend/gamma/js/Clipperz/Crypto/RSA.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!"; | 25 | throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; } | 28 | if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; } |
diff --git a/frontend/gamma/js/Clipperz/Crypto/SHA.js b/frontend/gamma/js/Clipperz/Crypto/SHA.js index b07fa85..f8bfe6e 100644 --- a/frontend/gamma/js/Clipperz/Crypto/SHA.js +++ b/frontend/gamma/js/Clipperz/Crypto/SHA.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | 25 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 28 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
diff --git a/frontend/gamma/js/Clipperz/Crypto/SRP.js b/frontend/gamma/js/Clipperz/Crypto/SRP.js index 3b25275..597e72d 100644 --- a/frontend/gamma/js/Clipperz/Crypto/SRP.js +++ b/frontend/gamma/js/Clipperz/Crypto/SRP.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | 25 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { | 28 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { |
@@ -126,84 +124,78 @@ Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, { | |||
126 | }, | 124 | }, |
127 | 125 | ||
128 | //------------------------------------------------------------------------- | 126 | //------------------------------------------------------------------------- |
129 | 127 | ||
130 | 'a': function () { | 128 | 'a': function () { |
131 | if (this._a == null) { | 129 | if (this._a == null) { |
132 | this._a = new Clipperz.Crypto.BigInt(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2), 16); | 130 | this._a = new Clipperz.Crypto.BigInt(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2), 16); |
133 | // this._a = new Clipperz.Crypto.BigInt("37532428169486597638072888476611365392249575518156687476805936694442691012367", 10); | 131 | // this._a = new Clipperz.Crypto.BigInt("37532428169486597638072888476611365392249575518156687476805936694442691012367", 10); |
134 | //MochiKit.Logging.logDebug("SRP a: " + this._a); | ||
135 | } | 132 | } |
136 | 133 | ||
137 | return this._a; | 134 | return this._a; |
138 | }, | 135 | }, |
139 | 136 | ||
140 | //------------------------------------------------------------------------- | 137 | //------------------------------------------------------------------------- |
141 | 138 | ||
142 | 'A': function () { | 139 | 'A': function () { |
143 | if (this._A == null) { | 140 | if (this._A == null) { |
144 | //Warning: this value should be strictly greater than zero: how should we perform this check? | 141 | //Warning: this value should be strictly greater than zero: how should we perform this check? |
145 | this._A = Clipperz.Crypto.SRP.g().powerModule(this.a(), Clipperz.Crypto.SRP.n()); | 142 | this._A = Clipperz.Crypto.SRP.g().powerModule(this.a(), Clipperz.Crypto.SRP.n()); |
146 | 143 | ||
147 | if (this._A.equals(0)) { | 144 | if (this._A.equals(0)) { |
148 | MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'A' to 0."); | 145 | Clipperz.logError("Clipperz.Crypto.SRP.Connection: trying to set 'A' to 0."); |
149 | throw Clipperz.Crypto.SRP.exception.InvalidValue; | 146 | throw Clipperz.Crypto.SRP.exception.InvalidValue; |
150 | } | 147 | } |
151 | //MochiKit.Logging.logDebug("SRP A: " + this._A); | ||
152 | } | 148 | } |
153 | 149 | ||
154 | return this._A; | 150 | return this._A; |
155 | }, | 151 | }, |
156 | 152 | ||
157 | //------------------------------------------------------------------------- | 153 | //------------------------------------------------------------------------- |
158 | 154 | ||
159 | 's': function () { | 155 | 's': function () { |
160 | return this._s; | 156 | return this._s; |
161 | //MochiKit.Logging.logDebug("SRP s: " + this._S); | ||
162 | }, | 157 | }, |
163 | 158 | ||
164 | 'set_s': function(aValue) { | 159 | 'set_s': function(aValue) { |
165 | this._s = aValue; | 160 | this._s = aValue; |
166 | }, | 161 | }, |
167 | 162 | ||
168 | //------------------------------------------------------------------------- | 163 | //------------------------------------------------------------------------- |
169 | 164 | ||
170 | 'B': function () { | 165 | 'B': function () { |
171 | return this._B; | 166 | return this._B; |
172 | }, | 167 | }, |
173 | 168 | ||
174 | 'set_B': function(aValue) { | 169 | 'set_B': function(aValue) { |
175 | //Warning: this value should be strictly greater than zero: how should we perform this check? | 170 | //Warning: this value should be strictly greater than zero: how should we perform this check? |
176 | if (! aValue.equals(0)) { | 171 | if (! aValue.equals(0)) { |
177 | this._B = aValue; | 172 | this._B = aValue; |
178 | //MochiKit.Logging.logDebug("SRP B: " + this._B); | ||
179 | } else { | 173 | } else { |
180 | MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to 0."); | 174 | Clipperz.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to 0."); |
181 | throw Clipperz.Crypto.SRP.exception.InvalidValue; | 175 | throw Clipperz.Crypto.SRP.exception.InvalidValue; |
182 | } | 176 | } |
183 | }, | 177 | }, |
184 | 178 | ||
185 | //------------------------------------------------------------------------- | 179 | //------------------------------------------------------------------------- |
186 | 180 | ||
187 | 'x': function () { | 181 | 'x': function () { |
188 | if (this._x == null) { | 182 | if (this._x == null) { |
189 | this._x = new Clipperz.Crypto.BigInt(this.stringHash(this.s().asString(16, 64) + this.P()), 16); | 183 | this._x = new Clipperz.Crypto.BigInt(this.stringHash(this.s().asString(16, 64) + this.P()), 16); |
190 | //MochiKit.Logging.logDebug("SRP x: " + this._x); | ||
191 | } | 184 | } |
192 | 185 | ||
193 | return this._x; | 186 | return this._x; |
194 | }, | 187 | }, |
195 | 188 | ||
196 | //------------------------------------------------------------------------- | 189 | //------------------------------------------------------------------------- |
197 | 190 | ||
198 | 'u': function () { | 191 | 'u': function () { |
199 | if (this._u == null) { | 192 | if (this._u == null) { |
200 | this._u = new Clipperz.Crypto.BigInt(this.stringHash(this.B().asString()), 16); | 193 | this._u = new Clipperz.Crypto.BigInt(this.stringHash(this.B().asString()), 16); |
201 | //MochiKit.Logging.logDebug("SRP u: " + this._u); | ||
202 | } | 194 | } |
203 | 195 | ||
204 | return this._u; | 196 | return this._u; |
205 | }, | 197 | }, |
206 | 198 | ||
207 | //------------------------------------------------------------------------- | 199 | //------------------------------------------------------------------------- |
208 | 200 | ||
209 | 'S': function () { | 201 | 'S': function () { |
@@ -214,50 +206,46 @@ MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to | |||
214 | bigint = Clipperz.Crypto.BigInt; | 206 | bigint = Clipperz.Crypto.BigInt; |
215 | srp = Clipperz.Crypto.SRP; | 207 | srp = Clipperz.Crypto.SRP; |
216 | 208 | ||
217 | this._S =bigint.powerModule( | 209 | this._S =bigint.powerModule( |
218 | bigint.subtract(this.B(), bigint.powerModule(srp.g(), this.x(), srp.n())), | 210 | bigint.subtract(this.B(), bigint.powerModule(srp.g(), this.x(), srp.n())), |
219 | bigint.add(this.a(), bigint.multiply(this.u(), this.x())), | 211 | bigint.add(this.a(), bigint.multiply(this.u(), this.x())), |
220 | srp.n() | 212 | srp.n() |
221 | ) | 213 | ) |
222 | //MochiKit.Logging.logDebug("SRP S: " + this._S); | ||
223 | } | 214 | } |
224 | 215 | ||
225 | return this._S; | 216 | return this._S; |
226 | }, | 217 | }, |
227 | 218 | ||
228 | //------------------------------------------------------------------------- | 219 | //------------------------------------------------------------------------- |
229 | 220 | ||
230 | 'K': function () { | 221 | 'K': function () { |
231 | if (this._K == null) { | 222 | if (this._K == null) { |
232 | this._K = this.stringHash(this.S().asString()); | 223 | this._K = this.stringHash(this.S().asString()); |
233 | //MochiKit.Logging.logDebug("SRP K: " + this._K); | ||
234 | } | 224 | } |
235 | 225 | ||
236 | return this._K; | 226 | return this._K; |
237 | }, | 227 | }, |
238 | 228 | ||
239 | //------------------------------------------------------------------------- | 229 | //------------------------------------------------------------------------- |
240 | 230 | ||
241 | 'M1': function () { | 231 | 'M1': function () { |
242 | if (this._M1 == null) { | 232 | if (this._M1 == null) { |
243 | this._M1 = this.stringHash(this.A().asString(10) + this.B().asString(10) + this.K()); | 233 | this._M1 = this.stringHash(this.A().asString(10) + this.B().asString(10) + this.K()); |
244 | //MochiKit.Logging.logDebug("SRP M1: " + this._M1); | ||
245 | } | 234 | } |
246 | 235 | ||
247 | return this._M1; | 236 | return this._M1; |
248 | }, | 237 | }, |
249 | 238 | ||
250 | //------------------------------------------------------------------------- | 239 | //------------------------------------------------------------------------- |
251 | 240 | ||
252 | 'M2': function () { | 241 | 'M2': function () { |
253 | if (this._M2 == null) { | 242 | if (this._M2 == null) { |
254 | this._M2 = this.stringHash(this.A().asString(10) + this.M1() + this.K()); | 243 | this._M2 = this.stringHash(this.A().asString(10) + this.M1() + this.K()); |
255 | //MochiKit.Logging.logDebug("SRP M2: " + this._M2); | ||
256 | } | 244 | } |
257 | 245 | ||
258 | return this._M2; | 246 | return this._M2; |
259 | }, | 247 | }, |
260 | 248 | ||
261 | //========================================================================= | 249 | //========================================================================= |
262 | 250 | ||
263 | 'serverSideCredentialsWithSalt': function(aSalt) { | 251 | 'serverSideCredentialsWithSalt': function(aSalt) { |
diff --git a/frontend/gamma/js/Clipperz/DOM.js b/frontend/gamma/js/Clipperz/DOM.js index 8f24653..1d52a4b 100644 --- a/frontend/gamma/js/Clipperz/DOM.js +++ b/frontend/gamma/js/Clipperz/DOM.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.DOM) == 'undefined') { Clipperz.DOM = {}; } | 25 | if (typeof(Clipperz.DOM) == 'undefined') { Clipperz.DOM = {}; } |
28 | 26 | ||
29 | Clipperz.DOM.VERSION = "0.1"; | 27 | Clipperz.DOM.VERSION = "0.1"; |
30 | Clipperz.DOM.NAME = "Clipperz.DOM"; | 28 | Clipperz.DOM.NAME = "Clipperz.DOM"; |
@@ -101,17 +99,17 @@ MochiKit.Base.update(Clipperz.DOM, { | |||
101 | 99 | ||
102 | tagName = aNode.tagName.toUpperCase(); | 100 | tagName = aNode.tagName.toUpperCase(); |
103 | if (tagName === "INPUT" && (aNode.type == "radio" || aNode.type == "checkbox")) { | 101 | if (tagName === "INPUT" && (aNode.type == "radio" || aNode.type == "checkbox")) { |
104 | aNode.checked = values[name]; | 102 | aNode.checked = values[name]; |
105 | } else if (tagName === "SELECT") { | 103 | } else if (tagName === "SELECT") { |
106 | if (aNode.type == "select-one") { | 104 | if (aNode.type == "select-one") { |
107 | Clipperz.DOM.selectOptionMatchingValue(aNode, values[name]); | 105 | Clipperz.DOM.selectOptionMatchingValue(aNode, values[name]); |
108 | } else { //aNode.type == "select-multiple" | 106 | } else { //aNode.type == "select-multiple" |
109 | MochiKit.Logging.logWarning("### unhandled Select.type = 'select-multiple' condition"); | 107 | Clipperz.logWarning("### unhandled Select.type = 'select-multiple' condition"); |
110 | } | 108 | } |
111 | } else if (tagName === "FORM" || tagName === "P" || tagName === "SPAN" || tagName === "DIV") { | 109 | } else if (tagName === "FORM" || tagName === "P" || tagName === "SPAN" || tagName === "DIV") { |
112 | result = aNode.childNodes; | 110 | result = aNode.childNodes; |
113 | } else { | 111 | } else { |
114 | aNode.value = values[name] | 112 | aNode.value = values[name] |
115 | } | 113 | } |
116 | } else { | 114 | } else { |
117 | result = aNode.childNodes; | 115 | result = aNode.childNodes; |
diff --git a/frontend/gamma/js/Clipperz/Date.js b/frontend/gamma/js/Clipperz/Date.js index 020d77b..163790e 100644 --- a/frontend/gamma/js/Clipperz/Date.js +++ b/frontend/gamma/js/Clipperz/Date.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Date) == 'undefined') { Clipperz.Date = {}; } | 25 | if (typeof(Clipperz.Date) == 'undefined') { Clipperz.Date = {}; } |
28 | 26 | ||
29 | Clipperz.Date.VERSION = "0.1"; | 27 | Clipperz.Date.VERSION = "0.1"; |
30 | Clipperz.Date.NAME = "Clipperz.Date"; | 28 | Clipperz.Date.NAME = "Clipperz.Date"; |
@@ -234,17 +232,16 @@ MochiKit.Base.update(Clipperz.Date, { | |||
234 | //========================================================================= | 232 | //========================================================================= |
235 | 233 | ||
236 | 'formatDateWithPHPLikeTemplateAndLocale': function(aDate, aFormat, aLocale) { | 234 | 'formatDateWithPHPLikeTemplateAndLocale': function(aDate, aFormat, aLocale) { |
237 | var result; | 235 | var result; |
238 | var formatterCode; | 236 | var formatterCode; |
239 | var formatter; | 237 | var formatter; |
240 | var i,c; | 238 | var i,c; |
241 | 239 | ||
242 | //MochiKit.Logging.logDebug(">>> Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale"); | ||
243 | formatterCode = "Clipperz.Date.__scratchFormatter = function(aDate, aLocale){return ''"; | 240 | formatterCode = "Clipperz.Date.__scratchFormatter = function(aDate, aLocale){return ''"; |
244 | 241 | ||
245 | c = aFormat.length; | 242 | c = aFormat.length; |
246 | i = 0; | 243 | i = 0; |
247 | 244 | ||
248 | while (i<c) { | 245 | while (i<c) { |
249 | var character; | 246 | var character; |
250 | 247 | ||
@@ -256,22 +253,20 @@ MochiKit.Base.update(Clipperz.Date, { | |||
256 | } else { | 253 | } else { |
257 | formatterCode += Clipperz.Date.getPHPLikeFormatCode(character); | 254 | formatterCode += Clipperz.Date.getPHPLikeFormatCode(character); |
258 | } | 255 | } |
259 | 256 | ||
260 | i++; | 257 | i++; |
261 | } | 258 | } |
262 | 259 | ||
263 | formatterCode += ";}"; | 260 | formatterCode += ";}"; |
264 | //MochiKit.Logging.logDebug("--- Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale - formatterCode: " + formatterCode); | ||
265 | eval(formatterCode); | 261 | eval(formatterCode); |
266 | 262 | ||
267 | result = Clipperz.Date.__scratchFormatter.call(this, aDate, aLocale); | 263 | result = Clipperz.Date.__scratchFormatter.call(this, aDate, aLocale); |
268 | delete Clipperz.Date.__scratchFormatter; | 264 | delete Clipperz.Date.__scratchFormatter; |
269 | //MochiKit.Logging.logDebug("<<< Clipperz.Date.formatDateWithPHPLikeTemplateAndLocale"); | ||
270 | 265 | ||
271 | return result; | 266 | return result; |
272 | }, | 267 | }, |
273 | 268 | ||
274 | //------------------------------------------------------------------------- | 269 | //------------------------------------------------------------------------- |
275 | 270 | ||
276 | 'parseDateWithPHPLikeTemplateAndLocale': function(aString, aFormat, aLocale) { | 271 | 'parseDateWithPHPLikeTemplateAndLocale': function(aString, aFormat, aLocale) { |
277 | return new Date(); | 272 | return new Date(); |
diff --git a/frontend/gamma/js/Clipperz/KeePassExportProcessor.js b/frontend/gamma/js/Clipperz/KeePassExportProcessor.js index a3c10c8..e35d729 100644 --- a/frontend/gamma/js/Clipperz/KeePassExportProcessor.js +++ b/frontend/gamma/js/Clipperz/KeePassExportProcessor.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | 25 | ||
28 | 26 | ||
29 | Clipperz.KeePassExportProcessor = function(args) { | 27 | Clipperz.KeePassExportProcessor = function(args) { |
30 | args = args || {}; | 28 | args = args || {}; |
diff --git a/frontend/gamma/js/Clipperz/KeyValueObjectStore.js b/frontend/gamma/js/Clipperz/KeyValueObjectStore.js index 36cda88..8bc125b 100644 --- a/frontend/gamma/js/Clipperz/KeyValueObjectStore.js +++ b/frontend/gamma/js/Clipperz/KeyValueObjectStore.js | |||
@@ -1,61 +1,57 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.KeyValueObjectStore = function(args) { | 28 | Clipperz.KeyValueObjectStore = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | 30 | ||
33 | //this._name = args['name'] || "unnamed KeyValueObjectStore"; | 31 | //this._name = args['name'] || "unnamed KeyValueObjectStore"; |
34 | this._values = args['values'] || {}; | 32 | this._values = args['values'] || {}; |
35 | //this._referenceObjectStore = null; | 33 | //this._referenceObjectStore = null; |
36 | //console.log("new KeyValueObjectStore", args, this._values); | ||
37 | 34 | ||
38 | return this; | 35 | return this; |
39 | } | 36 | } |
40 | 37 | ||
41 | Clipperz.KeyValueObjectStore.prototype = MochiKit.Base.update(null, { | 38 | Clipperz.KeyValueObjectStore.prototype = MochiKit.Base.update(null, { |
42 | 39 | ||
43 | 'values': function() { | 40 | 'values': function() { |
44 | return this._values; | 41 | return this._values; |
45 | }, | 42 | }, |
46 | 43 | ||
47 | 'initWithValues': function (someValues) { | 44 | 'initWithValues': function (someValues) { |
48 | this._values = Clipperz.Base.deepClone(someValues) || {}; | 45 | this._values = Clipperz.Base.deepClone(someValues) || {}; |
49 | return this; | 46 | return this; |
50 | }, | 47 | }, |
51 | 48 | ||
52 | 'setValues': function (someValues) { | 49 | 'setValues': function (someValues) { |
53 | //console.log("KeyValueObjectStore.setValues", someValues); | ||
54 | this._values = someValues; | 50 | this._values = someValues; |
55 | return this; | 51 | return this; |
56 | }, | 52 | }, |
57 | 53 | ||
58 | //'initWithObjectStore': function (anObjectStore) { | 54 | //'initWithObjectStore': function (anObjectStore) { |
59 | // this._referenceObjectStore = anObjectStore; | 55 | // this._referenceObjectStore = anObjectStore; |
60 | //}, | 56 | //}, |
61 | 57 | ||
@@ -91,31 +87,28 @@ Clipperz.KeyValueObjectStore.prototype = MochiKit.Base.update(null, { | |||
91 | 87 | ||
92 | //------------------------------------------------------------------------- | 88 | //------------------------------------------------------------------------- |
93 | 89 | ||
94 | 'setValue': function(aKeyPath, aValue) { | 90 | 'setValue': function(aKeyPath, aValue) { |
95 | var targetObject; | 91 | var targetObject; |
96 | var keys; | 92 | var keys; |
97 | var i,c; | 93 | var i,c; |
98 | 94 | ||
99 | //console.log(">>> KeyValueObjectStore.setValue", this, this.values(), aKeyPath, aValue); | ||
100 | targetObject = this.values(); | 95 | targetObject = this.values(); |
101 | keys = (aKeyPath + '').split('.'); | 96 | keys = (aKeyPath + '').split('.'); |
102 | c = keys.length - 1; | 97 | c = keys.length - 1; |
103 | for (i=0; i<c; i++) { | 98 | for (i=0; i<c; i++) { |
104 | //console.log("--- KeyValueObjectStore.setValue", i, targetObject, keys[i]); | ||
105 | if (typeof targetObject[keys[i]] == 'undefined') { | 99 | if (typeof targetObject[keys[i]] == 'undefined') { |
106 | targetObject[keys[i]] = {} | 100 | targetObject[keys[i]] = {} |
107 | } | 101 | } |
108 | 102 | ||
109 | targetObject = targetObject[keys[i]]; | 103 | targetObject = targetObject[keys[i]]; |
110 | } | 104 | } |
111 | 105 | ||
112 | targetObject[keys[c]] = aValue; | 106 | targetObject[keys[c]] = aValue; |
113 | //console.log("<<< KeyValueObjectStore.setValue"); | ||
114 | 107 | ||
115 | return aValue; | 108 | return aValue; |
116 | }, | 109 | }, |
117 | 110 | ||
118 | //------------------------------------------------------------------------- | 111 | //------------------------------------------------------------------------- |
119 | 112 | ||
120 | 'removeValue': function (aKeyPath) { | 113 | 'removeValue': function (aKeyPath) { |
121 | // this.setValue(aKeyPath, null); | 114 | // this.setValue(aKeyPath, null); |
diff --git a/frontend/gamma/js/Clipperz/Logging.js b/frontend/gamma/js/Clipperz/Logging.js index 77a0896..b6b806a 100644 --- a/frontend/gamma/js/Clipperz/Logging.js +++ b/frontend/gamma/js/Clipperz/Logging.js | |||
@@ -1,39 +1,32 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz'); | 24 | Clipperz.Base.module('Clipperz'); |
27 | 25 | ||
28 | if (typeof console == 'undefined') { | ||
29 | Clipperz.log = MochiKit.Logging.logDebug; | ||
30 | // Safari/WebKit 4 | ||
31 | } else if (navigator.userAgent.match(/WebKit/)) { | ||
32 | //Clipperz.log = console.log; | ||
33 | Clipperz.log = MochiKit.Logging.logDebug; | ||
34 | } else if (navigator.userAgent.match(/Gecko/)) { | ||
35 | Clipperz.log = function () { | 26 | Clipperz.log = function () { |
36 | // firebug 1.3 bug see http://code.google.com/p/fbug/issues/detail?id=1347 | 27 | console.log.apply(console, arguments); |
37 | console.log.apply(window._firebug, arguments); | ||
38 | }; | ||
39 | } \ No newline at end of file | 28 | } \ No newline at end of file |
29 | |||
30 | Clipperz.logError= Clipperz.log; | ||
31 | Clipperz.logWarning= Clipperz.log; | ||
32 | Clipperz.logDebug= Clipperz.log; \ No newline at end of file | ||
diff --git a/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js b/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js index 897beed..4818b76 100644 --- a/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js +++ b/frontend/gamma/js/Clipperz/PM/BookmarkletProcessor.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | /* | 24 | /* |
27 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 25 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
28 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 26 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
29 | 27 | ||
30 | Clipperz.PM.BookmarkletProcessor = function(aConfiguration) { | 28 | Clipperz.PM.BookmarkletProcessor = function(aConfiguration) { |
diff --git a/frontend/gamma/js/Clipperz/PM/Connection.js b/frontend/gamma/js/Clipperz/PM/Connection.js index a05a310..6a8f15e 100644 --- a/frontend/gamma/js/Clipperz/PM/Connection.js +++ b/frontend/gamma/js/Clipperz/PM/Connection.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //----------------------------------------------------------------------------- | 27 | //----------------------------------------------------------------------------- |
30 | // | 28 | // |
@@ -81,17 +79,18 @@ Clipperz.PM.Connection.prototype = MochiKit.Base.update(null, { | |||
81 | } | 79 | } |
82 | 80 | ||
83 | return this._clipperz_pm_crypto_version; | 81 | return this._clipperz_pm_crypto_version; |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
87 | 85 | ||
88 | 'defaultErrorHandler': function(anErrorString, anException) { | 86 | 'defaultErrorHandler': function(anErrorString, anException) { |
89 | MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString + " (" + anException + ")"); | 87 | // Clipperz.logError("### Connection.defaultErrorHandler: " + anErrorString, anException); |
88 | Clipperz.logError("### Connection.defaultErrorHandler: " + anErrorString + " (" + anException + ")"); | ||
90 | }, | 89 | }, |
91 | 90 | ||
92 | //------------------------------------------------------------------------- | 91 | //------------------------------------------------------------------------- |
93 | 92 | ||
94 | 'getCredentialsFunction': function () { | 93 | 'getCredentialsFunction': function () { |
95 | return this._getCredentialsFunction; | 94 | return this._getCredentialsFunction; |
96 | }, | 95 | }, |
97 | 96 | ||
@@ -268,17 +267,16 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
268 | 267 | ||
269 | return deferredResult; | 268 | return deferredResult; |
270 | 269 | ||
271 | }, | 270 | }, |
272 | 271 | ||
273 | //========================================================================= | 272 | //========================================================================= |
274 | 273 | ||
275 | 'redeemOneTimePassword': function (someParameters) { | 274 | 'redeemOneTimePassword': function (someParameters) { |
276 | //console.log("Connections.redeemOneTimePassword", someParameters['username'], someParameters['password']); | ||
277 | /* | 275 | /* |
278 | //========================================================================= | 276 | //========================================================================= |
279 | //LOGIN WITH PASSPHRASE, extracted from the TRUNK version (LoginPanel.js) | 277 | //LOGIN WITH PASSPHRASE, extracted from the TRUNK version (LoginPanel.js) |
280 | deferredResult.addCallback(function(anUsername, aOneTimePassword) { | 278 | deferredResult.addCallback(function(anUsername, aOneTimePassword) { |
281 | var args; | 279 | var args; |
282 | 280 | ||
283 | args = { | 281 | args = { |
284 | 'message': 'oneTimePassword', | 282 | 'message': 'oneTimePassword', |
@@ -448,17 +446,16 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
448 | var args; | 446 | var args; |
449 | var parameters; | 447 | var parameters; |
450 | 448 | ||
451 | parameters = someParameters || {}; | 449 | parameters = someParameters || {}; |
452 | if (typeof(parameters['user']) != 'undefined') { | 450 | if (typeof(parameters['user']) != 'undefined') { |
453 | parameters['user']['lock'] = this.serverLockValue(); | 451 | parameters['user']['lock'] = this.serverLockValue(); |
454 | } | 452 | } |
455 | 453 | ||
456 | //console.log(">>> Connection.message", aMessageName, someParameters); | ||
457 | args = { | 454 | args = { |
458 | message: aMessageName, | 455 | message: aMessageName, |
459 | srpSharedSecret: this.sharedSecret(), | 456 | srpSharedSecret: this.sharedSecret(), |
460 | // parameters: (someParameters || {}) | 457 | // parameters: (someParameters || {}) |
461 | parameters: parameters | 458 | parameters: parameters |
462 | } | 459 | } |
463 | 460 | ||
464 | return this.sendMessage(args); | 461 | return this.sendMessage(args); |
@@ -484,31 +481,31 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
484 | return deferredResult | 481 | return deferredResult |
485 | }, | 482 | }, |
486 | 483 | ||
487 | //------------------------------------------------------------------------- | 484 | //------------------------------------------------------------------------- |
488 | 485 | ||
489 | 'messageExceptionHandler': function(anOriginalMessageArguments, anError) { | 486 | 'messageExceptionHandler': function(anOriginalMessageArguments, anError) { |
490 | var result; | 487 | var result; |
491 | 488 | ||
492 | console.log(">>> Connection.messageExceptionHandler", anError, anError.message); | 489 | Clipperz.log(">>> Connection.messageExceptionHandler: " + anError.message, anError); |
493 | if (anError instanceof MochiKit.Async.CancelledError) { | 490 | if (anError instanceof MochiKit.Async.CancelledError) { |
494 | result = anError; | 491 | result = anError; |
495 | } else { | 492 | } else { |
496 | if ((anError.message == 'Trying to communicate without an active connection')|| | 493 | if ((anError.message == 'Trying to communicate without an active connection')|| |
497 | (anError.message == 'No tollManager available for current session') | 494 | (anError.message == 'No tollManager available for current session') |
498 | ) { | 495 | ) { |
499 | result = this.reestablishConnection(anOriginalMessageArguments); | 496 | result = this.reestablishConnection(anOriginalMessageArguments); |
500 | } else if (anError.message == 'Session with stale data') { | 497 | } else if (anError.message == 'Session with stale data') { |
501 | MochiKit.Signal.signal(this, 'EXCEPTION'); | 498 | MochiKit.Signal.signal(this, 'EXCEPTION'); |
502 | } else { | 499 | } else { |
503 | result = anError; | 500 | result = anError; |
504 | } | 501 | } |
505 | } | 502 | } |
506 | console.log("<<< Connection.messageExceptionHandler", anError) | 503 | Clipperz.log("<<< Connection.messageExceptionHandler") |
507 | 504 | ||
508 | return result;; | 505 | return result;; |
509 | }, | 506 | }, |
510 | 507 | ||
511 | //========================================================================= | 508 | //========================================================================= |
512 | 509 | ||
513 | 'reestablishConnection': function(anOriginalMessageArguments) { | 510 | 'reestablishConnection': function(anOriginalMessageArguments) { |
514 | var deferredResult; | 511 | var deferredResult; |
diff --git a/frontend/gamma/js/Clipperz/PM/Crypto.js b/frontend/gamma/js/Clipperz/PM/Crypto.js index 31fe349..cd10e33 100644 --- a/frontend/gamma/js/Clipperz/PM/Crypto.js +++ b/frontend/gamma/js/Clipperz/PM/Crypto.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; } | 26 | if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; } |
29 | 27 | ||
30 | Clipperz.PM.Crypto.VERSION = "0.2"; | 28 | Clipperz.PM.Crypto.VERSION = "0.2"; |
@@ -169,17 +167,17 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
169 | value = new Clipperz.ByteArray().appendBase64String(aValue); | 167 | value = new Clipperz.ByteArray().appendBase64String(aValue); |
170 | 168 | ||
171 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); | 169 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); |
172 | decryptedValue = decryptedData.split((256/8)); | 170 | decryptedValue = decryptedData.split((256/8)); |
173 | 171 | ||
174 | try { | 172 | try { |
175 | result = Clipperz.Base.evalJSON(decryptedValue.asString()); | 173 | result = Clipperz.Base.evalJSON(decryptedValue.asString()); |
176 | } catch (exception) { | 174 | } catch (exception) { |
177 | MochiKit.Logging.logError("Error while decrypting data [1]"); | 175 | Clipperz.logError("Error while decrypting data [1]"); |
178 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 176 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
179 | } | 177 | } |
180 | } else { | 178 | } else { |
181 | result = null; | 179 | result = null; |
182 | } | 180 | } |
183 | 181 | ||
184 | return result; | 182 | return result; |
185 | }, | 183 | }, |
@@ -201,17 +199,17 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
201 | var result; | 199 | var result; |
202 | var decryptedData; | 200 | var decryptedData; |
203 | 201 | ||
204 | decryptedData = aResult.split((256/8)); | 202 | decryptedData = aResult.split((256/8)); |
205 | 203 | ||
206 | try { | 204 | try { |
207 | result = Clipperz.Base.evalJSON(decryptedData.asString()); | 205 | result = Clipperz.Base.evalJSON(decryptedData.asString()); |
208 | } catch (exception) { | 206 | } catch (exception) { |
209 | MochiKit.Logging.logError("Error while decrypting data [2]"); | 207 | Clipperz.logError("Error while decrypting data [2]"); |
210 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 208 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
211 | } | 209 | } |
212 | 210 | ||
213 | return result; | 211 | return result; |
214 | }) | 212 | }) |
215 | deferredResult.callback(); | 213 | deferredResult.callback(); |
216 | 214 | ||
217 | result = deferredResult; | 215 | result = deferredResult; |
@@ -286,17 +284,17 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
286 | value = new Clipperz.ByteArray().appendBase64String(aValue); | 284 | value = new Clipperz.ByteArray().appendBase64String(aValue); |
287 | 285 | ||
288 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); | 286 | decryptedData = Clipperz.Crypto.AES.decrypt(key, value); |
289 | 287 | ||
290 | value = decryptedData.asString(); | 288 | value = decryptedData.asString(); |
291 | try { | 289 | try { |
292 | result = Clipperz.Base.evalJSON(value); | 290 | result = Clipperz.Base.evalJSON(value); |
293 | } catch (exception) { | 291 | } catch (exception) { |
294 | MochiKit.Logging.logError("Error while decrypting data [3]"); | 292 | Clipperz.logError("Error while decrypting data [3]"); |
295 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 293 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
296 | } | 294 | } |
297 | } else { | 295 | } else { |
298 | result = null; | 296 | result = null; |
299 | } | 297 | } |
300 | 298 | ||
301 | return result; | 299 | return result; |
302 | }, | 300 | }, |
@@ -317,17 +315,17 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
317 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value); | 315 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredDecrypt, key, value); |
318 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | 316 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); |
319 | deferredResult.addCallback(function(aResult) { | 317 | deferredResult.addCallback(function(aResult) { |
320 | return aResult.asString(); | 318 | return aResult.asString(); |
321 | }); | 319 | }); |
322 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | 320 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); |
323 | deferredResult.addCallback(Clipperz.Base.evalJSON); | 321 | deferredResult.addCallback(Clipperz.Base.evalJSON); |
324 | deferredResult.addErrback(function(anError) { | 322 | deferredResult.addErrback(function(anError) { |
325 | MochiKit.Logging.logError("Error while decrypting data [4]"); | 323 | Clipperz.logError("Error while decrypting data [4]"); |
326 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 324 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
327 | }) | 325 | }) |
328 | } else { | 326 | } else { |
329 | deferredResult.addCallback(function() { | 327 | deferredResult.addCallback(function() { |
330 | return null; | 328 | return null; |
331 | }); | 329 | }); |
332 | } | 330 | } |
333 | deferredResult.callback(); | 331 | deferredResult.callback(); |
@@ -354,37 +352,37 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
354 | '0.4': { | 352 | '0.4': { |
355 | 'encrypt': function(aKey, aValue, aNonce) { | 353 | 'encrypt': function(aKey, aValue, aNonce) { |
356 | var result; | 354 | var result; |
357 | varkey, value; | 355 | varkey, value; |
358 | var data; | 356 | var data; |
359 | var dataToEncrypt; | 357 | var dataToEncrypt; |
360 | var encryptedData; | 358 | var encryptedData; |
361 | 359 | ||
362 | //MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); | 360 | //Clipperz.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); |
363 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 361 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
364 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1"); | 362 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1"); |
365 | value = Clipperz.Base.serializeJSON(aValue); | 363 | value = Clipperz.Base.serializeJSON(aValue); |
366 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2"); | 364 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2"); |
367 | / * | 365 | / * |
368 | //MochiKit.Logging.logDebug("--> encrypt.fullSize: " + value.length); | 366 | //Clipperz.logDebug("--> encrypt.fullSize: " + value.length); |
369 | value = value.replace(/":{"label":"/g, '":{l:"'); | 367 | value = value.replace(/":{"label":"/g, '":{l:"'); |
370 | value = value.replace(/":{"key":"/g, '":{k:"'); | 368 | value = value.replace(/":{"key":"/g, '":{k:"'); |
371 | value = value.replace(/":{"notes":"/g, '":{n:"'); | 369 | value = value.replace(/":{"notes":"/g, '":{n:"'); |
372 | value = value.replace(/":{"record":"/g, '":{r:"'); | 370 | value = value.replace(/":{"record":"/g, '":{r:"'); |
373 | value = value.replace(/", "label":"/g, '",l:"'); | 371 | value = value.replace(/", "label":"/g, '",l:"'); |
374 | value = value.replace(/", "favicon":"/g,'",f:"'); | 372 | value = value.replace(/", "favicon":"/g,'",f:"'); |
375 | //MochiKit.Logging.logDebug("<-- encrypt.compressed: " + value.length); | 373 | //Clipperz.logDebug("<-- encrypt.compressed: " + value.length); |
376 | * / | 374 | * / |
377 | data = new Clipperz.ByteArray(value); | 375 | data = new Clipperz.ByteArray(value); |
378 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3"); | 376 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3"); |
379 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); | 377 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); |
380 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4"); | 378 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4"); |
381 | result = encryptedData.toBase64String(); | 379 | result = encryptedData.toBase64String(); |
382 | //MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); | 380 | //Clipperz.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); |
383 | 381 | ||
384 | return result; | 382 | return result; |
385 | }, | 383 | }, |
386 | 384 | ||
387 | 'decrypt': function(aKey, aValue) { | 385 | 'decrypt': function(aKey, aValue) { |
388 | var result; | 386 | var result; |
389 | 387 | ||
390 | if (aValue != null) { | 388 | if (aValue != null) { |
@@ -403,17 +401,17 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
403 | value = value.replace(/":{n:"/g,'":{"notes":"'); | 401 | value = value.replace(/":{n:"/g,'":{"notes":"'); |
404 | value = value.replace(/":{r:"/g,'":{"record":"'); | 402 | value = value.replace(/":{r:"/g,'":{"record":"'); |
405 | value = value.replace(/",l:"/g, '", "label":"'); | 403 | value = value.replace(/",l:"/g, '", "label":"'); |
406 | value = value.replace(/",f:"/g, '", "favicon":"'); | 404 | value = value.replace(/",f:"/g, '", "favicon":"'); |
407 | * / | 405 | * / |
408 | try { | 406 | try { |
409 | result = Clipperz.Base.evalJSON(value); | 407 | result = Clipperz.Base.evalJSON(value); |
410 | } catch (exception) { | 408 | } catch (exception) { |
411 | MochiKit.Logging.logError("Error while decrypting data"); | 409 | Clipperz.logError("Error while decrypting data"); |
412 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 410 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
413 | } | 411 | } |
414 | 412 | ||
415 | 413 | ||
416 | } else { | 414 | } else { |
417 | result = null; | 415 | result = null; |
418 | } | 416 | } |
419 | 417 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js index 8f8696d..507ee31 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLogin.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.DataModel'); | 24 | Clipperz.Base.module('Clipperz.PM.DataModel'); |
27 | 25 | ||
28 | Clipperz.PM.DataModel.DirectLogin = function(args) { | 26 | Clipperz.PM.DataModel.DirectLogin = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -324,17 +322,17 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
324 | '_fixConfiguration': function (aConfiguration) { | 322 | '_fixConfiguration': function (aConfiguration) { |
325 | var fixedConfiguration; | 323 | var fixedConfiguration; |
326 | // var inputs; | 324 | // var inputs; |
327 | // var bindings; | 325 | // var bindings; |
328 | // var i,c; | 326 | // var i,c; |
329 | 327 | ||
330 | fixedConfiguration = Clipperz.Base.deepClone(aConfiguration); | 328 | fixedConfiguration = Clipperz.Base.deepClone(aConfiguration); |
331 | 329 | ||
332 | //console.log("PROCESS CONFIGURATION", aConfiguration); | 330 | //Clipperz.log("PROCESS CONFIGURATION", aConfiguration); |
333 | switch (aConfiguration['bookmarkletVersion']) { | 331 | switch (aConfiguration['bookmarkletVersion']) { |
334 | case '0.1': | 332 | case '0.1': |
335 | fixedConfiguration['formData'] = this.fixFormDataFromBookmarkletVersion_0_1(aConfiguration['formData']); | 333 | fixedConfiguration['formData'] = this.fixFormDataFromBookmarkletVersion_0_1(aConfiguration['formData']); |
336 | break; | 334 | break; |
337 | case '0.2': | 335 | case '0.2': |
338 | fixedConfiguration['formData'] = aConfiguration['formData']; | 336 | fixedConfiguration['formData'] = aConfiguration['formData']; |
339 | break; | 337 | break; |
340 | } | 338 | } |
@@ -476,20 +474,19 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
476 | }, | 474 | }, |
477 | 475 | ||
478 | //------------------------------------------------------------------------- | 476 | //------------------------------------------------------------------------- |
479 | 477 | ||
480 | 'setBookmarkletConfiguration': function (aValue) { | 478 | 'setBookmarkletConfiguration': function (aValue) { |
481 | var bookmarkletConfiguration; | 479 | var bookmarkletConfiguration; |
482 | 480 | ||
483 | bookmarkletConfiguration = Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(aValue); | 481 | bookmarkletConfiguration = Clipperz.PM.DataModel.DirectLogin.checkBookmarkletConfiguration(aValue); |
484 | //console.log("BOOKMARKLET CONFIGURATION", bookmarkletConfiguration); | 482 | |
485 | return Clipperz.Async.callbacks("DirectLogin.setBookmarkletConfiguration", [ | 483 | return Clipperz.Async.callbacks("DirectLogin.setBookmarkletConfiguration", [ |
486 | MochiKit.Base.method(this, 'setValue', 'formData', bookmarkletConfiguration['form']), | 484 | MochiKit.Base.method(this, 'setValue', 'formData', bookmarkletConfiguration['form']), |
487 | //function (aValue) { console.log("SET VALUE - formData", aValue); return aValue; }, | ||
488 | MochiKit.Base.method(this, 'setValue', 'bookmarkletVersion', bookmarkletConfiguration['version']), | 485 | MochiKit.Base.method(this, 'setValue', 'bookmarkletVersion', bookmarkletConfiguration['version']), |
489 | 486 | ||
490 | MochiKit.Base.method(this, 'favicon'), | 487 | MochiKit.Base.method(this, 'favicon'), |
491 | Clipperz.Async.deferredIf("the favicon is not set", [ | 488 | Clipperz.Async.deferredIf("the favicon is not set", [ |
492 | ], [ | 489 | ], [ |
493 | MochiKit.Base.method(this, 'faviconUrlWithBookmarkletConfiguration', bookmarkletConfiguration), | 490 | MochiKit.Base.method(this, 'faviconUrlWithBookmarkletConfiguration', bookmarkletConfiguration), |
494 | MochiKit.Base.method(this, 'setFavicon') | 491 | MochiKit.Base.method(this, 'setFavicon') |
495 | ]), | 492 | ]), |
@@ -531,31 +528,27 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
531 | }, this)); | 528 | }, this)); |
532 | } | 529 | } |
533 | 530 | ||
534 | return this._inputs; | 531 | return this._inputs; |
535 | }, | 532 | }, |
536 | 533 | ||
537 | 'updateInputsAfterChangingBookmarkletConfiguration': function () { | 534 | 'updateInputsAfterChangingBookmarkletConfiguration': function () { |
538 | return Clipperz.Async.callbacks("DirectLogin.updateInputsAfterChangingBookmarkletConfiguration", [ | 535 | return Clipperz.Async.callbacks("DirectLogin.updateInputsAfterChangingBookmarkletConfiguration", [ |
539 | // MochiKit.Base.method(this, 'getValue', ''), | ||
540 | //function (aValue) { console.log("VALUE", aValue); return aValue }, | ||
541 | MochiKit.Base.method(this, 'getValue', 'formData'), | 536 | MochiKit.Base.method(this, 'getValue', 'formData'), |
542 | //function (aValue) { console.log("FORM DATA", aValue); return aValue }, | ||
543 | MochiKit.Base.method(this, 'setInputWithFormDataConfiguration') | 537 | MochiKit.Base.method(this, 'setInputWithFormDataConfiguration') |
544 | ], {trace:false}); | 538 | ], {trace:false}); |
545 | }, | 539 | }, |
546 | 540 | ||
547 | //========================================================================= | 541 | //========================================================================= |
548 | 542 | ||
549 | 'inputValues': function () { | 543 | 'inputValues': function () { |
550 | return Clipperz.Async.callbacks("DirectLogin.inputValues", [ | 544 | return Clipperz.Async.callbacks("DirectLogin.inputValues", [ |
551 | MochiKit.Base.method(this, 'inputs'), | 545 | MochiKit.Base.method(this, 'inputs'), |
552 | MochiKit.Base.values, | 546 | MochiKit.Base.values, |
553 | //function (aValue) { console.log("INPUTS", aValue); return aValue; }, | ||
554 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.partial(MochiKit.Base.method(this, 'inputValue'))), | 547 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.partial(MochiKit.Base.method(this, 'inputValue'))), |
555 | Clipperz.Async.collectAll, | 548 | Clipperz.Async.collectAll, |
556 | Clipperz.Base.mergeItems | 549 | Clipperz.Base.mergeItems |
557 | ], {trace:false}); | 550 | ], {trace:false}); |
558 | }, | 551 | }, |
559 | 552 | ||
560 | 'inputValue': function (anInput) { | 553 | 'inputValue': function (anInput) { |
561 | vardeferredResult; | 554 | vardeferredResult; |
@@ -669,29 +662,26 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.DirectLogin, Object, { | |||
669 | newBindingValues[anInput.name()] = availableBindingValues[anInput.name()]; | 662 | newBindingValues[anInput.name()] = availableBindingValues[anInput.name()]; |
670 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 663 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
671 | 'key': anInput.name(), | 664 | 'key': anInput.name(), |
672 | 'field':availableBindingValues[anInput.name()] | 665 | 'field':availableBindingValues[anInput.name()] |
673 | }); | 666 | }); |
674 | 667 | ||
675 | this._bindings[anInput.name()] = newBinding; | 668 | this._bindings[anInput.name()] = newBinding; |
676 | }, this)) | 669 | }, this)) |
677 | //console.log("THIS._BINDINGS", this._bindings); | ||
678 | 670 | ||
679 | return newBindingValues; | 671 | return newBindingValues; |
680 | 672 | ||
681 | /* | 673 | /* |
682 | this._bindings = {}; | 674 | this._bindings = {}; |
683 | //console.log("CONFIGURATION", aConfiguration); | ||
684 | 675 | ||
685 | if (someValues['currentValues'] != null) { | 676 | if (someValues['currentValues'] != null) { |
686 | if (someValues['currentValues']['bindingData'] != null) { | 677 | if (someValues['currentValues']['bindingData'] != null) { |
687 | var bindingKey; | 678 | var bindingKey; |
688 | 679 | ||
689 | //console.log("BINDING DATA", someValues['currentValues']['bindingData']); | ||
690 | for (bindingKey in someValues['currentValues']['bindingData']) { | 680 | for (bindingKey in someValues['currentValues']['bindingData']) { |
691 | var newBinding; | 681 | var newBinding; |
692 | 682 | ||
693 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { | 683 | newBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, { |
694 | 'key': bindingKey, | 684 | 'key': bindingKey, |
695 | 'field':someValues['currentValues']['bindingData'][bindingKey] | 685 | 'field':someValues['currentValues']['bindingData'][bindingKey] |
696 | }); | 686 | }); |
697 | this._bindings[newBinding.key()] = newBinding; | 687 | this._bindings[newBinding.key()] = newBinding; |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js index 4377853..a8ebb97 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginBinding.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js index a461197..2429f88 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginFormValue.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
@@ -82,17 +80,16 @@ Clipperz.PM.DataModel.DirectLoginFormValue.prototype = MochiKit.Base.update(null | |||
82 | // if ((result == null) && (this.type() == 'checkbox')) { | 80 | // if ((result == null) && (this.type() == 'checkbox')) { |
83 | // result = false; | 81 | // result = false; |
84 | // }; | 82 | // }; |
85 | 83 | ||
86 | return result; | 84 | return result; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | 'setValue': function (aValue) { | 87 | 'setValue': function (aValue) { |
90 | //console.log("DirectLoginFormValue.setValue", aValue); | ||
91 | this._value = aValue; | 88 | this._value = aValue; |
92 | return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); | 89 | return this.directLogin().setValue('formValues' + '.' + this.key(), aValue); |
93 | }, | 90 | }, |
94 | 91 | ||
95 | //------------------------------------------------------------------------- | 92 | //------------------------------------------------------------------------- |
96 | /* | 93 | /* |
97 | 'serializedData': function() { | 94 | 'serializedData': function() { |
98 | return this.value(); | 95 | return this.value(); |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js index 8188389..d9995fc 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/DirectLoginInput.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | //############################################################################# | 28 | //############################################################################# |
@@ -71,17 +69,17 @@ Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { | |||
71 | 'value': function() { | 69 | 'value': function() { |
72 | return this.args()['value']; | 70 | return this.args()['value']; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | /* | 74 | /* |
77 | 'formConfiguration': function(someFormValues, someBindings, someFields) { | 75 | 'formConfiguration': function(someFormValues, someBindings, someFields) { |
78 | var result; | 76 | var result; |
79 | //console.log("### DirectLoginInput.formConfiguration", someFields); | 77 | |
80 | if (this.shouldSetValue()) { | 78 | if (this.shouldSetValue()) { |
81 | switch (this.type()) { | 79 | switch (this.type()) { |
82 | case 'select': | 80 | case 'select': |
83 | var currentValue; | 81 | var currentValue; |
84 | var options; | 82 | var options; |
85 | 83 | ||
86 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; | 84 | // currentValue = this.directLogin()._configuration['formValues'][this.name()]; |
87 | currentValue = someFormValues[this.name()]; | 85 | currentValue = someFormValues[this.name()]; |
@@ -149,22 +147,16 @@ Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { | |||
149 | ); | 147 | ); |
150 | break; | 148 | break; |
151 | } | 149 | } |
152 | } else { | 150 | } else { |
153 | var binding; | 151 | var binding; |
154 | // binding = this.directLogin().bindings()[this.name()]; | 152 | // binding = this.directLogin().bindings()[this.name()]; |
155 | binding = someBindings[this.name()]; | 153 | binding = someBindings[this.name()]; |
156 | 154 | ||
157 | //console.log("### binding", binding); | ||
158 | //if (binding != null) { | ||
159 | ///console.log(" binding.field()", binding.field()); | ||
160 | ///console.log(" binding.field().value()", binding.field().value()); | ||
161 | //console.log(" someFields[binding.fieldKey()].value()", someFields[binding.fieldKey()].value()); | ||
162 | //} | ||
163 | result = MochiKit.DOM.INPUT({ | 155 | result = MochiKit.DOM.INPUT({ |
164 | type:((this.type() != 'password') ? this.type() : 'text'), | 156 | type:((this.type() != 'password') ? this.type() : 'text'), |
165 | name:this.name(), | 157 | name:this.name(), |
166 | // value:((binding != null)? binding.field().value() : this.value()) | 158 | // value:((binding != null)? binding.field().value() : this.value()) |
167 | value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value()) | 159 | value:((binding != null)? someFields[binding.fieldKey()]['value'] : this.value()) |
168 | // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value()) | 160 | // value:((binding != null)? someFields[binding.fieldKey()].value() : this.value()) |
169 | }, null); | 161 | }, null); |
170 | } | 162 | } |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js index cdeec8b..1aa7a52 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/EncryptedRemoteObject.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.KeyValueObjectStore) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; | 25 | throw "Clipperz.PM.DataModel.EncryptedRemoteObject depends on Clipperz.KeyValueObjectStore!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 28 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
@@ -406,20 +404,16 @@ Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(nul | |||
406 | ], | 404 | ], |
407 | 'objectData': [ | 405 | 'objectData': [ |
408 | MochiKit.Base.method(this, '_getObjectDataStore'), | 406 | MochiKit.Base.method(this, '_getObjectDataStore'), |
409 | MochiKit.Base.methodcaller('values'), | 407 | MochiKit.Base.methodcaller('values'), |
410 | Clipperz.Base.serializeJSON | 408 | Clipperz.Base.serializeJSON |
411 | ] | 409 | ] |
412 | }); | 410 | }); |
413 | deferredResult.addCallback(function (someValues) { | 411 | deferredResult.addCallback(function (someValues) { |
414 | //if (someValues['decryptedData'] != someValues['objectData']) { | ||
415 | //console.log("ORIGINAL DATA", '[[[' + someValues['decryptedData'] + ']]]'); | ||
416 | //console.log("CURRENT DATA", '>>>' + someValues['objectData'] + '<<<'); | ||
417 | //} | ||
418 | return (someValues['decryptedData'] != someValues['objectData']); | 412 | return (someValues['decryptedData'] != someValues['objectData']); |
419 | }); | 413 | }); |
420 | deferredResult.callback(); | 414 | deferredResult.callback(); |
421 | } else { | 415 | } else { |
422 | deferredResult = MochiKit.Async.succeed(false); | 416 | deferredResult = MochiKit.Async.succeed(false); |
423 | } | 417 | } |
424 | 418 | ||
425 | return deferredResult; | 419 | return deferredResult; |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js index 834e21b..fbca1ff 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
@@ -138,85 +136,85 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { | |||
138 | var encodedPassphrase; | 136 | var encodedPassphrase; |
139 | varprefixPadding; | 137 | varprefixPadding; |
140 | var suffixPadding; | 138 | var suffixPadding; |
141 | var getRandomBytes; | 139 | var getRandomBytes; |
142 | 140 | ||
143 | getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes'); | 141 | getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes'); |
144 | 142 | ||
145 | encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); | 143 | encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); |
146 | //MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); | 144 | //Clipperz.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); |
147 | prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); | 145 | prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); |
148 | //MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length); | 146 | //Clipperz.logDebug("--- prefixPadding.length: " + prefixPadding.length); |
149 | suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); | 147 | suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); |
150 | //MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length); | 148 | //Clipperz.logDebug("--- suffixPadding.length: " + suffixPadding.length); |
151 | //MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); | 149 | //Clipperz.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); |
152 | 150 | ||
153 | packedPassphrase = { | 151 | packedPassphrase = { |
154 | 'prefix': prefixPadding, | 152 | 'prefix': prefixPadding, |
155 | 'passphrase': encodedPassphrase, | 153 | 'passphrase': encodedPassphrase, |
156 | 'suffix': suffixPadding | 154 | 'suffix': suffixPadding |
157 | }; | 155 | }; |
158 | 156 | ||
159 | // result = Clipperz.Base.serializeJSON(packedPassphrase); | 157 | // result = Clipperz.Base.serializeJSON(packedPassphrase); |
160 | result = packedPassphrase; | 158 | result = packedPassphrase; |
161 | //MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); | 159 | //Clipperz.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); |
162 | //MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase"); | 160 | //Clipperz.logDebug("<<< OneTimePassword.packedPassphrase"); |
163 | 161 | ||
164 | return result; | 162 | return result; |
165 | }, | 163 | }, |
166 | 164 | ||
167 | //------------------------------------------------------------------------- | 165 | //------------------------------------------------------------------------- |
168 | 166 | ||
169 | 'encryptedPackedPassphrase': function() { | 167 | 'encryptedPackedPassphrase': function() { |
170 | return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase()) | 168 | return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase()) |
171 | }, | 169 | }, |
172 | 170 | ||
173 | //------------------------------------------------------------------------- | 171 | //------------------------------------------------------------------------- |
174 | 172 | ||
175 | 'encryptedData': function() { | 173 | 'encryptedData': function() { |
176 | var deferredResult; | 174 | var deferredResult; |
177 | varresult; | 175 | varresult; |
178 | 176 | ||
179 | //MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData"); | 177 | //Clipperz.logDebug(">>> OneTimePassword.encryptedData"); |
180 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); | 178 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); |
181 | result = { | 179 | result = { |
182 | 'reference': this.reference(), | 180 | 'reference': this.reference(), |
183 | 'key': this.key(), | 181 | 'key': this.key(), |
184 | 'keyChecksum': this.keyChecksum(), | 182 | 'keyChecksum': this.keyChecksum(), |
185 | 'data': "", | 183 | 'data': "", |
186 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion | 184 | 'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion |
187 | } | 185 | } |
188 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); | 186 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); |
189 | deferredResult = new MochiKit.Async.Deferred(); | 187 | deferredResult = new MochiKit.Async.Deferred(); |
190 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3"); | 188 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 3"); |
191 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); | 189 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); |
192 | //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); | 190 | //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); |
193 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); | 191 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); |
194 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4"); | 192 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 4"); |
195 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); | 193 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); |
196 | deferredResult.addCallback(function(aResult, res) { | 194 | deferredResult.addCallback(function(aResult, res) { |
197 | aResult['data'] = res; | 195 | aResult['data'] = res; |
198 | return aResult; | 196 | return aResult; |
199 | }, result); | 197 | }, result); |
200 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5"); | 198 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 5"); |
201 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); | 199 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); |
202 | deferredResult.callback(); | 200 | deferredResult.callback(); |
203 | //MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6"); | 201 | //Clipperz.logDebug("--- OneTimePassword.encryptedData - 6"); |
204 | 202 | ||
205 | return deferredResult; | 203 | return deferredResult; |
206 | }, | 204 | }, |
207 | 205 | ||
208 | //------------------------------------------------------------------------- | 206 | //------------------------------------------------------------------------- |
209 | 207 | ||
210 | 'saveChanges': function() { | 208 | 'saveChanges': function() { |
211 | var deferredResult; | 209 | var deferredResult; |
212 | varresult; | 210 | varresult; |
213 | 211 | ||
214 | //MochiKit.Logging.logDebug(">>> OneTimePassword.saveChanges"); | 212 | //Clipperz.logDebug(">>> OneTimePassword.saveChanges"); |
215 | result = {}; | 213 | result = {}; |
216 | deferredResult = new MochiKit.Async.Deferred(); | 214 | deferredResult = new MochiKit.Async.Deferred(); |
217 | 215 | ||
218 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData'); | 216 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptUserData'); |
219 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData')); | 217 | deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData')); |
220 | deferredResult.addCallback(function(aResult, res) { | 218 | deferredResult.addCallback(function(aResult, res) { |
221 | aResult['user'] = res; | 219 | aResult['user'] = res; |
222 | return aResult; | 220 | return aResult; |
@@ -225,26 +223,26 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { | |||
225 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData'); | 223 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_encryptOTPData'); |
226 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData')); | 224 | deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedData')); |
227 | deferredResult.addCallback(function(aResult, res) { | 225 | deferredResult.addCallback(function(aResult, res) { |
228 | aResult['oneTimePassword'] = res; | 226 | aResult['oneTimePassword'] = res; |
229 | return aResult; | 227 | return aResult; |
230 | }, result); | 228 | }, result); |
231 | 229 | ||
232 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData'); | 230 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData'); |
233 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;}); | 231 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;}); |
234 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword'); | 232 | deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword'); |
235 | 233 | ||
236 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface'); | 234 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface'); |
237 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); | 235 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); |
238 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated'); | 236 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated'); |
239 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null); | 237 | deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null); |
240 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); | 238 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); |
241 | deferredResult.callback(); | 239 | deferredResult.callback(); |
242 | //MochiKit.Logging.logDebug("<<< OneTimePassword.saveChanges"); | 240 | //Clipperz.logDebug("<<< OneTimePassword.saveChanges"); |
243 | 241 | ||
244 | return deferredResult; | 242 | return deferredResult; |
245 | }, | 243 | }, |
246 | 244 | ||
247 | //------------------------------------------------------------------------- | 245 | //------------------------------------------------------------------------- |
248 | 246 | ||
249 | 'usageDate': function() { | 247 | 'usageDate': function() { |
250 | return this._usageDate; | 248 | return this._usageDate; |
@@ -303,17 +301,16 @@ Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword | |||
303 | } | 301 | } |
304 | 302 | ||
305 | //============================================================================= | 303 | //============================================================================= |
306 | 304 | ||
307 | Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPassword) { | 305 | Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPassword) { |
308 | var result; | 306 | var result; |
309 | 307 | ||
310 | //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg" | 308 | //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg" |
311 | //console.log("Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue", aPassword); | ||
312 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { | 309 | if (aPassword.replace(/[\s\-]/g, '').length == 32) { |
313 | try { | 310 | try { |
314 | var passwordByteArray; | 311 | var passwordByteArray; |
315 | 312 | ||
316 | passwordByteArray = new Clipperz.ByteArray(); | 313 | passwordByteArray = new Clipperz.ByteArray(); |
317 | passwordByteArray.appendBase32String(aPassword); | 314 | passwordByteArray.appendBase32String(aPassword); |
318 | 315 | ||
319 | result = true; | 316 | result = true; |
@@ -342,13 +339,12 @@ Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPass | |||
342 | result = passwordByteArray.toBase64String(); | 339 | result = passwordByteArray.toBase64String(); |
343 | } catch(exception) { | 340 | } catch(exception) { |
344 | result = aPassword; | 341 | result = aPassword; |
345 | } | 342 | } |
346 | } else { | 343 | } else { |
347 | result = aPassword; | 344 | result = aPassword; |
348 | } | 345 | } |
349 | 346 | ||
350 | //console.log("Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword", aPassword, result); | ||
351 | return result; | 347 | return result; |
352 | } | 348 | } |
353 | 349 | ||
354 | //############################################################################# | 350 | //############################################################################# |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js index f51bbc2..986db40 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.Field.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.Record.Version) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; | 25 | throw "Clipperz.PM.DataModel.Record.Version.Field depends on Clipperz.PM.DataModel.Record.Version!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { | 28 | Clipperz.PM.DataModel.Record.Version.Field = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js index dd35fc9..87b319c 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.Version.js | |||
@@ -1,39 +1,36 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.Record) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; | 25 | throw "Clipperz.PM.DataModel.Record.Version depends on Clipperz.PM.DataModel.Record!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | Clipperz.PM.DataModel.Record.Version = function(args) { | 28 | Clipperz.PM.DataModel.Record.Version = function(args) { |
31 | //console.log(">>> Record.new"); | ||
32 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.DataModel.Record.Version.superclass.constructor.apply(this, arguments); |
33 | 30 | ||
34 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); | 31 | this._getVersionFunction = args.getVersion|| Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._fields = null; | 32 | this._fields = null; |
36 | 33 | ||
37 | return this; | 34 | return this; |
38 | } | 35 | } |
39 | 36 | ||
@@ -94,17 +91,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel | |||
94 | return deferredResult; | 91 | return deferredResult; |
95 | }, | 92 | }, |
96 | 93 | ||
97 | //========================================================================= | 94 | //========================================================================= |
98 | 95 | ||
99 | 'unpackData': function (someData) { //++ | 96 | 'unpackData': function (someData) { //++ |
100 | varresult; | 97 | varresult; |
101 | 98 | ||
102 | //console.log("Record.Version - UNPACK DATA", this, someData); | ||
103 | result = someData; | 99 | result = someData; |
104 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { | 100 | if ((someData['fields'] != null) && (someData['fields'] instanceof Array)) { |
105 | varfields; | 101 | varfields; |
106 | var i,c; | 102 | var i,c; |
107 | 103 | ||
108 | fields = someData['fields']; | 104 | fields = someData['fields']; |
109 | delete someData['fields']; | 105 | delete someData['fields']; |
110 | 106 | ||
@@ -287,17 +283,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version, Clipperz.PM.DataModel | |||
287 | //------------------------------------------------------------------------- | 283 | //------------------------------------------------------------------------- |
288 | 284 | ||
289 | 'prepareRemoteDataWithKey': function (aKey) { | 285 | 'prepareRemoteDataWithKey': function (aKey) { |
290 | var deferredResult; | 286 | var deferredResult; |
291 | var result; | 287 | var result; |
292 | 288 | ||
293 | result = {}; | 289 | result = {}; |
294 | 290 | ||
295 | //console.log("prepareRemoteDataWithKey", aKey); | ||
296 | deferredResult = new Clipperz.Async.Deferred("Record.Version.prepareRemoteDataWithKey", {trace:false}); | 291 | deferredResult = new Clipperz.Async.Deferred("Record.Version.prepareRemoteDataWithKey", {trace:false}); |
297 | if (this.isBrandNew() == false) { | 292 | if (this.isBrandNew() == false) { |
298 | this.transientState()['originalReference'] = this.reference(); | 293 | this.transientState()['originalReference'] = this.reference(); |
299 | 294 | ||
300 | deferredResult.collectResults({ | 295 | deferredResult.collectResults({ |
301 | 'key':MochiKit.Base.partial(MochiKit.Async.succeed, aKey), | 296 | 'key':MochiKit.Base.partial(MochiKit.Async.succeed, aKey), |
302 | 'value': MochiKit.Base.method(this, 'getKey'), | 297 | 'value': MochiKit.Base.method(this, 'getKey'), |
303 | 'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion) | 298 | 'version': MochiKit.Base.partial(MochiKit.Async.succeed, Clipperz.PM.Crypto.encryptingFunctions.currentVersion) |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js index b816f80..3fc1813 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/Record.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/Record.js | |||
@@ -1,40 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
31 | Clipperz.PM.DataModel.Record = function(args) { | 29 | Clipperz.PM.DataModel.Record = function(args) { |
32 | //console.log(">>> new Clipperz.PM.DataModel.Record", args); | ||
33 | Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments); | 30 | Clipperz.PM.DataModel.Record.superclass.constructor.apply(this, arguments); |
34 | 31 | ||
35 | this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter')); | 32 | this._updateDate = (args.updateDate ? Clipperz.PM.Date.parse(args.updateDate) : Clipperz.Base.exception.raise('MandatoryParameter')); |
36 | 33 | ||
37 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); | 34 | this._retrieveIndexDataFunction = args.retrieveIndexDataFunction|| Clipperz.Base.exception.raise('MandatoryParameter'); |
38 | this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter'); | 35 | this._updateIndexDataFunction = args.updateIndexDataFunction || Clipperz.Base.exception.raise('MandatoryParameter'); |
39 | 36 | ||
40 | this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null; | 37 | this._retrieveDirectLoginIndexDataFunction = args.retrieveDirectLoginIndexDataFunction|| null; |
@@ -57,18 +54,16 @@ Clipperz.PM.DataModel.Record = function(args) { | |||
57 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 54 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
58 | 55 | ||
59 | }); | 56 | }); |
60 | this._versions[newVersion.reference()] = newVersion; | 57 | this._versions[newVersion.reference()] = newVersion; |
61 | this._currentVersionReference = newVersion.reference(); | 58 | this._currentVersionReference = newVersion.reference(); |
62 | // this.setLabel(''); | 59 | // this.setLabel(''); |
63 | } | 60 | } |
64 | 61 | ||
65 | //console.log("<<< new Clipperz.PM.DataModel.Record", args); | ||
66 | |||
67 | return this; | 62 | return this; |
68 | } | 63 | } |
69 | 64 | ||
70 | 65 | ||
71 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, { | 66 | Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.EncryptedRemoteObject, { |
72 | 67 | ||
73 | 'toString': function() { | 68 | 'toString': function() { |
74 | return "Record (" + this.reference() + ")"; | 69 | return "Record (" + this.reference() + ")"; |
@@ -205,31 +200,29 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
205 | return result; | 200 | return result; |
206 | }, | 201 | }, |
207 | 202 | ||
208 | //------------------------------------------------------------------------- | 203 | //------------------------------------------------------------------------- |
209 | 204 | ||
210 | 'searchableContent': function () { | 205 | 'searchableContent': function () { |
211 | var deferredResult; | 206 | var deferredResult; |
212 | 207 | ||
213 | //console.log(">>> searchableContent"); | ||
214 | deferredResult = new Clipperz.Async.Deferred("Record.searchableContent", {trace:false}); | 208 | deferredResult = new Clipperz.Async.Deferred("Record.searchableContent", {trace:false}); |
215 | 209 | ||
216 | deferredResult.collectResults({ | 210 | deferredResult.collectResults({ |
217 | 'recordLabel': MochiKit.Base.method(this, 'label'), | 211 | 'recordLabel': MochiKit.Base.method(this, 'label'), |
218 | 'directLoginLabels': [ | 212 | 'directLoginLabels': [ |
219 | MochiKit.Base.method(this, 'directLoginReferences'), | 213 | MochiKit.Base.method(this, 'directLoginReferences'), |
220 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.itemgetter('label')) | 214 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.itemgetter('label')) |
221 | ] | 215 | ] |
222 | }) | 216 | }) |
223 | deferredResult.addCallback(function (someValues) { | 217 | deferredResult.addCallback(function (someValues) { |
224 | return someValues['recordLabel'] + ' ' + someValues['directLoginLabels'].join(' '); | 218 | return someValues['recordLabel'] + ' ' + someValues['directLoginLabels'].join(' '); |
225 | }); | 219 | }); |
226 | deferredResult.callback(); | 220 | deferredResult.callback(); |
227 | //console.log("<<< searchableContent"); | ||
228 | 221 | ||
229 | return deferredResult; | 222 | return deferredResult; |
230 | }, | 223 | }, |
231 | 224 | ||
232 | //------------------------------------------------------------------------- | 225 | //------------------------------------------------------------------------- |
233 | 226 | ||
234 | 'isMatching': function (aRegExp) { | 227 | 'isMatching': function (aRegExp) { |
235 | return Clipperz.Async.callbacks("deferredFilterFunction", [ | 228 | return Clipperz.Async.callbacks("deferredFilterFunction", [ |
@@ -265,17 +258,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
265 | 258 | ||
266 | 'createNewDirectLoginFunction': function () { | 259 | 'createNewDirectLoginFunction': function () { |
267 | return this._createNewDirectLoginFunction; | 260 | return this._createNewDirectLoginFunction; |
268 | }, | 261 | }, |
269 | 262 | ||
270 | 'saveOriginalDirectLoginStatusToTransientState': function () { | 263 | 'saveOriginalDirectLoginStatusToTransientState': function () { |
271 | if (this.transientState().getValue('directLogins') == null) { | 264 | if (this.transientState().getValue('directLogins') == null) { |
272 | // this.transientState().setValue('directLogins', this._directLogins) | 265 | // this.transientState().setValue('directLogins', this._directLogins) |
273 | //console.log("SET TRANSIENT STATE", Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.transientState().getValue('directLogins')))) | ||
274 | MochiKit.Iter.forEach(MochiKit.Base.keys(this._directLogins), MochiKit.Base.bind(function(aKey) { | 266 | MochiKit.Iter.forEach(MochiKit.Base.keys(this._directLogins), MochiKit.Base.bind(function(aKey) { |
275 | this.transientState().setValue('directLogins' + '.' + aKey, this._directLogins[aKey]) | 267 | this.transientState().setValue('directLogins' + '.' + aKey, this._directLogins[aKey]) |
276 | }, this)) | 268 | }, this)) |
277 | } | 269 | } |
278 | }, | 270 | }, |
279 | 271 | ||
280 | 'createNewDirectLogin': function () { | 272 | 'createNewDirectLogin': function () { |
281 | this.saveOriginalDirectLoginStatusToTransientState(); | 273 | this.saveOriginalDirectLoginStatusToTransientState(); |
@@ -324,39 +316,36 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
324 | return result; | 316 | return result; |
325 | }, | 317 | }, |
326 | 318 | ||
327 | //========================================================================= | 319 | //========================================================================= |
328 | 320 | ||
329 | 'unpackRemoteData': function (someData) { | 321 | 'unpackRemoteData': function (someData) { |
330 | var result; | 322 | var result; |
331 | 323 | ||
332 | //console.log("new Clipperz.PM.DataModel.Record.Version [2]"); | ||
333 | /* | 324 | /* |
334 | this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({ | 325 | this._currentRecordVersion = new Clipperz.PM.DataModel.Record.Version({ |
335 | 'reference': someData['currentVersion']['reference'], | 326 | 'reference': someData['currentVersion']['reference'], |
336 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), | 327 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getCurrentRecordVersionKey'), |
337 | 'remoteData': someData['currentVersion'], | 328 | 'remoteData': someData['currentVersion'], |
338 | }); | 329 | }); |
339 | */ | 330 | */ |
340 | var versionKey; | 331 | var versionKey; |
341 | 332 | ||
342 | for (versionKey in someData['versions']) { | 333 | for (versionKey in someData['versions']) { |
343 | //console.log("### versionKey", versionKey); | ||
344 | this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({ | 334 | this._versions[versionKey] = new Clipperz.PM.DataModel.Record.Version({ |
345 | 'reference': versionKey, | 335 | 'reference': versionKey, |
346 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), | 336 | 'retrieveKeyFunction':MochiKit.Base.method(this, 'getVersionKey'), |
347 | 'remoteData': someData['versions'][versionKey], | 337 | 'remoteData': someData['versions'][versionKey], |
348 | 'getVersion': MochiKit.Base.method(this, 'getVersion') | 338 | 'getVersion': MochiKit.Base.method(this, 'getVersion') |
349 | }) | 339 | }) |
350 | } | 340 | } |
351 | 341 | ||
352 | // this._currentVersionReference = someData['currentVersion']['reference']; | 342 | // this._currentVersionReference = someData['currentVersion']['reference']; |
353 | this._currentVersionReference = someData['currentVersion']; | 343 | this._currentVersionReference = someData['currentVersion']; |
354 | //console.log("=== currentVersionReference", this._currentVersionReference, someData); | ||
355 | 344 | ||
356 | result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments); | 345 | result = Clipperz.PM.DataModel.Record.superclass.unpackRemoteData.apply(this, arguments); |
357 | 346 | ||
358 | return result; | 347 | return result; |
359 | }, | 348 | }, |
360 | 349 | ||
361 | //------------------------------------------------------------------------- | 350 | //------------------------------------------------------------------------- |
362 | 351 | ||
@@ -531,17 +520,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
531 | 520 | ||
532 | 'setCurrentRecordVersion': function (aRecordVersion) { | 521 | 'setCurrentRecordVersion': function (aRecordVersion) { |
533 | this._currentVersionReference = aRecordVersion.reference(); | 522 | this._currentVersionReference = aRecordVersion.reference(); |
534 | }, | 523 | }, |
535 | 524 | ||
536 | //......................................................................... | 525 | //......................................................................... |
537 | 526 | ||
538 | 'currentVersionReference': function () { | 527 | 'currentVersionReference': function () { |
539 | //console.log("currentVersionReference"); | ||
540 | return this._currentVersionReference; | 528 | return this._currentVersionReference; |
541 | }, | 529 | }, |
542 | 530 | ||
543 | //------------------------------------------------------------------------- | 531 | //------------------------------------------------------------------------- |
544 | 532 | ||
545 | 'createNewRecordVersion': function () { | 533 | 'createNewRecordVersion': function () { |
546 | var deferredResult; | 534 | var deferredResult; |
547 | 535 | ||
@@ -580,17 +568,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
580 | } | 568 | } |
581 | 569 | ||
582 | return deferredResult; | 570 | return deferredResult; |
583 | }, | 571 | }, |
584 | 572 | ||
585 | //------------------------------------------------------------------------- | 573 | //------------------------------------------------------------------------- |
586 | 574 | ||
587 | 'getCurrentRecordVersionKey': function () { | 575 | 'getCurrentRecordVersionKey': function () { |
588 | //console.log("getCurrentRecordVersionKey"); | ||
589 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersionKey", [ | 576 | return Clipperz.Async.callbacks("Record.getCurrentRecordVersionKey", [ |
590 | MochiKit.Base.method(this, 'getValue', 'currentVersionKey'), | 577 | MochiKit.Base.method(this, 'getValue', 'currentVersionKey'), |
591 | Clipperz.Async.deferredIf("currentVersionKey is NOT null", [ | 578 | Clipperz.Async.deferredIf("currentVersionKey is NOT null", [ |
592 | MochiKit.Async.succeed | 579 | MochiKit.Async.succeed |
593 | ], [ | 580 | ], [ |
594 | MochiKit.Base.method(this, 'getKey') | 581 | MochiKit.Base.method(this, 'getKey') |
595 | ]) | 582 | ]) |
596 | ], {trace:false}); | 583 | ], {trace:false}); |
@@ -601,38 +588,31 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
601 | return Clipperz.Async.callbacks("Record.setCurrentRecordVersionKey", [ | 588 | return Clipperz.Async.callbacks("Record.setCurrentRecordVersionKey", [ |
602 | MochiKit.Base.method(this, 'setValue', 'currentVersionKey', aValue) | 589 | MochiKit.Base.method(this, 'setValue', 'currentVersionKey', aValue) |
603 | ], {trace:false}); | 590 | ], {trace:false}); |
604 | }, | 591 | }, |
605 | 592 | ||
606 | //------------------------------------------------------------------------- | 593 | //------------------------------------------------------------------------- |
607 | 594 | ||
608 | 'invokeCurrentRecordVersionMethod': function (aMethodName, someValues) { | 595 | 'invokeCurrentRecordVersionMethod': function (aMethodName, someValues) { |
609 | //console.log(">>> invokeCurrentRecordVersionMethod", aMethodName); | ||
610 | return Clipperz.Async.callbacks("Record.invokeCurrentRecordVersionMethod", [ | 596 | return Clipperz.Async.callbacks("Record.invokeCurrentRecordVersionMethod", [ |
611 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 597 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
612 | //function (aValue) { console.log("=== getCurrentRecordVersion", aValue); return aValue}, | ||
613 | MochiKit.Base.methodcaller(aMethodName, someValues) | 598 | MochiKit.Base.methodcaller(aMethodName, someValues) |
614 | ], {trace:false}); | 599 | ], {trace:false}); |
615 | }, | 600 | }, |
616 | 601 | ||
617 | 602 | ||
618 | 'lazilyinvokeCurrentRecordVersionMethod': function (aMethodName, someValues, defaultResult) { | 603 | 'lazilyinvokeCurrentRecordVersionMethod': function (aMethodName, someValues, defaultResult) { |
619 | return Clipperz.Async.callbacks("Record.lazilyinvokeCurrentRecordVersionMethod", [ | 604 | return Clipperz.Async.callbacks("Record.lazilyinvokeCurrentRecordVersionMethod", [ |
620 | MochiKit.Base.method(this, 'currentVersionReference'), | 605 | MochiKit.Base.method(this, 'currentVersionReference'), |
621 | //function (aValue) { console.log("LAZY -> versions", aValue); return aValue; }, | ||
622 | Clipperz.Async.deferredIf("versions has been loaded", [ | 606 | Clipperz.Async.deferredIf("versions has been loaded", [ |
623 | //function (aValue) { console.log("LAZY -> then"); return aValue; }, | ||
624 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 607 | MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
625 | MochiKit.Base.methodcaller(aMethodName, someValues), | 608 | MochiKit.Base.methodcaller(aMethodName, someValues), |
626 | //function (aValue) { console.log("LAZY <- then"); return aValue; } | ||
627 | ], [ | 609 | ], [ |
628 | //function (aValue) { console.log("LAZY -> else"); return aValue; }, | ||
629 | MochiKit.Base.partial(MochiKit.Async.succeed, defaultResult), | 610 | MochiKit.Base.partial(MochiKit.Async.succeed, defaultResult), |
630 | //function (aValue) { console.log("LAZY <- else"); return aValue; } | ||
631 | ]) | 611 | ]) |
632 | ], {trace:false}); | 612 | ], {trace:false}); |
633 | }, | 613 | }, |
634 | 614 | ||
635 | //========================================================================= | 615 | //========================================================================= |
636 | 616 | ||
637 | 'hasPendingChanges': function () { | 617 | 'hasPendingChanges': function () { |
638 | var deferredResult; | 618 | var deferredResult; |
@@ -643,27 +623,25 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
643 | 'super': MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasPendingChanges, this), | 623 | 'super': MochiKit.Base.bind(Clipperz.PM.DataModel.Record.superclass.hasPendingChanges, this), |
644 | 'currentVersion': [ | 624 | 'currentVersion': [ |
645 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 625 | // MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
646 | // MochiKit.Base.methodcaller('hasPendingChanges') | 626 | // MochiKit.Base.methodcaller('hasPendingChanges') |
647 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') | 627 | MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'hasPendingChanges') |
648 | ], | 628 | ], |
649 | 'directLogins': [ | 629 | 'directLogins': [ |
650 | MochiKit.Base.method(this, 'directLogins'), | 630 | MochiKit.Base.method(this, 'directLogins'), |
651 | //function (aValue) { console.log("Record.directLogins", aValue); return aValue; }, | ||
652 | MochiKit.Base.values, | 631 | MochiKit.Base.values, |
653 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), | 632 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasPendingChanges')), |
654 | Clipperz.Async.collectAll, | 633 | Clipperz.Async.collectAll, |
655 | Clipperz.Async.or | 634 | Clipperz.Async.or |
656 | // function(someValues) { | 635 | // function(someValues) { |
657 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 636 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
658 | // } | 637 | // } |
659 | ] | 638 | ] |
660 | }); | 639 | }); |
661 | //deferredResult.addCallback(function (aValue) { console.log("Record.hasPendingResults", aValue); return aValue; }); | ||
662 | deferredResult.addCallback(MochiKit.Base.values); | 640 | deferredResult.addCallback(MochiKit.Base.values); |
663 | deferredResult.addCallback(MochiKit.Base.bind(function(someValues) { | 641 | deferredResult.addCallback(MochiKit.Base.bind(function(someValues) { |
664 | var result; | 642 | var result; |
665 | result = MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 643 | result = MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
666 | 644 | ||
667 | if ((result == false) && (this.isBrandNew() == false)) { | 645 | if ((result == false) && (this.isBrandNew() == false)) { |
668 | result = MochiKit.Iter.some(MochiKit.Base.values(this.transientState().getValue('hasPendingChanges.indexData')), MochiKit.Base.operator.identity); | 646 | result = MochiKit.Iter.some(MochiKit.Base.values(this.transientState().getValue('hasPendingChanges.indexData')), MochiKit.Base.operator.identity); |
669 | } | 647 | } |
@@ -771,17 +749,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
771 | 749 | ||
772 | return Clipperz.Async.callbacks("Record.resetTransientState", [ | 750 | return Clipperz.Async.callbacks("Record.resetTransientState", [ |
773 | //- MochiKit.Base.method(this, 'getCurrentRecordVersion'), | 751 | //- MochiKit.Base.method(this, 'getCurrentRecordVersion'), |
774 | //- MochiKit.Base.methodcaller('resetTransientState'), | 752 | //- MochiKit.Base.methodcaller('resetTransientState'), |
775 | // MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'resetTransientState'), | 753 | // MochiKit.Base.method(this, 'invokeCurrentRecordVersionMethod', 'resetTransientState'), |
776 | MochiKit.Base.method(this, 'lazilyinvokeCurrentRecordVersionMethod', 'resetTransientState'), | 754 | MochiKit.Base.method(this, 'lazilyinvokeCurrentRecordVersionMethod', 'resetTransientState'), |
777 | 755 | ||
778 | MochiKit.Base.method(this, 'directLogins'), | 756 | MochiKit.Base.method(this, 'directLogins'), |
779 | //function (aValue) { console.log("resetTransientState - directLogins", aValue); return aValue; }, | ||
780 | MochiKit.Base.values, | 757 | MochiKit.Base.values, |
781 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('resetTransientState')), | 758 | MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('resetTransientState')), |
782 | 759 | ||
783 | MochiKit.Base.bind(function () { | 760 | MochiKit.Base.bind(function () { |
784 | if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { | 761 | if ((isCommitting == false) && (this.transientState().getValue('directLogins') != null)) { |
785 | this._directLogins = this.transientState().getValue('directLogins'); | 762 | this._directLogins = this.transientState().getValue('directLogins'); |
786 | } | 763 | } |
787 | }, this), | 764 | }, this), |
@@ -811,17 +788,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt | |||
811 | deferredResult.callback(); | 788 | deferredResult.callback(); |
812 | 789 | ||
813 | return deferredResult; | 790 | return deferredResult; |
814 | }, | 791 | }, |
815 | 792 | ||
816 | //========================================================================= | 793 | //========================================================================= |
817 | 794 | ||
818 | 'retrieveDirectLoginIndexDataFunction': function () { | 795 | 'retrieveDirectLoginIndexDataFunction': function () { |
819 | //console.log("Record.retrieveDirectLoginIndexDataFunction", this._retrieveDirectLoginIndexDataFunction); | ||
820 | return this._retrieveDirectLoginIndexDataFunction; | 796 | return this._retrieveDirectLoginIndexDataFunction; |
821 | }, | 797 | }, |
822 | 798 | ||
823 | 'setDirectLoginIndexDataFunction': function () { | 799 | 'setDirectLoginIndexDataFunction': function () { |
824 | return this._setDirectLoginIndexDataFunction; | 800 | return this._setDirectLoginIndexDataFunction; |
825 | }, | 801 | }, |
826 | 802 | ||
827 | 'removeDirectLoginIndexDataFunction': function () { | 803 | 'removeDirectLoginIndexDataFunction': function () { |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js index d6202ff..cda5a41 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Legacy.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.Legacy depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js index 3528db6..e82da47 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.OneTimePasswords.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.OneTimePasswords depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 27 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
30 | 28 | ||
@@ -46,43 +44,37 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.OneTimePasswords, Clipper | |||
46 | return "Clipperz.PM.DataModel.User.Header.OneTimePasswords"; | 44 | return "Clipperz.PM.DataModel.User.Header.OneTimePasswords"; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
50 | /* | 48 | /* |
51 | 'packData': function (someData) { //++ | 49 | 'packData': function (someData) { //++ |
52 | var result; | 50 | var result; |
53 | 51 | ||
54 | console.log(">>> OneTimePasswords.packData", someData); | ||
55 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments); | 52 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packData.apply(this, arguments); |
56 | console.log("<<< OneTimePasswords.packData"); | ||
57 | 53 | ||
58 | return result; | 54 | return result; |
59 | }, | 55 | }, |
60 | */ | 56 | */ |
61 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
62 | /* | 58 | /* |
63 | 'packRemoteData': function (someData) { | 59 | 'packRemoteData': function (someData) { |
64 | var result; | 60 | var result; |
65 | 61 | ||
66 | console.log(">>> OneTimePasswords.packRemoteData", someData); | ||
67 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments); | 62 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.packRemoteData.apply(this, arguments); |
68 | console.log("<<< OneTimePasswords.packRemoteData"); | ||
69 | 63 | ||
70 | return result; | 64 | return result; |
71 | }, | 65 | }, |
72 | */ | 66 | */ |
73 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
74 | /* | 68 | /* |
75 | 'prepareRemoteDataWithKey': function (aKey) { | 69 | 'prepareRemoteDataWithKey': function (aKey) { |
76 | var result; | 70 | var result; |
77 | 71 | ||
78 | console.log(">>> OneTimePasswords.prepareRemoteDataWithKey"); | ||
79 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments); | 72 | result = Clipperz.PM.DataModel.User.Header.OneTimePasswords.superclass.prepareRemoteDataWithKey.apply(this, arguments); |
80 | console.log("<<< OneTimePasswords.prepareRemoteDataWithKey"); | ||
81 | 73 | ||
82 | return result; | 74 | return result; |
83 | }, | 75 | }, |
84 | */ | 76 | */ |
85 | //========================================================================= | 77 | //========================================================================= |
86 | 78 | ||
87 | 'oneTimePasswords': function () { | 79 | 'oneTimePasswords': function () { |
88 | vardeferredResult; | 80 | vardeferredResult; |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js index b164889..f1f95e8 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.Preferences.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.Preferences depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js index f77ea80..5681f70 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.Header.RecordIndex.js | |||
@@ -1,43 +1,40 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.DataModel.User) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!"; | 25 | throw "Clipperz.PM.DataModel.User.Header.RecordIndex depends on Clipperz.PM.DataModel.User!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } | 28 | if (typeof(Clipperz.PM.DataModel.User.Header) == 'undefined') { Clipperz.PM.DataModel.User.Header = {}; } |
31 | 29 | ||
32 | Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) { | 30 | Clipperz.PM.DataModel.User.Header.RecordIndex = function(args) { |
33 | Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.DataModel.User.Header.RecordIndex.superclass.constructor.apply(this, arguments); |
34 | 32 | ||
35 | //console.log("NEW Clipperz.PM.DataModel.User.Header.RecordIndex", args); | ||
36 | this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ | 33 | this._recordsData = new Clipperz.PM.DataModel.EncryptedRemoteObject({ |
37 | 'name':'recordsData', | 34 | 'name':'recordsData', |
38 | 'retrieveKeyFunction': args.retrieveKeyFunction, | 35 | 'retrieveKeyFunction': args.retrieveKeyFunction, |
39 | 'remoteData': { | 36 | 'remoteData': { |
40 | 'data': args.recordsData['data'], | 37 | 'data': args.recordsData['data'], |
41 | 'version': args.encryptedDataVersion, | 38 | 'version': args.encryptedDataVersion, |
42 | 'recordsStats': args.recordsStats | 39 | 'recordsStats': args.recordsStats |
43 | }//, | 40 | }//, |
@@ -113,17 +110,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, { | |||
113 | if (this._transientState == null) { | 110 | if (this._transientState == null) { |
114 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/); | 111 | this._transientState = new Clipperz.KeyValueObjectStore(/*{'name':'User.Header.RecordIndex.transientState [1]'}*/); |
115 | } | 112 | } |
116 | 113 | ||
117 | return this._transientState; | 114 | return this._transientState; |
118 | }, | 115 | }, |
119 | 116 | ||
120 | 'resetTransientState': function (isCommitting) { | 117 | 'resetTransientState': function (isCommitting) { |
121 | //console.log("######## UserHeaderRecordIndex - resetTransientState", Clipperz.Base.deepClone(this._transientState)); | ||
122 | if (this._transientState != null) { | 118 | if (this._transientState != null) { |
123 | this._transientState.removeAllData(); | 119 | this._transientState.removeAllData(); |
124 | } | 120 | } |
125 | 121 | ||
126 | this._transientState = null; | 122 | this._transientState = null; |
127 | }, | 123 | }, |
128 | 124 | ||
129 | //------------------------------------------------------------------------- | 125 | //------------------------------------------------------------------------- |
@@ -153,25 +149,23 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User.Header.RecordIndex, Object, { | |||
153 | 149 | ||
154 | //------------------------------------------------------------------------- | 150 | //------------------------------------------------------------------------- |
155 | 151 | ||
156 | 'getDirectLoginIndexData': function (aDirectLoginReference) { | 152 | 'getDirectLoginIndexData': function (aDirectLoginReference) { |
157 | return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]); | 153 | return this.directLoginsData().getValue(this.directLoginsIndex()[aDirectLoginReference]); |
158 | }, | 154 | }, |
159 | 155 | ||
160 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { | 156 | 'setDirectLoginIndexData': function (aDirectLoginReference, aKey, aValue) { |
161 | //console.log("UserHeaderRecordIndex.setDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference], aKey); | ||
162 | //if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) { | 157 | //if (MochiKit.Base.isUndefinedOrNull(this.directLoginsIndex()[aDirectLoginReference])) { |
163 | //throw "PIPPO"; | 158 | //throw "PIPPO"; |
164 | //} | 159 | //} |
165 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue); | 160 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference] + '.' + aKey, aValue); |
166 | }, | 161 | }, |
167 | 162 | ||
168 | 'addDirectLoginIndexData': function (aDirectLoginReference) { | 163 | 'addDirectLoginIndexData': function (aDirectLoginReference) { |
169 | //console.log("UserHeaderRecordIndex.addDirectLoginIndexData", aDirectLoginReference, this.directLoginsIndex()[aDirectLoginReference]); | ||
170 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {}); | 164 | return this.directLoginsData().setValue(this.directLoginsIndex()[aDirectLoginReference], {}); |
171 | }, | 165 | }, |
172 | 166 | ||
173 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { | 167 | 'removeDirectLoginIndexData': function (aDirectLoginReference) { |
174 | return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference]) | 168 | return this.directLoginsData().removeValue(this.directLoginsIndex()[aDirectLoginReference]) |
175 | }, | 169 | }, |
176 | 170 | ||
177 | //------------------------------------------------------------------------- | 171 | //------------------------------------------------------------------------- |
@@ -256,22 +250,17 @@ Clipperz.log("SKIPPING record " + reference + " as there are no stas associated | |||
256 | 250 | ||
257 | if (record != null) { | 251 | if (record != null) { |
258 | // directLogin = new Clipperz.PM.DataModel.DirectLogin({ | 252 | // directLogin = new Clipperz.PM.DataModel.DirectLogin({ |
259 | new Clipperz.PM.DataModel.DirectLogin({ | 253 | new Clipperz.PM.DataModel.DirectLogin({ |
260 | 'reference': reference, | 254 | 'reference': reference, |
261 | 'record': record | 255 | 'record': record |
262 | }); | 256 | }); |
263 | } else { | 257 | } else { |
264 | Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | 258 | Clipperz.logWarning("WARNING: DIRECT LOGIN without a matching RECORD!!"); |
265 | //console.log("direct login data", someData['directLogins']); | ||
266 | //console.log("current direct login data", someData['directLogins'][indexReference]) | ||
267 | //console.log("reference", reference); | ||
268 | //console.log("record index", this.recordsIndex()); | ||
269 | //console.log("record inverted index", recordsInvertedIndex); | ||
270 | } | 259 | } |
271 | } | 260 | } |
272 | 261 | ||
273 | return this._records; | 262 | return this._records; |
274 | }, this)); | 263 | }, this)); |
275 | innerDeferredResult.callback(); | 264 | innerDeferredResult.callback(); |
276 | } else { | 265 | } else { |
277 | innerDeferredResult = MochiKit.Async.succeed(this._records); | 266 | innerDeferredResult = MochiKit.Async.succeed(this._records); |
@@ -300,17 +289,16 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | |||
300 | }, | 289 | }, |
301 | 290 | ||
302 | //......................................................................... | 291 | //......................................................................... |
303 | 292 | ||
304 | 'createNewRecord': function () { | 293 | 'createNewRecord': function () { |
305 | var deferredResult; | 294 | var deferredResult; |
306 | var newRecord; | 295 | var newRecord; |
307 | 296 | ||
308 | //console.log("#### new Clipperz.PM.DataModel.Record [4]"); | ||
309 | newRecord = new Clipperz.PM.DataModel.Record({ | 297 | newRecord = new Clipperz.PM.DataModel.Record({ |
310 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), | 298 | 'retrieveKeyFunction': MochiKit.Base.method(this, 'getRecordKey'), |
311 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), | 299 | 'retrieveRemoteDataFunction':this.retrieveRecordDetailFunction(), |
312 | 300 | ||
313 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), | 301 | 'retrieveIndexDataFunction':MochiKit.Base.method(this, 'getRecordIndexData'), |
314 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), | 302 | 'updateIndexDataFunction': MochiKit.Base.method(this, 'updateRecordIndexData'), |
315 | 'updateDate': Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), | 303 | 'updateDate': Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), |
316 | 304 | ||
@@ -381,19 +369,17 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | |||
381 | var newDirectLogin; | 369 | var newDirectLogin; |
382 | varnewDirectLoginIndexValue; | 370 | varnewDirectLoginIndexValue; |
383 | 371 | ||
384 | newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord}); | 372 | newDirectLogin = new Clipperz.PM.DataModel.DirectLogin({record:aRecord}); |
385 | newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1; | 373 | newDirectLoginIndexValue = MochiKit.Base.listMax(MochiKit.Base.map(function (aValue) { return aValue * 1; }, MochiKit.Base.values(this.directLoginsIndex()))) + 1; |
386 | 374 | ||
387 | this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); | 375 | this.transientState().setValue('newDirectLoginReferences' + '.' + newDirectLogin.reference(), newDirectLogin); |
388 | 376 | ||
389 | //console.log("UserHeaderRecordIndex.createNewDirectLogin [1]", newDirectLogin.reference(), newDirectLoginIndexValue); | ||
390 | this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; | 377 | this.directLoginsIndex()[newDirectLogin.reference()] = newDirectLoginIndexValue; |
391 | //console.log("UserHeaderRecordIndex.createNewDirectLogin [2]", newDirectLogin.reference(), this.directLoginsIndex()[newDirectLogin.reference()]); | ||
392 | this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); | 378 | this.directLoginsData().setValue(this.directLoginsIndex()[newDirectLogin.reference()], {'record': this.recordsIndex()[aRecord.reference()]}); |
393 | 379 | ||
394 | return newDirectLogin; | 380 | return newDirectLogin; |
395 | }, | 381 | }, |
396 | 382 | ||
397 | //========================================================================= | 383 | //========================================================================= |
398 | 384 | ||
399 | 'deleteAllCleanTextData': function () { | 385 | 'deleteAllCleanTextData': function () { |
@@ -426,17 +412,16 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | |||
426 | ], | 412 | ], |
427 | // 'records': [ | 413 | // 'records': [ |
428 | // MochiKit.Base.method(this, 'records'), | 414 | // MochiKit.Base.method(this, 'records'), |
429 | // MochiKit.Base.values, | 415 | // MochiKit.Base.values, |
430 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), | 416 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.methodcaller('hasAnyCleanTextData')), |
431 | // Clipperz.Async.collectAll | 417 | // Clipperz.Async.collectAll |
432 | // ] | 418 | // ] |
433 | }); | 419 | }); |
434 | //deferredResult.addCallback(function (aValue) { console.log("USER.Header.RecordIndex.hasAnyCleanTextData", aValue); return aValue}); | ||
435 | 420 | ||
436 | // deferredResult.addCallback(MochiKit.Base.values); | 421 | // deferredResult.addCallback(MochiKit.Base.values); |
437 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); | 422 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); |
438 | // deferredResult.addCallback(function(someValues) { | 423 | // deferredResult.addCallback(function(someValues) { |
439 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 424 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
440 | // }); | 425 | // }); |
441 | deferredResult.addCallback(Clipperz.Async.or); | 426 | deferredResult.addCallback(Clipperz.Async.or); |
442 | 427 | ||
@@ -456,17 +441,16 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | |||
456 | MochiKit.Base.method(this, 'recordsData'), | 441 | MochiKit.Base.method(this, 'recordsData'), |
457 | MochiKit.Base.methodcaller('hasPendingChanges') | 442 | MochiKit.Base.methodcaller('hasPendingChanges') |
458 | ], | 443 | ], |
459 | 'directLoginsData': [ | 444 | 'directLoginsData': [ |
460 | MochiKit.Base.method(this, 'directLoginsData'), | 445 | MochiKit.Base.method(this, 'directLoginsData'), |
461 | MochiKit.Base.methodcaller('hasPendingChanges') | 446 | MochiKit.Base.methodcaller('hasPendingChanges') |
462 | ] | 447 | ] |
463 | }); | 448 | }); |
464 | //deferredResult.addCallback(function (aValue) { console.log("UserHeaderIndex.hasPendingResults", aValue); return aValue; }); | ||
465 | deferredResult.addCallback(Clipperz.Async.or); | 449 | deferredResult.addCallback(Clipperz.Async.or); |
466 | // deferredResult.addCallback(MochiKit.Base.values); | 450 | // deferredResult.addCallback(MochiKit.Base.values); |
467 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); | 451 | // deferredResult.addCallback(MochiKit.Base.flattenArguments); |
468 | // deferredResult.addCallback(function(someValues) { | 452 | // deferredResult.addCallback(function(someValues) { |
469 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); | 453 | // return MochiKit.Iter.some(someValues, MochiKit.Base.operator.identity); |
470 | // }); | 454 | // }); |
471 | deferredResult.callback(); | 455 | deferredResult.callback(); |
472 | 456 | ||
@@ -565,17 +549,16 @@ Clipperz.log("WARNING: DIRECT LOGIN without a matching RECORD!!"); | |||
565 | // "7e1d069b7fa57c03bd7bf48807520feb953157834503aaff8c9d493f37dea69d":"18" | 549 | // "7e1d069b7fa57c03bd7bf48807520feb953157834503aaff8c9d493f37dea69d":"18" |
566 | // }, | 550 | // }, |
567 | // "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x" | 551 | // "data":"5YG9KKU/OZ5guUgFlms6k1 ... ZG/5Fn0uN+LoAsNfHm+EE62x" |
568 | // }, | 552 | // }, |
569 | 553 | ||
570 | var deferredResult; | 554 | var deferredResult; |
571 | var result; | 555 | var result; |
572 | 556 | ||
573 | //console.log("recordsIndex", this.recordsIndex()); | ||
574 | result = {}; | 557 | result = {}; |
575 | 558 | ||
576 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false}); | 559 | deferredResult = new Clipperz.Async.Deferred("User.Header.RecordIndex.prepareRemoteDataWithKey", {trace:false}); |
577 | deferredResult.collectResults({ | 560 | deferredResult.collectResults({ |
578 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()), | 561 | 'index':MochiKit.Base.partial(MochiKit.Async.succeed, this.recordsIndex()), |
579 | 'data': [ | 562 | 'data': [ |
580 | MochiKit.Base.method(this.recordsData(), 'prepareRemoteDataWithKey', aKey), | 563 | MochiKit.Base.method(this.recordsData(), 'prepareRemoteDataWithKey', aKey), |
581 | MochiKit.Base.itemgetter('data') | 564 | MochiKit.Base.itemgetter('data') |
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/User.js b/frontend/gamma/js/Clipperz/PM/DataModel/User.js index 646ce21..fd18faf 100644 --- a/frontend/gamma/js/Clipperz/PM/DataModel/User.js +++ b/frontend/gamma/js/Clipperz/PM/DataModel/User.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } | 26 | if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } |
29 | 27 | ||
30 | 28 | ||
@@ -323,17 +321,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | |||
323 | 'unpackServerData': function (someServerData) { | 321 | 'unpackServerData': function (someServerData) { |
324 | var unpackedData; | 322 | var unpackedData; |
325 | var headerVersion; | 323 | var headerVersion; |
326 | 324 | ||
327 | varrecordsIndex; | 325 | varrecordsIndex; |
328 | var preferences; | 326 | var preferences; |
329 | var oneTimePasswords; | 327 | var oneTimePasswords; |
330 | 328 | ||
331 | //console.log(">>> ***************** user.unpackServerData", someServerData); | ||
332 | // this.setServerLockValue(someServerData['lock']); | 329 | // this.setServerLockValue(someServerData['lock']); |
333 | 330 | ||
334 | headerVersion = this.headerFormatVersion(someServerData['header']); | 331 | headerVersion = this.headerFormatVersion(someServerData['header']); |
335 | 332 | ||
336 | switch (headerVersion) { | 333 | switch (headerVersion) { |
337 | case 'LEGACY': | 334 | case 'LEGACY': |
338 | varlegacyHeader; | 335 | varlegacyHeader; |
339 | 336 | ||
@@ -412,17 +409,16 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, { | |||
412 | 409 | ||
413 | 'recordsIndex': recordsIndex, | 410 | 'recordsIndex': recordsIndex, |
414 | 'preferences': preferences, | 411 | 'preferences': preferences, |
415 | 'oneTimePasswords': oneTimePasswords | 412 | 'oneTimePasswords': oneTimePasswords |
416 | } | 413 | } |
417 | }; | 414 | }; |
418 | 415 | ||
419 | this._serverData = unpackedData; | 416 | this._serverData = unpackedData; |
420 | //console.log("<<< ***************** user.unpackServerData", this._serverData); | ||
421 | 417 | ||
422 | return this._serverData; | 418 | return this._serverData; |
423 | }, | 419 | }, |
424 | 420 | ||
425 | //------------------------------------------------------------------------- | 421 | //------------------------------------------------------------------------- |
426 | 422 | ||
427 | 'getServerData': function() { | 423 | 'getServerData': function() { |
428 | var deferredResult; | 424 | var deferredResult; |
diff --git a/frontend/gamma/js/Clipperz/PM/Date.js b/frontend/gamma/js/Clipperz/PM/Date.js index 96a2700..a62857e 100644 --- a/frontend/gamma/js/Clipperz/PM/Date.js +++ b/frontend/gamma/js/Clipperz/PM/Date.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Date) == 'undefined') { Clipperz.PM.Date = {}; } | 26 | if (typeof(Clipperz.PM.Date) == 'undefined') { Clipperz.PM.Date = {}; } |
29 | 27 | ||
30 | Clipperz.PM.Date.VERSION = "0.1"; | 28 | Clipperz.PM.Date.VERSION = "0.1"; |
diff --git a/frontend/gamma/js/Clipperz/PM/PIN.js b/frontend/gamma/js/Clipperz/PM/PIN.js index bc932b2..a32889a 100644 --- a/frontend/gamma/js/Clipperz/PM/PIN.js +++ b/frontend/gamma/js/Clipperz/PM/PIN.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.PIN) == 'undefined') { Clipperz.PM.PIN = {}; } | 26 | if (typeof(Clipperz.PM.PIN) == 'undefined') { Clipperz.PM.PIN = {}; } |
29 | 27 | ||
30 | MochiKit.Base.update(Clipperz.PM.PIN, { | 28 | MochiKit.Base.update(Clipperz.PM.PIN, { |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy.js b/frontend/gamma/js/Clipperz/PM/Proxy.js index 190bffd..a5eaae6 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
@@ -64,17 +62,16 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { | |||
64 | return this._tolls; | 62 | return this._tolls; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
68 | 66 | ||
69 | 'payToll': function(aRequestType, someParameters) { | 67 | 'payToll': function(aRequestType, someParameters) { |
70 | vardeferredResult; | 68 | vardeferredResult; |
71 | 69 | ||
72 | //console.log(">>> Proxy.payToll", aRequestType, someParameters); | ||
73 | if (this.shouldPayTolls()) { | 70 | if (this.shouldPayTolls()) { |
74 | deferredResult = new Clipperz.Async.Deferred("Proxy.payToll", {trace:false}); | 71 | deferredResult = new Clipperz.Async.Deferred("Proxy.payToll", {trace:false}); |
75 | 72 | ||
76 | if (this.tolls()[aRequestType].length == 0) { | 73 | if (this.tolls()[aRequestType].length == 0) { |
77 | deferredResult.addMethod(this, 'sendMessage', 'knock', {requestType:aRequestType}); | 74 | deferredResult.addMethod(this, 'sendMessage', 'knock', {requestType:aRequestType}); |
78 | deferredResult.addMethod(this, 'setTollCallback'); | 75 | deferredResult.addMethod(this, 'setTollCallback'); |
79 | } | 76 | } |
80 | deferredResult.addMethod(this.tolls()[aRequestType], 'pop'); | 77 | deferredResult.addMethod(this.tolls()[aRequestType], 'pop'); |
@@ -89,38 +86,33 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { | |||
89 | 86 | ||
90 | return result; | 87 | return result; |
91 | }); | 88 | }); |
92 | 89 | ||
93 | deferredResult.callback(); | 90 | deferredResult.callback(); |
94 | } else { | 91 | } else { |
95 | deferredResult = MochiKit.Async.succeed({parameters:someParameters}); | 92 | deferredResult = MochiKit.Async.succeed({parameters:someParameters}); |
96 | } | 93 | } |
97 | //console.log("<<< Proxy.payToll"); | ||
98 | 94 | ||
99 | return deferredResult; | 95 | return deferredResult; |
100 | }, | 96 | }, |
101 | 97 | ||
102 | //------------------------------------------------------------------------- | 98 | //------------------------------------------------------------------------- |
103 | 99 | ||
104 | 'addToll': function(aToll) { | 100 | 'addToll': function(aToll) { |
105 | //console.log(">>> Proxy.addToll", aToll); | ||
106 | this.tolls()[aToll.requestType()].push(aToll); | 101 | this.tolls()[aToll.requestType()].push(aToll); |
107 | //console.log("<<< Proxy.addToll"); | ||
108 | }, | 102 | }, |
109 | 103 | ||
110 | //========================================================================= | 104 | //========================================================================= |
111 | 105 | ||
112 | 'setTollCallback': function(someParameters) { | 106 | 'setTollCallback': function(someParameters) { |
113 | //console.log(">>> Proxy.setTollCallback", someParameters); | ||
114 | if (typeof(someParameters['toll']) != 'undefined') { | 107 | if (typeof(someParameters['toll']) != 'undefined') { |
115 | //console.log("added a new toll", someParameters['toll']); | ||
116 | this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); | 108 | this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); |
117 | } | 109 | } |
118 | //console.log("<<< Proxy.setTallCallback", someParameters['result']); | 110 | |
119 | return someParameters['result']; | 111 | return someParameters['result']; |
120 | }, | 112 | }, |
121 | 113 | ||
122 | //========================================================================= | 114 | //========================================================================= |
123 | 115 | ||
124 | 'registration': function (someParameters) { | 116 | 'registration': function (someParameters) { |
125 | return this.processMessage('registration', someParameters, 'REGISTER'); | 117 | return this.processMessage('registration', someParameters, 'REGISTER'); |
126 | }, | 118 | }, |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js index 5b39b4a..7d10dd4 100755 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js index 01ba122..326022c 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; | 25 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
@@ -102,32 +100,30 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
102 | c = someData['users'].length; | 100 | c = someData['users'].length; |
103 | 101 | ||
104 | for (i=0; i<c; i++) { | 102 | for (i=0; i<c; i++) { |
105 | varnewConnection; | 103 | varnewConnection; |
106 | varrecordConfiguration; | 104 | varrecordConfiguration; |
107 | 105 | ||
108 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); | 106 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); |
109 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { | 107 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { |
110 | //console.log("SERIALIZED USER", aUserSerializationContext); | ||
111 | resultData['users'][aUserSerializationContext['credentials']['C']] = { | 108 | resultData['users'][aUserSerializationContext['credentials']['C']] = { |
112 | 's': aUserSerializationContext['credentials']['s'], | 109 | 's': aUserSerializationContext['credentials']['s'], |
113 | 'v': aUserSerializationContext['credentials']['v'], | 110 | 'v': aUserSerializationContext['credentials']['v'], |
114 | 'version': aUserSerializationContext['data']['connectionVersion'], | 111 | 'version': aUserSerializationContext['data']['connectionVersion'], |
115 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], | 112 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], |
116 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], | 113 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], |
117 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], | 114 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], |
118 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], | 115 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], |
119 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) | 116 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) |
120 | } | 117 | } |
121 | }, this)); | 118 | }, this)); |
122 | } | 119 | } |
123 | 120 | ||
124 | deferredResult.addCallback(MochiKit.Base.bind(function() { | 121 | deferredResult.addCallback(MochiKit.Base.bind(function() { |
125 | //console.log("this._data", resultData); | ||
126 | this._data = resultData; | 122 | this._data = resultData; |
127 | }, this)); | 123 | }, this)); |
128 | 124 | ||
129 | deferredResult.callback(); | 125 | deferredResult.callback(); |
130 | //Clipperz.log("<<< Proxy.Test.setupWithData"); | 126 | //Clipperz.log("<<< Proxy.Test.setupWithData"); |
131 | 127 | ||
132 | return deferredResult; | 128 | return deferredResult; |
133 | }, | 129 | }, |
@@ -390,17 +386,17 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
390 | } catch (exception) { | 386 | } catch (exception) { |
391 | result = { | 387 | result = { |
392 | 'data': Clipperz.PM.Crypto.randomKey(), | 388 | 'data': Clipperz.PM.Crypto.randomKey(), |
393 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion | 389 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion |
394 | } | 390 | } |
395 | } | 391 | } |
396 | nextTollRequestType = 'CONNECT'; | 392 | nextTollRequestType = 'CONNECT'; |
397 | } else { | 393 | } else { |
398 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); | 394 | Clipperz.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); |
399 | } | 395 | } |
400 | 396 | ||
401 | result = { | 397 | result = { |
402 | result: result, | 398 | result: result, |
403 | toll: this.getTollForRequestType(nextTollRequestType) | 399 | toll: this.getTollForRequestType(nextTollRequestType) |
404 | } | 400 | } |
405 | 401 | ||
406 | return result; | 402 | return result; |
@@ -520,19 +516,16 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
520 | } else { | 516 | } else { |
521 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 517 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
522 | } | 518 | } |
523 | //===================================================================== | 519 | //===================================================================== |
524 | /* } else if (someParameters.message == 'updateData') { | 520 | /* } else if (someParameters.message == 'updateData') { |
525 | if (this.isReadOnly() == false) { | 521 | if (this.isReadOnly() == false) { |
526 | var i, c; | 522 | var i, c; |
527 | 523 | ||
528 | //console.log("###==============================================================="); | ||
529 | //console.log("###>>>", Clipperz.Base.serializeJSON(someParameters)); | ||
530 | //console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData())); | ||
531 | if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) { | 524 | if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) { |
532 | throw "the lock attribute is not processed correctly" | 525 | throw "the lock attribute is not processed correctly" |
533 | } | 526 | } |
534 | 527 | ||
535 | this.userData()['userDetails'] = someParameters['parameters']['user']['header']; | 528 | this.userData()['userDetails'] = someParameters['parameters']['user']['header']; |
536 | this.userData()['statistics'] = someParameters['parameters']['user']['statistics']; | 529 | this.userData()['statistics'] = someParameters['parameters']['user']['statistics']; |
537 | this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version']; | 530 | this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version']; |
538 | 531 | ||
@@ -557,32 +550,24 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
557 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], | 550 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], |
558 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'] | 551 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'] |
559 | } | 552 | } |
560 | } | 553 | } |
561 | 554 | ||
562 | this.userData()['lock'] = Clipperz.PM.Crypto.randomKey(); | 555 | this.userData()['lock'] = Clipperz.PM.Crypto.randomKey(); |
563 | result['lock'] = this.userData()['lock']; | 556 | result['lock'] = this.userData()['lock']; |
564 | result['result'] = 'done'; | 557 | result['result'] = 'done'; |
565 | //console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData())); | ||
566 | } else { | 558 | } else { |
567 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 559 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
568 | } | 560 | } |
569 | */ //===================================================================== | 561 | */ //===================================================================== |
570 | } else if (someParameters.message == 'saveChanges') { | 562 | } else if (someParameters.message == 'saveChanges') { |
571 | if (this.isReadOnly() == false) { | 563 | if (this.isReadOnly() == false) { |
572 | var i, c; | 564 | var i, c; |
573 | 565 | ||
574 | //console.log("###==============================================================="); | ||
575 | //console.log("###>>>", someParameters); | ||
576 | //console.log("###>>>", Clipperz.Base.serializeJSON(someParameters)); | ||
577 | //console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData())); | ||
578 | //console.log("###==============================================================="); | ||
579 | //console.log("--- userData.lock ", this.userData()['lock']); | ||
580 | //console.log("--- parameters.lock", someParameters['parameters']['user']['lock']); | ||
581 | if (aConnection['userData']['lock']!= someParameters['parameters']['user']['lock']) { | 566 | if (aConnection['userData']['lock']!= someParameters['parameters']['user']['lock']) { |
582 | throw "the lock attribute is not processed correctly" | 567 | throw "the lock attribute is not processed correctly" |
583 | } | 568 | } |
584 | 569 | ||
585 | aConnection['userData']['userDetails'] = someParameters['parameters']['user']['header']; | 570 | aConnection['userData']['userDetails'] = someParameters['parameters']['user']['header']; |
586 | aConnection['userData']['statistics'] = someParameters['parameters']['user']['statistics']; | 571 | aConnection['userData']['statistics'] = someParameters['parameters']['user']['statistics']; |
587 | aConnection['userData']['userDetailsVersions']= someParameters['parameters']['user']['version']; | 572 | aConnection['userData']['userDetailsVersions']= someParameters['parameters']['user']['version']; |
588 | 573 | ||
@@ -594,17 +579,16 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
594 | currentRecordData = someParameters['parameters']['records']['updated'][i]; | 579 | currentRecordData = someParameters['parameters']['records']['updated'][i]; |
595 | currentRecord = aConnection['userData']['records'][currentRecordData['record']['reference']]; | 580 | currentRecord = aConnection['userData']['records'][currentRecordData['record']['reference']]; |
596 | 581 | ||
597 | if ( | 582 | if ( |
598 | (typeof(aConnection['userData']['records'][currentRecordData['record']['reference']]) == 'undefined') | 583 | (typeof(aConnection['userData']['records'][currentRecordData['record']['reference']]) == 'undefined') |
599 | && | 584 | && |
600 | (typeof(currentRecordData['currentRecordVersion']) == 'undefined') | 585 | (typeof(currentRecordData['currentRecordVersion']) == 'undefined') |
601 | ) { | 586 | ) { |
602 | //console.log("######## SHIT HAPPENS"); | ||
603 | throw "Record added without a recordVersion"; | 587 | throw "Record added without a recordVersion"; |
604 | } | 588 | } |
605 | 589 | ||
606 | if (currentRecord == null) { | 590 | if (currentRecord == null) { |
607 | currentRecord = {}; | 591 | currentRecord = {}; |
608 | currentRecord['versions'] = {}; | 592 | currentRecord['versions'] = {}; |
609 | currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 593 | currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
610 | currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 594 | currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
@@ -630,35 +614,33 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
630 | } | 614 | } |
631 | } | 615 | } |
632 | 616 | ||
633 | c = someParameters['parameters']['records']['deleted'].length; | 617 | c = someParameters['parameters']['records']['deleted'].length; |
634 | for (i=0; i<c; i++) { | 618 | for (i=0; i<c; i++) { |
635 | var currentRecordReference; | 619 | var currentRecordReference; |
636 | 620 | ||
637 | currentRecordReference = someParameters['parameters']['records']['deleted'][i]; | 621 | currentRecordReference = someParameters['parameters']['records']['deleted'][i]; |
638 | //console.log("DELETING records", currentRecordReference); | ||
639 | delete aConnection['userData']['records'][currentRecordReference]; | 622 | delete aConnection['userData']['records'][currentRecordReference]; |
640 | } | 623 | } |
641 | 624 | ||
642 | aConnection['userData']['lock'] = Clipperz.PM.Crypto.randomKey(); | 625 | aConnection['userData']['lock'] = Clipperz.PM.Crypto.randomKey(); |
643 | result['lock'] = aConnection['userData']['lock']; | 626 | result['lock'] = aConnection['userData']['lock']; |
644 | result['result'] = 'done'; | 627 | result['result'] = 'done'; |
645 | //console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData())); | ||
646 | } else { | 628 | } else { |
647 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 629 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
648 | } | 630 | } |
649 | 631 | ||
650 | //===================================================================== | 632 | //===================================================================== |
651 | // | 633 | // |
652 | // U N H A N D L E D M e t h o d | 634 | // U N H A N D L E D M e t h o d |
653 | // | 635 | // |
654 | //===================================================================== | 636 | //===================================================================== |
655 | } else { | 637 | } else { |
656 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message); | 638 | Clipperz.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message); |
657 | } | 639 | } |
658 | 640 | ||
659 | result = { | 641 | result = { |
660 | result: result, | 642 | result: result, |
661 | toll: this.getTollForRequestType('MESSAGE') | 643 | toll: this.getTollForRequestType('MESSAGE') |
662 | } | 644 | } |
663 | 645 | ||
664 | // return MochiKit.Async.succeed(result); | 646 | // return MochiKit.Async.succeed(result); |
@@ -681,22 +663,22 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
681 | 663 | ||
682 | 'userDetails': function(aConnection) { | 664 | 'userDetails': function(aConnection) { |
683 | var result; | 665 | var result; |
684 | 666 | ||
685 | if (this.isTestData(aConnection)) { | 667 | if (this.isTestData(aConnection)) { |
686 | var serializedHeader; | 668 | var serializedHeader; |
687 | var version; | 669 | var version; |
688 | 670 | ||
689 | //MochiKit.Logging.logDebug("### test data"); | 671 | //Clipperz.logDebug("### test data"); |
690 | version = aConnection['userData']['userDetailsVersion']; | 672 | version = aConnection['userData']['userDetailsVersion']; |
691 | serializedHeader = Clipperz.Base.serializeJSON(aConnection['userData']['userDetails']); | 673 | serializedHeader = Clipperz.Base.serializeJSON(aConnection['userData']['userDetails']); |
692 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedHeader); | 674 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedHeader); |
693 | } else { | 675 | } else { |
694 | //MochiKit.Logging.logDebug("### NOT test data"); | 676 | //Clipperz.logDebug("### NOT test data"); |
695 | result = aConnection['userData']['userDetails']; | 677 | result = aConnection['userData']['userDetails']; |
696 | } | 678 | } |
697 | 679 | ||
698 | return result; | 680 | return result; |
699 | }, | 681 | }, |
700 | 682 | ||
701 | 'statistics': function(aConnection) { | 683 | 'statistics': function(aConnection) { |
702 | var result; | 684 | var result; |
@@ -744,21 +726,19 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
744 | 726 | ||
745 | connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]() | 727 | connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]() |
746 | aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase()); | 728 | aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase()); |
747 | 729 | ||
748 | return aDeferredContext; | 730 | return aDeferredContext; |
749 | }); | 731 | }); |
750 | 732 | ||
751 | // deferredResult.addCallback(function(aDeferredContext) { | 733 | // deferredResult.addCallback(function(aDeferredContext) { |
752 | //console.log("#-#-#-#-#", aDeferredContext); | ||
753 | // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); | 734 | // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); |
754 | // }, deferredContext); | 735 | // }, deferredContext); |
755 | // deferredResult.addCallback(function(aUserSerializedData) { | 736 | // deferredResult.addCallback(function(aUserSerializedData) { |
756 | //console.log("USER SERIALIZED DATA", aUserSerializedData); | ||
757 | // }); | 737 | // }); |
758 | // | 738 | // |
759 | // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext); | 739 | // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext); |
760 | deferredResult.callback(deferredContext); | 740 | deferredResult.callback(deferredContext); |
761 | 741 | ||
762 | return deferredResult; | 742 | return deferredResult; |
763 | }, | 743 | }, |
764 | 744 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js index a86ac4f..5764bda 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js index 803c590..f628975 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js index d554c6a..d459726 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } | 26 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
@@ -93,57 +91,51 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Test, Clipperz.PM.Proxy.Offline, { | |||
93 | 'resetUnexpectedRequests': function () { | 91 | 'resetUnexpectedRequests': function () { |
94 | this._unexpectedRequests = []; | 92 | this._unexpectedRequests = []; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //------------------------------------------------------------------------- | 95 | //------------------------------------------------------------------------- |
98 | 96 | ||
99 | 'testExpectedRequestParameters': function (aPath, anActualRequest, anExpectedRequest) { | 97 | 'testExpectedRequestParameters': function (aPath, anActualRequest, anExpectedRequest) { |
100 | var aKey; | 98 | var aKey; |
101 | //console.log(">>> Proxy.testExpectedRequestParameters [" + aPath + "]", anActualRequest, anExpectedRequest); | ||
102 | for (aKey in anExpectedRequest) { | 99 | for (aKey in anExpectedRequest) { |
103 | if (typeof(anActualRequest[aKey]) == 'undefined') { | 100 | if (typeof(anActualRequest[aKey]) == 'undefined') { |
104 | throw "the expected paramter [" + aKey + "] is missing from the actual request"; | 101 | throw "the expected paramter [" + aKey + "] is missing from the actual request"; |
105 | } | 102 | } |
106 | if (typeof(anExpectedRequest[aKey]) == 'object') { | 103 | if (typeof(anExpectedRequest[aKey]) == 'object') { |
107 | this.testExpectedRequestParameters(aPath + "." + aKey, anActualRequest[aKey], anExpectedRequest[aKey]) | 104 | this.testExpectedRequestParameters(aPath + "." + aKey, anActualRequest[aKey], anExpectedRequest[aKey]) |
108 | } else { | 105 | } else { |
109 | if (! anExpectedRequest[aKey](anActualRequest[aKey])) { | 106 | if (! anExpectedRequest[aKey](anActualRequest[aKey])) { |
110 | throw "wrong value for paramter [" + aKey + "]; got '" + anActualRequest[aKey] + "'"; | 107 | throw "wrong value for paramter [" + aKey + "]; got '" + anActualRequest[aKey] + "'"; |
111 | } | 108 | } |
112 | } | 109 | } |
113 | } | 110 | } |
114 | //console.log("<<< Proxy.testExpectedRequestParameters"); | ||
115 | }, | 111 | }, |
116 | 112 | ||
117 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
118 | 114 | ||
119 | 'checkRequest': function(aFunctionName, someParameters) { | 115 | 'checkRequest': function(aFunctionName, someParameters) { |
120 | if (this.shouldCheckExpectedRequests()) { | 116 | if (this.shouldCheckExpectedRequests()) { |
121 | var expectedRequest; | 117 | var expectedRequest; |
122 | 118 | ||
123 | //console.log(">>> Proxy.Test.checkRequest - " + aFunctionName, someParameters); | ||
124 | expectedRequest = this.expectedRequests().pop(); | 119 | expectedRequest = this.expectedRequests().pop(); |
125 | //console.log("--- Proxy.Test.checkRequest - expectedRequest", expectedRequest); | ||
126 | if (expectedRequest == null) { | 120 | if (expectedRequest == null) { |
127 | throw "Proxy.Test.sentMessage: no expected result specified. Got request '" + aFunctionName + "': " + someParameters; | 121 | throw "Proxy.Test.sentMessage: no expected result specified. Got request '" + aFunctionName + "': " + someParameters; |
128 | } | 122 | } |
129 | 123 | ||
130 | try { | 124 | try { |
131 | if (aFunctionName != expectedRequest.functionName) { | 125 | if (aFunctionName != expectedRequest.functionName) { |
132 | throw "wrong function name. Got '" + aFunctionName + "', expected '" + expectedRequest.request.functionName + "'"; | 126 | throw "wrong function name. Got '" + aFunctionName + "', expected '" + expectedRequest.request.functionName + "'"; |
133 | } | 127 | } |
134 | 128 | ||
135 | this.testExpectedRequestParameters("parameters", someParameters, expectedRequest.parameters); | 129 | this.testExpectedRequestParameters("parameters", someParameters, expectedRequest.parameters); |
136 | } catch(exception) { | 130 | } catch(exception) { |
137 | //console.log("EXCEPTION: Proxy.Test.sentMessage[" + expectedRequest.name + "]", exception) | ||
138 | throw "Proxy.Test.sentMessage[" + expectedRequest.name + "]: " + exception; | 131 | throw "Proxy.Test.sentMessage[" + expectedRequest.name + "]: " + exception; |
139 | } | 132 | } |
140 | } | 133 | } |
141 | //console.log("<<< Proxy.Test.checkRequest"); | ||
142 | }, | 134 | }, |
143 | 135 | ||
144 | //========================================================================= | 136 | //========================================================================= |
145 | 137 | ||
146 | 'sendMessage': function(aFunctionName, someParameters) { | 138 | 'sendMessage': function(aFunctionName, someParameters) { |
147 | var result; | 139 | var result; |
148 | 140 | ||
149 | if (this.isExpectingRequests() == false) { | 141 | if (this.isExpectingRequests() == false) { |
diff --git a/frontend/gamma/js/Clipperz/PM/Strings.js b/frontend/gamma/js/Clipperz/PM/Strings.js index a051365..7e855ff 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings.js +++ b/frontend/gamma/js/Clipperz/PM/Strings.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } | 26 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } |
29 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } | 27 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } |
30 | 28 | ||
@@ -236,32 +234,27 @@ Clipperz.PM.Strings.Languages.setSelectedLanguage = function(aLanguage) { | |||
236 | 234 | ||
237 | //----------------------------------------------------------------------------- | 235 | //----------------------------------------------------------------------------- |
238 | 236 | ||
239 | Clipperz.PM.Strings.getValue = function (aKeyPath, someKeyValues) { | 237 | Clipperz.PM.Strings.getValue = function (aKeyPath, someKeyValues) { |
240 | varresult; | 238 | varresult; |
241 | 239 | ||
242 | result = Clipperz.PM.Strings.stringsObjectStore.getValue(aKeyPath); | 240 | result = Clipperz.PM.Strings.stringsObjectStore.getValue(aKeyPath); |
243 | 241 | ||
244 | //try { | ||
245 | if (typeof(result) == 'string') { | 242 | if (typeof(result) == 'string') { |
246 | if (typeof (someKeyValues) != 'undefined') { | 243 | if (typeof (someKeyValues) != 'undefined') { |
247 | varkey; | 244 | varkey; |
248 | 245 | ||
249 | for (key in someKeyValues) { | 246 | for (key in someKeyValues) { |
250 | result = result.replace( new RegExp(key), someKeyValues[key]); | 247 | result = result.replace( new RegExp(key), someKeyValues[key]); |
251 | // result.replace(, ''); | ||
252 | } | 248 | } |
253 | } | 249 | } |
254 | 250 | ||
255 | result = result.replace(new RegExp('\n'), '<br>'); | 251 | result = result.replace(new RegExp('\n'), '<br>'); |
256 | } | 252 | } |
257 | //} catch (exception) { | ||
258 | //console.log("####", result, aKeyPath, someKeyValues, exception); | ||
259 | //} | ||
260 | 253 | ||
261 | return result; | 254 | return result; |
262 | } | 255 | } |
263 | 256 | ||
264 | Clipperz.PM.Strings.errorDescriptionForException = function (anException) { | 257 | Clipperz.PM.Strings.errorDescriptionForException = function (anException) { |
265 | var result; | 258 | var result; |
266 | 259 | ||
267 | result = Clipperz.PM.Strings.getValue('exceptionsMessages' + '.' + anException.name); | 260 | result = Clipperz.PM.Strings.getValue('exceptionsMessages' + '.' + anException.name); |
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js b/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js index 7f6c52f..7565d2d 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js +++ b/frontend/gamma/js/Clipperz/PM/Strings/MessagePanelConfigurations.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } | 26 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } |
29 | 27 | ||
30 | Clipperz.PM.Strings.messagePanelConfigurations = { | 28 | Clipperz.PM.Strings.messagePanelConfigurations = { |
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js b/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js index 101ed3f..aefd94a 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js +++ b/frontend/gamma/js/Clipperz/PM/Strings/Strings_defaults.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } | 26 | if (typeof(Clipperz.PM.Strings) == 'undefined') { Clipperz.PM.Strings = {}; } |
29 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } | 27 | if (typeof(Clipperz.PM.Strings.Languages) == 'undefined') { Clipperz.PM.Strings.Languages = {}; } |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js b/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js index b540633..85d55c0 100644 --- a/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js +++ b/frontend/gamma/js/Clipperz/PM/Strings/Strings_en-US.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //============================================================================= | 24 | //============================================================================= |
27 | // | 25 | // |
28 | // E N G L I S H A M E R I C A N ( en_US ) | 26 | // E N G L I S H A M E R I C A N ( en_US ) |
29 | // | 27 | // |
30 | //============================================================================= | 28 | //============================================================================= |
diff --git a/frontend/gamma/js/Clipperz/PM/Toll.js b/frontend/gamma/js/Clipperz/PM/Toll.js index bb31c43..e9c3092 100644 --- a/frontend/gamma/js/Clipperz/PM/Toll.js +++ b/frontend/gamma/js/Clipperz/PM/Toll.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js index 25e82ca..f667526 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/download.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //download.js | 25 | //download.js |
28 | //Download | 26 | //Download |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/15/10 | 28 | //Created by Giulio Cesare Solaroli on 3/15/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js index ba425ec..dae5a2d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/CoverActions/look.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //look.js | 25 | //look.js |
28 | //Look | 26 | //Look |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/15/10 | 28 | //Created by Giulio Cesare Solaroli on 3/15/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js index 5c1f860..497fd05 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/directLogin.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //directLogin.js | 25 | //directLogin.js |
28 | //directLogin | 26 | //directLogin |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js index b829ed6..f015535 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //protect.js | 25 | //protect.js |
28 | //protect | 26 | //protect |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js index 8d73cc7..47972fc 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/share.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //share.js | 25 | //share.js |
28 | //share | 26 | //share |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js index 572d9be..a4f30b2 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/store.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //store.js | 25 | //store.js |
28 | //store | 26 | //store |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js index b9443bd..dccefab 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/GraphicFunctions.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Canvas'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Canvas'); |
27 | 25 | ||
28 | MochiKit.Base.update(Clipperz.PM.UI.Canvas , { | 26 | MochiKit.Base.update(Clipperz.PM.UI.Canvas , { |
29 | 'marks': { | 27 | 'marks': { |
30 | '!':Clipperz_PM_UI_Canvas_Marks_exclamationMark, | 28 | '!':Clipperz_PM_UI_Canvas_Marks_exclamationMark, |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js index cc60bba..24c0bc3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Logo/normal.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //normal.js | 25 | //normal.js |
28 | //New Image | 26 | //New Image |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 2/13/12 | 28 | //Created by Giulio Cesare Solaroli on 2/13/12 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js index 02f2f80..5982f0d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/exclamationMark.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //exclamationMark.js | 25 | //exclamationMark.js |
28 | //! | 26 | //! |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js index fad5c10..2501992 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/info.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //info.js | 25 | //info.js |
28 | //i | 26 | //i |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js index 5842828..9a8ac7d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Marks/questionMark.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //questionMark.js | 25 | //questionMark.js |
28 | //? | 26 | //? |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/7/10 | 28 | //Created by Giulio Cesare Solaroli on 3/7/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js index 2462d0e..65e5ca6 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/RegisterButton/normal.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //normal.js | 25 | //normal.js |
28 | //normal | 26 | //normal |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/24/10 | 28 | //Created by Giulio Cesare Solaroli on 3/24/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js index cf475c6..5b344ef 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Star/normal.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //normal.js | 25 | //normal.js |
28 | //normal | 26 | //normal |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/15/10 | 28 | //Created by Giulio Cesare Solaroli on 3/15/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js index cd7ed90..21dfcc0 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/close.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //close.js | 25 | //close.js |
28 | //close | 26 | //close |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/14/10 | 28 | //Created by Giulio Cesare Solaroli on 3/14/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js index 30c1c69..9c76865 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Tips/open.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | // | 24 | // |
27 | //open.js | 25 | //open.js |
28 | //open | 26 | //open |
29 | // | 27 | // |
30 | //Created by Giulio Cesare Solaroli on 3/14/10 | 28 | //Created by Giulio Cesare Solaroli on 3/14/10 |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js index b9d7adf..58b7593 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/BaseComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | var _Clipperz_PM_Components_base_id_ = 0; | 28 | var _Clipperz_PM_Components_base_id_ = 0; |
@@ -118,17 +116,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Compo | |||
118 | /* | 116 | /* |
119 | 'domHelperAppend': function(aValue) { | 117 | 'domHelperAppend': function(aValue) { |
120 | Clipperz.YUI.DomHelper.append(this.element().dom, aValue); | 118 | Clipperz.YUI.DomHelper.append(this.element().dom, aValue); |
121 | }, | 119 | }, |
122 | */ | 120 | */ |
123 | //------------------------------------------------------------------------- | 121 | //------------------------------------------------------------------------- |
124 | 122 | ||
125 | 'element': function() { | 123 | 'element': function() { |
126 | //MochiKit.Logging.logDebug(">>> BaseComponent.element"); | ||
127 | return MochiKit.DOM.getElement(this._element); | 124 | return MochiKit.DOM.getElement(this._element); |
128 | }, | 125 | }, |
129 | 126 | ||
130 | 'setElement': function(aNode) { | 127 | 'setElement': function(aNode) { |
131 | this._element = aNode; | 128 | this._element = aNode; |
132 | }, | 129 | }, |
133 | 130 | ||
134 | //----------------------------------------------------- | 131 | //----------------------------------------------------- |
@@ -308,21 +305,18 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.BaseComponent, /*Ext.Compo | |||
308 | if (domNode != null) { | 305 | if (domNode != null) { |
309 | aComponent.renderInNode(domNode); | 306 | aComponent.renderInNode(domNode); |
310 | } | 307 | } |
311 | }, | 308 | }, |
312 | 309 | ||
313 | //----------------------------------------------------- | 310 | //----------------------------------------------------- |
314 | /* | 311 | /* |
315 | 'purgeListeners': function() { | 312 | 'purgeListeners': function() { |
316 | //MochiKit.Logging.logDebug(">>> Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners [" + this + "]"); | ||
317 | //MochiKit.Logging.logDebug("--- " + this + ".purgeListeners"); | ||
318 | Clipperz.NotificationCenter.unregister(this); | 313 | Clipperz.NotificationCenter.unregister(this); |
319 | MochiKit.Signal.disconnectAllTo(this); | 314 | MochiKit.Signal.disconnectAllTo(this); |
320 | //MochiKit.Logging.logDebug("<<< Clipperz.PM.UI.Common.Components.BaseComponent.purgeListeners"); | ||
321 | }, | 315 | }, |
322 | */ | 316 | */ |
323 | //----------------------------------------------------- | 317 | //----------------------------------------------------- |
324 | 318 | ||
325 | 'clear': function() { | 319 | 'clear': function() { |
326 | varslotName; | 320 | varslotName; |
327 | var componentId; | 321 | var componentId; |
328 | 322 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js index 1010c9d..1268118 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Button.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.Button = function(args) { | 26 | Clipperz.PM.UI.Common.Components.Button = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js index 7f56c1e..2f82359 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ComponentSlot.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js index 2db2489..bf00ffc 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/FaviconComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.FaviconComponent = function(args) { | 26 | Clipperz.PM.UI.Common.Components.FaviconComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -72,17 +70,17 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.FaviconComponent, Clipperz | |||
72 | 70 | ||
73 | 'setDefaultFavicon': function (anEvent) { | 71 | 'setDefaultFavicon': function (anEvent) { |
74 | MochiKit.Signal.disconnectAll(anEvent.src()); | 72 | MochiKit.Signal.disconnectAll(anEvent.src()); |
75 | this.setSrc(null); | 73 | this.setSrc(null); |
76 | }, | 74 | }, |
77 | 75 | ||
78 | 'handleOnLoad': function (anEvent) { | 76 | 'handleOnLoad': function (anEvent) { |
79 | MochiKit.Signal.disconnectAll(anEvent.src()); | 77 | MochiKit.Signal.disconnectAll(anEvent.src()); |
80 | //console.log("HANDLE ON LOAD", anEvent, anEvent.src().src); | 78 | |
81 | if (anEvent.src().complete == false) { | 79 | if (anEvent.src().complete == false) { |
82 | this.setSrc(null); | 80 | this.setSrc(null); |
83 | } | 81 | } |
84 | }, | 82 | }, |
85 | 83 | ||
86 | //------------------------------------------------------------------------- | 84 | //------------------------------------------------------------------------- |
87 | __syntaxFix__: "syntax fix" | 85 | __syntaxFix__: "syntax fix" |
88 | }); | 86 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js index 2788b79..020290b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/MessagePanelWithProgressBar.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar = function(args) { | 26 | Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBar = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -126,36 +124,32 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.MessagePanelWithProgressBa | |||
126 | this.getElement('container').innerHTML = ''; | 124 | this.getElement('container').innerHTML = ''; |
127 | // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); | 125 | // this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); |
128 | this.setButtons(someParameters['buttons']); | 126 | this.setButtons(someParameters['buttons']); |
129 | }, | 127 | }, |
130 | 128 | ||
131 | //------------------------------------------------------------------------- | 129 | //------------------------------------------------------------------------- |
132 | 130 | ||
133 | 'closeOk': function () { | 131 | 'closeOk': function () { |
134 | //console.log("=== closeOk"); | ||
135 | this.showProgressBar(); | 132 | this.showProgressBar(); |
136 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback')); | 133 | MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback')); |
137 | this._deferred = null; | 134 | this._deferred = null; |
138 | }, | 135 | }, |
139 | 136 | ||
140 | 'closeCancel': function () { | 137 | 'closeCancel': function () { |
141 | //console.log("=== closeCancel"); | ||
142 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); | 138 | this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); |
143 | this.deferred().cancel(); | 139 | this.deferred().cancel(); |
144 | this._deferred = null; | 140 | this._deferred = null; |
145 | }, | 141 | }, |
146 | 142 | ||
147 | //------------------------------------------------------------------------- | 143 | //------------------------------------------------------------------------- |
148 | 144 | ||
149 | 'deferredDone': function () { | 145 | 'deferredDone': function () { |
150 | //console.log("=== deferredDone"); | ||
151 | return this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); | 146 | return this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); |
152 | }, | 147 | }, |
153 | 148 | ||
154 | 'deferredError': function (someParameters) { | 149 | 'deferredError': function (someParameters) { |
155 | //console.log("=== deferredError"); | ||
156 | this.showFailure(someParameters); | 150 | this.showFailure(someParameters); |
157 | }, | 151 | }, |
158 | 152 | ||
159 | //------------------------------------------------------------------------- | 153 | //------------------------------------------------------------------------- |
160 | __syntaxFix__: "syntax fix" | 154 | __syntaxFix__: "syntax fix" |
161 | }); | 155 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js index 089e3d4..78e8c9b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/PasswordEntropyDisplay.js | |||
@@ -1,46 +1,42 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { | 26 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay = function(anElement, args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | //MochiKit.Logging.logDebug(">>> new TextFormField"); | ||
32 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); | 29 | Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay.superclass.constructor.call(this, anElement, args); |
33 | 30 | ||
34 | this._wrapperElement = null; | 31 | this._wrapperElement = null; |
35 | this._entropyElement = null; | 32 | this._entropyElement = null; |
36 | 33 | ||
37 | this.render(); | 34 | this.render(); |
38 | //MochiKit.Logging.logDebug("<<< new TextFormField"); | ||
39 | 35 | ||
40 | return this; | 36 | return this; |
41 | }; | 37 | }; |
42 | 38 | ||
43 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { | 39 | Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Clipperz.PM.UI.Common.Components.BaseComponent, { |
44 | 40 | ||
45 | 'toString': function() { | 41 | 'toString': function() { |
46 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; | 42 | return "Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay"; |
@@ -105,27 +101,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.PasswordEntropyDisplay, Cl | |||
105 | 101 | ||
106 | 'computeEntropyForString': function(aValue) { | 102 | 'computeEntropyForString': function(aValue) { |
107 | return Clipperz.PM.Crypto.passwordEntropy(aValue); | 103 | return Clipperz.PM.Crypto.passwordEntropy(aValue); |
108 | }, | 104 | }, |
109 | 105 | ||
110 | //----------------------------------------------------- | 106 | //----------------------------------------------------- |
111 | 107 | ||
112 | 'updateEntropyElement': function(anEvent) { | 108 | 'updateEntropyElement': function(anEvent) { |
113 | /* | ||
114 | //MochiKit.Logging.logDebug(">>> PasswordEntropyDisplay.updateEntropyElement"); | ||
115 | varmaxExtent; | ||
116 | varentropy; | ||
117 | |||
118 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | ||
119 | //MochiKit.Logging.logDebug("--- PasswordEntropyDisplay.updateEntropyElement - entropy: " + entropy); | ||
120 | this.entropyElement().setStyle('background-position', "0px " + -entropy + "px"); | ||
121 | this.entropyElement().setWidth(this.passwordElement().getWidth() * (entropy/128)); | ||
122 | //MochiKit.Logging.logDebug("<<< PasswordEntropyDisplay.updateEntropyElement"); | ||
123 | */ | ||
124 | varentropy; | 109 | varentropy; |
125 | 110 | ||
126 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); | 111 | entropy = Math.min(128, this.computeEntropyForString(this.passwordElement().dom.value)); |
127 | 112 | ||
128 | if (entropy == 0) { | 113 | if (entropy == 0) { |
129 | this.entropyElement().setStyle('background-position', "0px 26px"); | 114 | this.entropyElement().setStyle('background-position', "0px 26px"); |
130 | } else { | 115 | } else { |
131 | this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px"); | 116 | this.entropyElement().setStyle('background-position', "0px -" + (128-entropy)*26 + "px"); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js index 5991530..6638008 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/ProgressBar.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.ProgressBar = function(args) { | 26 | Clipperz.PM.UI.Common.Components.ProgressBar = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js index 1d816a9..8c98811 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/SimpleMessagePanel.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { | 26 | Clipperz.PM.UI.Common.Components.SimpleMessagePanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -213,29 +211,25 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clippe | |||
213 | //------------------------------------------------------------------------- | 211 | //------------------------------------------------------------------------- |
214 | 212 | ||
215 | 'buttonEventHandler': function(aButton, anEvent) { | 213 | 'buttonEventHandler': function(aButton, anEvent) { |
216 | anEvent.preventDefault(); | 214 | anEvent.preventDefault(); |
217 | 215 | ||
218 | // MochiKit.Signal.signal(this, 'cancelEvent'); | 216 | // MochiKit.Signal.signal(this, 'cancelEvent'); |
219 | switch (aButton['result']) { | 217 | switch (aButton['result']) { |
220 | case 'OK': | 218 | case 'OK': |
221 | //console.log("==> OK"); | ||
222 | this.closeOk(); | 219 | this.closeOk(); |
223 | break; | 220 | break; |
224 | case 'CANCEL': | 221 | case 'CANCEL': |
225 | //console.log("==> CANCEL"); | ||
226 | this.closeCancel(); | 222 | this.closeCancel(); |
227 | break; | 223 | break; |
228 | default: | 224 | default: |
229 | //console.log("==> ????"); | ||
230 | this.closeError(); | 225 | this.closeError(); |
231 | break; | 226 | break; |
232 | } | 227 | } |
233 | //console.log("<=="); | ||
234 | }, | 228 | }, |
235 | 229 | ||
236 | //------------------------------------------------------------------------- | 230 | //------------------------------------------------------------------------- |
237 | 231 | ||
238 | 'deferredShow': function (someArgs, aResult) { | 232 | 'deferredShow': function (someArgs, aResult) { |
239 | this.deferredShowModal(someArgs); | 233 | this.deferredShowModal(someArgs); |
240 | 234 | ||
241 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); | 235 | this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); |
@@ -274,24 +268,20 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.SimpleMessagePanel, Clippe | |||
274 | MochiKit.Style.hideElement(this.getId('modalDialogFrame')); | 268 | MochiKit.Style.hideElement(this.getId('modalDialogFrame')); |
275 | }, | 269 | }, |
276 | 270 | ||
277 | //------------------------------------------------------------------------- | 271 | //------------------------------------------------------------------------- |
278 | 272 | ||
279 | 'keyDownHandler': function (anEvent) { | 273 | 'keyDownHandler': function (anEvent) { |
280 | if (anEvent.key().string == 'KEY_ENTER') { | 274 | if (anEvent.key().string == 'KEY_ENTER') { |
281 | anEvent.preventDefault(); | 275 | anEvent.preventDefault(); |
282 | //console.log("13 - RETURN ?", this); | ||
283 | this.closeOk(); | 276 | this.closeOk(); |
284 | //console.log('<<< 13') | ||
285 | } | 277 | } |
286 | 278 | ||
287 | if (anEvent.key().string == 'KEY_ESCAPE') { | 279 | if (anEvent.key().string == 'KEY_ESCAPE') { |
288 | anEvent.preventDefault(); | 280 | anEvent.preventDefault(); |
289 | //console.log("27 - ESC ?", this); | ||
290 | this.closeCancel(); | 281 | this.closeCancel(); |
291 | //console.log("<<< 27"); | ||
292 | } | 282 | } |
293 | }, | 283 | }, |
294 | 284 | ||
295 | //------------------------------------------------------------------------- | 285 | //------------------------------------------------------------------------- |
296 | __syntaxFix__: "syntax fix" | 286 | __syntaxFix__: "syntax fix" |
297 | }); | 287 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js index 936514a..1e2a690 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TabPanelComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.TabPanelComponent = function(args) { | 26 | Clipperz.PM.UI.Common.Components.TabPanelComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args); | 28 | Clipperz.PM.UI.Common.Components.TabPanelComponent.superclass.constructor.call(this, args); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js index 8df7e0e..6517d2a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.Tooltip = function(args) { | 26 | Clipperz.PM.UI.Common.Components.Tooltip = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -136,57 +134,50 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Co | |||
136 | var bodyPosition; | 134 | var bodyPosition; |
137 | 135 | ||
138 | if (this.isVisible() == false) { | 136 | if (this.isVisible() == false) { |
139 | arrowPosition = {}; | 137 | arrowPosition = {}; |
140 | bodyPosition = {}; | 138 | bodyPosition = {}; |
141 | 139 | ||
142 | this.setIsVisible(true); | 140 | this.setIsVisible(true); |
143 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); | 141 | elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); |
144 | //console.log("ELEMENT SIZE AND POSITION", Clipperz.Base.serializeJSON(elementSizeAndPosition)); | ||
145 | //console.log("BOX DIMENSIONS", Clipperz.Base.serializeJSON(this.boxDimensions())); | ||
146 | switch (this.position()) { | 142 | switch (this.position()) { |
147 | case 'ABOVE': | 143 | case 'ABOVE': |
148 | //console.log("ABOVE"); | ||
149 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 144 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
150 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 145 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
151 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; | 146 | bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; |
152 | 147 | ||
153 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 148 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
154 | // arrowPosition.y = elementSizeAndPosition.position.y - 13; | 149 | // arrowPosition.y = elementSizeAndPosition.position.y - 13; |
155 | break; | 150 | break; |
156 | case 'BELOW': | 151 | case 'BELOW': |
157 | //console.log("BELOW"); | ||
158 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); | 152 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); |
159 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); | 153 | bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); |
160 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; | 154 | bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; |
161 | 155 | ||
162 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); | 156 | // arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); |
163 | // arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; | 157 | // arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; |
164 | break; | 158 | break; |
165 | case 'LEFT': | 159 | case 'LEFT': |
166 | //console.log("LEFT"); | ||
167 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 160 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
168 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; | 161 | bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; |
169 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | 162 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); |
170 | 163 | ||
171 | // arrowPosition.x = elementSizeAndPosition.position.x -13; | 164 | // arrowPosition.x = elementSizeAndPosition.position.x -13; |
172 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | 165 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); |
173 | break; | 166 | break; |
174 | case 'RIGHT': | 167 | case 'RIGHT': |
175 | //console.log("RIGHT"); | ||
176 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); | 168 | // MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); |
177 | bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; | 169 | bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; |
178 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); | 170 | bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); |
179 | 171 | ||
180 | // arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; | 172 | // arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; |
181 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); | 173 | // arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); |
182 | break; | 174 | break; |
183 | } | 175 | } |
184 | //console.log("X: " + bodyPosition.x + ", Y: " + bodyPosition.y); | ||
185 | 176 | ||
186 | MochiKit.Style.setElementPosition(this.getId('tooltip'), bodyPosition); | 177 | MochiKit.Style.setElementPosition(this.getId('tooltip'), bodyPosition); |
187 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); | 178 | // MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); |
188 | // MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); | 179 | // MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); |
189 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); | 180 | MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); |
190 | } | 181 | } |
191 | }, | 182 | }, |
192 | 183 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js index c41fc7c..ba58edd 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/TranslatorWidget.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) { | 26 | Clipperz.PM.UI.Common.Components.TranslatorWidget = function(args) { |
29 | Clipperz.log(">>> TranslatorWidget.new"); | 27 | Clipperz.log(">>> TranslatorWidget.new"); |
30 | args = args || {}; | 28 | args = args || {}; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js index 5fd10f9..77d59a5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/DirectLoginRunner.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner = function(args) { |
29 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); | 27 | this._directLogin = args['directLogin'] || Clipperz.Base.exception.raise('MandatoryParameter'); |
30 | this._target = Clipperz.PM.Crypto.randomKey(); | 28 | this._target = Clipperz.PM.Crypto.randomKey(); |
@@ -149,17 +147,16 @@ MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototy | |||
149 | }, | 147 | }, |
150 | 148 | ||
151 | //------------------------------------------------------------------------- | 149 | //------------------------------------------------------------------------- |
152 | 150 | ||
153 | 'runHttpAuthDirectLogin': function(aWindow, someAttributes) { | 151 | 'runHttpAuthDirectLogin': function(aWindow, someAttributes) { |
154 | var completeUrl; | 152 | var completeUrl; |
155 | var url; | 153 | var url; |
156 | 154 | ||
157 | //console.log("runHttpAuthDirectLogin", someAttributes); | ||
158 | url = someAttributes['inputValues']['url']; | 155 | url = someAttributes['inputValues']['url']; |
159 | 156 | ||
160 | if (/^https?\:\/\//.test(url) == false) { | 157 | if (/^https?\:\/\//.test(url) == false) { |
161 | url = 'http://' + url; | 158 | url = 'http://' + url; |
162 | } | 159 | } |
163 | 160 | ||
164 | if (Clipperz_IEisBroken === true) { | 161 | if (Clipperz_IEisBroken === true) { |
165 | completeUrl = url; | 162 | completeUrl = url; |
@@ -177,44 +174,40 @@ MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.prototy | |||
177 | window.open(completeUrl, this.target()); | 174 | window.open(completeUrl, this.target()); |
178 | }, | 175 | }, |
179 | 176 | ||
180 | //============================================================================= | 177 | //============================================================================= |
181 | 178 | ||
182 | 'runDirectLogin': function (aWindow) { | 179 | 'runDirectLogin': function (aWindow) { |
183 | var deferredResult; | 180 | var deferredResult; |
184 | 181 | ||
185 | //console.log(">>> runDirectLogin"); | ||
186 | deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false}); | 182 | deferredResult = new Clipperz.Async.Deferred("DirectLoginRunner.openDirectLogin", {trace:false}); |
187 | deferredResult.addMethod(this, 'initialWindowSetup', aWindow); | 183 | deferredResult.addMethod(this, 'initialWindowSetup', aWindow); |
188 | deferredResult.addMethod(this.directLogin(), 'label'); | 184 | deferredResult.addMethod(this.directLogin(), 'label'); |
189 | deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow); | 185 | deferredResult.addMethod(this, 'updateWindowWithDirectLoginLabel', aWindow); |
190 | deferredResult.collectResults({ | 186 | deferredResult.collectResults({ |
191 | 'type': MochiKit.Base.method(this.directLogin(), 'type'), | 187 | 'type': MochiKit.Base.method(this.directLogin(), 'type'), |
192 | 'label': MochiKit.Base.method(this.directLogin(), 'label'), | 188 | 'label': MochiKit.Base.method(this.directLogin(), 'label'), |
193 | 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'), | 189 | 'formAttributes':MochiKit.Base.method(this.directLogin(), 'formAttributes'), |
194 | 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues') | 190 | 'inputValues': MochiKit.Base.method(this.directLogin(), 'inputValues') |
195 | }); | 191 | }); |
196 | //deferredResult.addCallback(function (aValue) { console.log("SOME ATTRIBUTES", aValue); return aValue; }); | ||
197 | deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) { | 192 | deferredResult.addCallback(MochiKit.Base.bind(function (someAttributes) { |
198 | //console.log("SOME ATTRIBUTES", someAttributes); | ||
199 | switch (someAttributes['type']) { | 193 | switch (someAttributes['type']) { |
200 | case 'http_auth': | 194 | case 'http_auth': |
201 | this.runHttpAuthDirectLogin(aWindow, someAttributes); | 195 | this.runHttpAuthDirectLogin(aWindow, someAttributes); |
202 | break; | 196 | break; |
203 | case 'simple_url': | 197 | case 'simple_url': |
204 | this.runSimpleUrlDirectLogin(aWindow, someAttributes); | 198 | this.runSimpleUrlDirectLogin(aWindow, someAttributes); |
205 | break; | 199 | break; |
206 | default: | 200 | default: |
207 | this.runSubmitFormDirectLogin(aWindow, someAttributes); | 201 | this.runSubmitFormDirectLogin(aWindow, someAttributes); |
208 | break; | 202 | break; |
209 | } | 203 | } |
210 | }, this)); | 204 | }, this)); |
211 | deferredResult.callback(); | 205 | deferredResult.callback(); |
212 | //console.log("<<< runDirectLogin"); | ||
213 | 206 | ||
214 | return deferredResult; | 207 | return deferredResult; |
215 | }, | 208 | }, |
216 | 209 | ||
217 | //============================================================================= | 210 | //============================================================================= |
218 | 211 | ||
219 | 'run': function () { | 212 | 'run': function () { |
220 | var newWindow; | 213 | var newWindow; |
@@ -251,14 +244,13 @@ Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin = function ( | |||
251 | return runner.run(); | 244 | return runner.run(); |
252 | }; | 245 | }; |
253 | 246 | ||
254 | //----------------------------------------------------------------------------- | 247 | //----------------------------------------------------------------------------- |
255 | 248 | ||
256 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) { | 249 | Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.testDirectLogin = function (aDirectLogin) { |
257 | varrunner; | 250 | varrunner; |
258 | 251 | ||
259 | //console.log(">>>>>> TESTING DIRECT LOGIN"); | ||
260 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); | 252 | runner = new Clipperz.PM.UI.Common.Controllers.DirectLoginRunner({directLogin:aDirectLogin}); |
261 | return runner.test(); | 253 | return runner.test(); |
262 | }; | 254 | }; |
263 | 255 | ||
264 | //----------------------------------------------------------------------------- | 256 | //----------------------------------------------------------------------------- |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js index 41fe17f..52d81d4 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/ProgressBarController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.ProgressBarController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js index 341fde9..d3e86de 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { | 26 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js index ef38bc6..c13d96a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/WizardController.js | |||
@@ -1,28 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | //Still empty, but here it should be reasonable to factor in code duplicated between | 24 | //Still empty, but here it should be reasonable to factor in code duplicated between |
27 | //- DirectLoginWizardController | 25 | //- DirectLoginWizardController |
28 | //- NewUserWizardController \ No newline at end of file | 26 | //- NewUserWizardController \ No newline at end of file |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js index ea987cd..f0ccdfb 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Compact/MainController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Compact'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Compact'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Compact.MainController = function() { | 26 | Clipperz.PM.UI.Compact.MainController = function() { |
29 | //this._loginPanel = null; | 27 | //this._loginPanel = null; |
30 | //this._user = null; | 28 | //this._user = null; |
@@ -43,14 +41,14 @@ MochiKit.Base.update(Clipperz.PM.UI.Compact.MainController.prototype, { | |||
43 | 41 | ||
44 | 'toString': function() { | 42 | 'toString': function() { |
45 | return "Clipperz.PM.UI.Compact.MainController"; | 43 | return "Clipperz.PM.UI.Compact.MainController"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //----------------------------------------------------------------------------- | 46 | //----------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'run': function(shouldShowRegistrationForm) { | 48 | 'run': function(shouldShowRegistrationForm) { |
51 | MochiKit.Logging.logDebug("running " + this.toString()); | 49 | Clipperz.logDebug("running " + this.toString()); |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //----------------------------------------------------------------------------- | 52 | //----------------------------------------------------------------------------- |
55 | __syntaxFix__: "syntax fix" | 53 | __syntaxFix__: "syntax fix" |
56 | }); \ No newline at end of file | 54 | }); \ No newline at end of file |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js index 32dfa63..abf4758 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -53,17 +51,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI | |||
53 | 51 | ||
54 | 'setCardReference': function (aValue) { | 52 | 'setCardReference': function (aValue) { |
55 | this._cardReference = aValue; | 53 | this._cardReference = aValue; |
56 | }, | 54 | }, |
57 | */ | 55 | */ |
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'renderSelf': function () { | 58 | 'renderSelf': function () { |
61 | console.log("CardDetail.renderSelf"); | ||
62 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ | 59 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ |
63 | {tag:'div', cls:'toolbar', children:[ | 60 | {tag:'div', cls:'toolbar', children:[ |
64 | {tag:'a', href:'#', cls:'back', html:"List"}, | 61 | {tag:'a', href:'#', cls:'back', html:"List"}, |
65 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} | 62 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} |
66 | ]}, | 63 | ]}, |
67 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ | 64 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ |
68 | ]} | 65 | ]} |
69 | ]}); | 66 | ]}); |
@@ -150,27 +147,25 @@ console.log("CardDetail.renderSelf"); | |||
150 | 147 | ||
151 | 'addDirectLogin': function (aDirectLogin) { | 148 | 'addDirectLogin': function (aDirectLogin) { |
152 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ | 149 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ |
153 | {tag:'a', href:'#', html:"direct login", children:[ | 150 | {tag:'a', href:'#', html:"direct login", children:[ |
154 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} | 151 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} |
155 | ]} | 152 | ]} |
156 | ]}) | 153 | ]}) |
157 | 154 | ||
158 | console.log("ADD DIRECT LOGIN", aDirectLogin); | ||
159 | }, | 155 | }, |
160 | 156 | ||
161 | //========================================================================= | 157 | //========================================================================= |
162 | 158 | ||
163 | 'showCard': function (aCard) { | 159 | 'showCard': function (aCard) { |
164 | var deferredResult; | 160 | var deferredResult; |
165 | 161 | ||
166 | // this.render(); | 162 | // this.render(); |
167 | 163 | ||
168 | console.log("CardDetail.showCard", aCard); | ||
169 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); | 164 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); |
170 | deferredResult.addMethod(aCard, 'label'); | 165 | deferredResult.addMethod(aCard, 'label'); |
171 | deferredResult.addMethod(this, 'setTitle'); | 166 | deferredResult.addMethod(this, 'setTitle'); |
172 | 167 | ||
173 | deferredResult.addMethod(aCard, 'fields'); | 168 | deferredResult.addMethod(aCard, 'fields'); |
174 | deferredResult.addCallback(MochiKit.Base.values); | 169 | deferredResult.addCallback(MochiKit.Base.values); |
175 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); | 170 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); |
176 | 171 | ||
@@ -261,17 +256,16 @@ console.log("CardDetail.showCard", aCard); | |||
261 | }, | 256 | }, |
262 | 257 | ||
263 | //------------------------------------------------------------------------- | 258 | //------------------------------------------------------------------------- |
264 | /* | 259 | /* |
265 | 'toggleClickHandler': function (anEvent) { | 260 | 'toggleClickHandler': function (anEvent) { |
266 | varnextState; | 261 | varnextState; |
267 | varfieldValue; | 262 | varfieldValue; |
268 | 263 | ||
269 | //console.log("TOGGLE"); | ||
270 | anEvent.preventDefault; | 264 | anEvent.preventDefault; |
271 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; | 265 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; |
272 | 266 | ||
273 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); | 267 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); |
274 | if (nextState) { | 268 | if (nextState) { |
275 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); | 269 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); |
276 | } else { | 270 | } else { |
277 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); | 271 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js index a4aa212..a0e4879 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.CardList = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.CardList = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -85,29 +83,27 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.C | |||
85 | cardInfo = { | 83 | cardInfo = { |
86 | '_rowObject': MochiKit.Async.succeed, | 84 | '_rowObject': MochiKit.Async.succeed, |
87 | '_reference': MochiKit.Base.methodcaller('reference'), | 85 | '_reference': MochiKit.Base.methodcaller('reference'), |
88 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), | 86 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), |
89 | 'label': MochiKit.Base.methodcaller('label'), | 87 | 'label': MochiKit.Base.methodcaller('label'), |
90 | 'favicon': MochiKit.Base.methodcaller('favicon') | 88 | 'favicon': MochiKit.Base.methodcaller('favicon') |
91 | }; | 89 | }; |
92 | 90 | ||
93 | //console.log("someCards", someCards); | ||
94 | deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); | 91 | deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); |
95 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); | 92 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); |
96 | deferredResult.addCallback(Clipperz.Async.collectAll); | 93 | deferredResult.addCallback(Clipperz.Async.collectAll); |
97 | deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); | 94 | deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); |
98 | deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); | 95 | deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); |
99 | // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); | 96 | // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); |
100 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); | 97 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); |
101 | deferredResult.callback(someCards); | 98 | deferredResult.callback(someCards); |
102 | }, | 99 | }, |
103 | 100 | ||
104 | 'appendCardToList': function (aCardListElement, aCardInfo) { | 101 | 'appendCardToList': function (aCardListElement, aCardInfo) { |
105 | //console.log("appendCardToList", aCardInfo); | ||
106 | this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ | 102 | this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ |
107 | {tag:'a', href:'#', html:aCardInfo['label'], children:[ | 103 | {tag:'a', href:'#', html:aCardInfo['label'], children:[ |
108 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} | 104 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} |
109 | ]} | 105 | ]} |
110 | ]}); | 106 | ]}); |
111 | }, | 107 | }, |
112 | 108 | ||
113 | 'cardSelectionHandler': function (anEvent) { | 109 | 'cardSelectionHandler': function (anEvent) { |
@@ -116,17 +112,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.C | |||
116 | 112 | ||
117 | anEvent.preventDefault(); | 113 | anEvent.preventDefault(); |
118 | 114 | ||
119 | listElement = anEvent.target(); | 115 | listElement = anEvent.target(); |
120 | if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { | 116 | if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { |
121 | listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); | 117 | listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); |
122 | } | 118 | } |
123 | cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); | 119 | cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); |
124 | console.log("###", listElement, cardReference); | ||
125 | //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected | 120 | //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected |
126 | MochiKit.Signal.signal(this, 'selectedCard', cardReference); | 121 | MochiKit.Signal.signal(this, 'selectedCard', cardReference); |
127 | }, | 122 | }, |
128 | 123 | ||
129 | //------------------------------------------------------------------------- | 124 | //------------------------------------------------------------------------- |
130 | /* | 125 | /* |
131 | 'searchHandler': function (anEvent) { | 126 | 'searchHandler': function (anEvent) { |
132 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN | 127 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN |
@@ -166,17 +161,16 @@ console.log("###", listElement, cardReference); | |||
166 | 161 | ||
167 | 'cardListClickHandler': function (anEvent) { | 162 | 'cardListClickHandler': function (anEvent) { |
168 | anEvent.preventDefault(); | 163 | anEvent.preventDefault(); |
169 | 164 | ||
170 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { | 165 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { |
171 | var cardListReference; | 166 | var cardListReference; |
172 | 167 | ||
173 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; | 168 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; |
174 | //console.log("Showing detail for card named", cardListReference); | ||
175 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); | 169 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); |
176 | } | 170 | } |
177 | }, | 171 | }, |
178 | 172 | ||
179 | //========================================================================= | 173 | //========================================================================= |
180 | 174 | ||
181 | 'cardDetail': function (someData) { | 175 | 'cardDetail': function (someData) { |
182 | if (this._cardDetail == null) { | 176 | if (this._cardDetail == null) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js index eafcdbc..3aeac0c 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -134,17 +132,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI. | |||
134 | //------------------------------------------------------------------------- | 132 | //------------------------------------------------------------------------- |
135 | 133 | ||
136 | 'setCallbacks': function (args) { | 134 | 'setCallbacks': function (args) { |
137 | this._callback = args['callback']; | 135 | this._callback = args['callback']; |
138 | this._errorCallback = args['errorCallback']; | 136 | this._errorCallback = args['errorCallback']; |
139 | }, | 137 | }, |
140 | 138 | ||
141 | 'showErrors': function (args) { | 139 | 'showErrors': function (args) { |
142 | //console.log("LoginForm.showErrors", args); | ||
143 | if (args['previousFailedAttempt'] == 'LOGIN') { | 140 | if (args['previousFailedAttempt'] == 'LOGIN') { |
144 | this.setErrorMessage("Wrong credentials"); | 141 | this.setErrorMessage("Wrong credentials"); |
145 | } else if (args['previousFailedAttempt'] == 'PIN') { | 142 | } else if (args['previousFailedAttempt'] == 'PIN') { |
146 | if (args['failedAttempts'] == -1) { | 143 | if (args['failedAttempts'] == -1) { |
147 | this.setErrorMessage("Wrong PIN - Resetted"); | 144 | this.setErrorMessage("Wrong PIN - Resetted"); |
148 | } else { | 145 | } else { |
149 | this.setErrorMessage("Wrong PIN"); | 146 | this.setErrorMessage("Wrong PIN"); |
150 | } | 147 | } |
@@ -294,17 +291,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI. | |||
294 | // $(this.getAnchor('PIN')).blur(); | 291 | // $(this.getAnchor('PIN')).blur(); |
295 | this.getElement('PIN').blur(); | 292 | this.getElement('PIN').blur(); |
296 | 293 | ||
297 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); | 294 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); |
298 | this.loginWithCredentials(credentials); | 295 | this.loginWithCredentials(credentials); |
299 | }, | 296 | }, |
300 | 297 | ||
301 | 'submitCredentialsHandler': function (anEvent) { | 298 | 'submitCredentialsHandler': function (anEvent) { |
302 | //console.log("submitCredentialsHandler"); | ||
303 | varcredentials; | 299 | varcredentials; |
304 | 300 | ||
305 | this.setMessage(null); | 301 | this.setMessage(null); |
306 | 302 | ||
307 | credentials = {}; | 303 | credentials = {}; |
308 | credentials['username'] = this.getElement('usernameField').value; | 304 | credentials['username'] = this.getElement('usernameField').value; |
309 | credentials['passphrase'] = this.getElement('passphraseField').value; | 305 | credentials['passphrase'] = this.getElement('passphraseField').value; |
310 | // $(this.getAnchor('passphraseField')).blur(); | 306 | // $(this.getAnchor('passphraseField')).blur(); |
@@ -326,31 +322,26 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI. | |||
326 | MochiKit.Style.showElement(this.getElement('validating')); | 322 | MochiKit.Style.showElement(this.getElement('validating')); |
327 | 323 | ||
328 | MochiKit.Async.callLater(0.1, this.callback(), args); | 324 | MochiKit.Async.callLater(0.1, this.callback(), args); |
329 | }, | 325 | }, |
330 | 326 | ||
331 | //------------------------------------------------------------------------- | 327 | //------------------------------------------------------------------------- |
332 | 328 | ||
333 | 'initProgressHandle': function (anEvent) { | 329 | 'initProgressHandle': function (anEvent) { |
334 | //console.log("** initProgressHandle", anEvent); | ||
335 | this._steps = anEvent['steps']; | 330 | this._steps = anEvent['steps']; |
336 | this._actualSteps = 0; | 331 | this._actualSteps = 0; |
337 | }, | 332 | }, |
338 | 333 | ||
339 | 'updateProgressHandle': function (anEvent) { | 334 | 'updateProgressHandle': function (anEvent) { |
340 | //console.log("** updateProgressHandle", anEvent); | ||
341 | this._steps += anEvent['extraSteps']; | 335 | this._steps += anEvent['extraSteps']; |
342 | }, | 336 | }, |
343 | 337 | ||
344 | 'advanceProgressHandle': function (anEvent) { | 338 | 'advanceProgressHandle': function (anEvent) { |
345 | //console.log("** advanceProgressHandle", anEvent); | ||
346 | this._actualSteps ++; | 339 | this._actualSteps ++; |
347 | //console.log("STEPS: " + this._actualSteps + "/" + this._steps); | ||
348 | }, | 340 | }, |
349 | 341 | ||
350 | 'progressDoneHandle': function (anEvent) { | 342 | 'progressDoneHandle': function (anEvent) { |
351 | //console.log("** progressDoneHandle", anEvent); | ||
352 | }, | 343 | }, |
353 | 344 | ||
354 | //------------------------------------------------------------------------- | 345 | //------------------------------------------------------------------------- |
355 | __syntaxFix__: "syntax fix" | 346 | __syntaxFix__: "syntax fix" |
356 | }); | 347 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js index 12a61f7..9951f44 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js | |||
@@ -1,37 +1,35 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Controllers.MainController = function() { | 26 | Clipperz.PM.UI.Mobile.Controllers.MainController = function() { |
29 | this._jQTouch = null; | 27 | // this._jQTouch = null; |
30 | this._user = null; | 28 | this._user = null; |
31 | this._proxy = null; | 29 | this._proxy = null; |
32 | this._loginForm = null; | 30 | this._loginForm = null; |
33 | this._cardList = null; | 31 | this._cardList = null; |
34 | this._cardDetail= null; | 32 | this._cardDetail= null; |
35 | 33 | ||
36 | return this; | 34 | return this; |
37 | } | 35 | } |
@@ -48,47 +46,45 @@ MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, | |||
48 | return this._user; | 46 | return this._user; |
49 | }, | 47 | }, |
50 | 48 | ||
51 | 'setUser': function (aValue) { | 49 | 'setUser': function (aValue) { |
52 | this._user = aValue; | 50 | this._user = aValue; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
56 | 54 | /* | |
57 | 'jQTouch': function () { | 55 | 'jQTouch': function () { |
58 | return this._jQTouch; | 56 | return this._jQTouch; |
59 | }, | 57 | }, |
60 | 58 | ||
61 | 'setJQTouch': function (aValue) { | 59 | 'setJQTouch': function (aValue) { |
62 | this._jQTouch = aValue; | 60 | this._jQTouch = aValue; |
63 | }, | 61 | }, |
64 | 62 | */ | |
65 | //========================================================================= | 63 | //========================================================================= |
66 | 64 | ||
67 | 'run': function () { | 65 | 'run': function () { |
68 | console.log("MainController.run"); | ||
69 | |||
70 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin')); | 66 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin')); |
71 | Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[ | 67 | Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[ |
72 | {tag:'div', id:'loginForm'}, | 68 | {tag:'div', id:'loginForm'}, |
73 | {tag:'div', id:'cardList'}, | 69 | {tag:'div', id:'cardList'}, |
74 | {tag:'div', id:'cardDetail'}, | 70 | {tag:'div', id:'cardDetail'}, |
75 | {tag:'div', id:'preferences'} | 71 | {tag:'div', id:'preferences'} |
76 | ]}); | 72 | ]}); |
77 | 73 | ||
78 | this.showLoginForm(); | 74 | this.showLoginForm(); |
79 | 75 | ||
80 | this.initjQTouch(); | 76 | // this.initjQTouch(); |
81 | 77 | ||
82 | 78 | ||
83 | // this.showAddToHomeScreenBaloon(); | 79 | // this.showAddToHomeScreenBaloon(); |
84 | // this.selectInitialProxy(); | 80 | // this.selectInitialProxy(); |
85 | }, | 81 | }, |
86 | 82 | /* | |
87 | 'initjQTouch': function () { | 83 | 'initjQTouch': function () { |
88 | var jqt; | 84 | var jqt; |
89 | 85 | ||
90 | jqt = new $.jQTouch({ | 86 | jqt = new $.jQTouch({ |
91 | icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19HvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAzzHIK1I08t6hq6zHpRdu2aYdJYuk9Q/881bzZa8Xrx6fLmJo/iu4/VXnfH1BB/rmu5ScQvI77m+BkmfxXxvcZcJY14L0DymZp7pML5yTcW61PvIN6JuGr4halQvmjNlCa4bXJ5zj6qhpxrujeKPYMXEd+q00KR5yNAlWZzrF+Ie+uNsdC/MO4tTOZafhbroyXuR3Df08bLiHsQf+ja6gTPWVimZl7l/oUrjl8OcxDWLbNU5D6JRL2gxkDu16fGuC054OMhclsyXTOOFEL+kmMGs4i5kfNuQ62EnBuam8tzP+Q+tSqhz9SuqpZlvR1EfBiOJTSgYMMM7jpYsAEyqJCHDL4dcFFTAwNMlFDUUpQYiadhDmXteeWAw3HEmA2s15k1RmnP4RHuhBybdBOF7MfnICmSQ2SYjIBM3iRvkcMki9IRcnDTthyLz2Ld2fTzPjTQK+Mdg8y5nkZfFO+se9LQr3/09xZr+5GcaSufeAfAww60mAPx+q8u/bAr8rFCLrx7s+vqEkw8qb+p26n11Aruq6m1iJH6PbWGv1VIY25mkNE8PkaQhxfLIF7DZXx80HD/A3l2jLclYs061xNpWCfoB6WHJTjbH0mV35Q/lRXlC+W8cndbl9t2SfhU+Fb4UfhO+F74GWThknBZ+Em4InwjXIyd1ePnY/Psg3pb1TJNu15TMKWMtFt6ScpKL0ivSMXIn9QtDUlj0h7U7N48t3i8eC0GnMC91dX2sTivgloDTgUVeEGHLTizbf5Da9JLhkhh29QOs1luMcScmBXTIIt7xRFxSBxnuJWfuAd1I7jntkyd/pgKaIwVr3MgmDo2q8x6IdB5QH162mcX7ajtnHGN2bov71OU1+U0fqqoXLD0wX5ZM005UHmySz3qLtDqILDvIL+iH6jB9y2x83ok898GOPQX3lk3Itl0A+BrD6D7tUjWh3fis58BXDigN9yF8M5PJH4B8Gr79/F/XRm8m241mw/wvur4BGDj42bzn+Vmc+NL9L8GcMn8F1kAcXjEKMJAAAAACXBIWXMAAAsTAAALEwEAmpwYAAABbmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNC40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgogICAgICAgICA8ZGM6c3ViamVjdD4KICAgICAgICAgICAgPHJkZjpCYWcvPgogICAgICAgICA8L2RjOnN1YmplY3Q+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrlPw1BAAAd7klEQVR4nO19eZQV13nn797a3tr7yg5ikxCIHRohkACBEFqsJY4z8T52nPHYPp74JJ54bMfOsRMf2Z44OZ7EJ16iDLIsS5ZlydJY+2Ii1haiAQFCNGvTNHS/9/pt9Wq93/xRb+9u6OU1wif9O3Wq6223bv3qu7/vu9+9txqYwAQmMIEJTGACE5jABCbwnxTs/a4AHnjggY0bNwohxl4U5/xnP/tZe3v72Iv6g8fDDz9MlcOHP/zh9/uCAEB+vysA27YBkHAh7KK3aSRlMIDAFcZl13UrW73R4f2nNQvXYGYMjANUROkVyWXZvbBIDcLXOH4VHBGuGVoBgAMMYGAAERhAeekfyC8r+svA3n8nUYxrilYXxAFkScz6sKENlgHkfc5AYmSyMc64dmglEOW4pOyOUSlZxS9Y4RVjIHeEcjy+uGZoJYBErmlTdk/5V0NQxnLkUgXiswrimqEVAIkcTQU685+BioJsyikAkDXbCVqHABWslcpopcJfopIuTIFZMSECQ0GAWBGJA2j13mQspw8MeRumayJczeNaorVMW7MxVqkUgIEox6Yo7CdEYAhQji+UuKxyWgcFA0SWWbompODaoRUD7K40Hri8dJIgIVjRt99fXEu0FhNKpWabbfulYJTthjGAXLqW5PVapRUYwGyuj1AcGGTBQAJiQgQGotDFQkFkBwkGcpZbiAK8nqsgEsC10te6FmglAESCeZFAltPiMGvQSAtALhYAsrSSmLDWLIg8Wt0iQgdoa7nXKupm5TuvwgW5NEFrFp6kilyEVGAWGERSvT0rsWgwkEtZeZ2g1YNnX1llRIHNYlq9Dy6Tc4EgciHcPzwRuP/++9Pp9KuvvuoNk1QKRAQIKjBSrABFx9l2P2jvgIFcCAFyxyNunTVj2h/dt82nad/8zg+G+ZPh0ur3+7/70HdnXTdrz54927dvf+qpp7q7u0dbzxJkaaVSESjYbFHbz3NKJSksIOuySFTSZQX8/lvWrPjQg3dvWr92UktTV/eFH/30kYu9fcP57XBpXbOmbebMGURi1apVq1at+upX/9czTz+9/ZGf79q1a8yjciKrjCgKPEvcF8o7tRggBiRIuCQqE2DNnjXjvrs2P3jvHTfMn6sosmmayWSiqaF2w/q2X/zqt8MpYbi0Pvjgg4xzYaXgpIhrLY31f/aZP//EJz6+e/fu7du3P/3Ms5cuXRrlRQjynHhRp55KDgbpdJUIQDbf6hnsGKw1FAysu3nlnzxw94Z1bfX1dY5tO44BV6gwDVcmId+7dWMlaa2urr5j8+0kXLgW4yoTJukpwSQu+2+5Ze0t69Z9/aunnvnts9t//os9e/aO/MIIwi2JBMqZ9YS1zGXlDgRlIwHhQjijE4F5c2Y9eM8dH7hr8/Vzr+MSt03TTPerkutTuCSrINW2kpaptK1YNG3KpLNdV1a/YdG6fv26GTNnuJbByQWTwRQmSZKwyYoLMya4Nqml4bOf+++f/PhHd+7c9cijjz373O96+4alQQCIBIQrhFuqrQNsVgwwWO/TbEfLJRJCjEyOqsKhDevaPnT/tnVrVtbVVlu27ZhpmVl+iWRNYpIMcIDAFZU5KcdsrK3efNuan2z/1RVLHhatD95/Hxgn12CMgbw0vgBjjKuMXC4M0pOOLklycMNt6zZsuPXUyZO/efq3jz72RPv+t69culegtxXKH0DrQB3wDgi5/quLgt+7AhbMn/PgvVvu2bpp7uyZnDPbNKx0ROW2ooBzCVwCGIQAIxCBQ1EVltZdV7l787qfPvLkFVvklWltbGzccNt6YWUYOeBK9pqLXQqXGeOycMiOuWZEcN/USY3/44uf+/QnP/YfO3c98ugvf/fiy9FobKjyCUTCpWy/s6jkkoNSqS3skR0vIEFCkHAvf7011VWb1q/54/vvXLt6WU11tW2ZrpngyAS5KyscXAI4iCBcMMpOWgBBEJd9CqKm6Vu2aP6cWdOOd54ZK60bb1s/eXKrldEVr7kVsZGj2LMRxrgqMUcSGaEnbV1SpNDmjetu33jric7Op37z7GNP/Lrj0DuD8SqyXU+IrHqW8VvSNSjrdCH7KYmsvA4RCSxaMO/Be7bcs3XDdTOnc8ZsM+2kuzVmKpwYl8A4gKx5gmXbfvYAAIFLqkyGaVZXBbfc2lYBWh+47wMggrCYoiBvU0DBlLIXKbLHTOIS4+SQExHxXof5Zk5p/PKXPv+ZT33s9zvefPTxJ198+fX+eKLAKuWttcxlDTDYEmXIcQoAjMj1rLXMZdXX1tx+25oPfmDrmpVLqsJh28oIIyKTHuK2JDEwzzxF1iVmzbOYU++MHIIpisYyumPL226/+V8efsK5bFh5BVqnTpmybm2bbegcAkzKznIgKr0wkXtHZAc/iAAwLktMSCIjMklHl/xSeNuWW7du3nj8vfd+/fRzv3zymSPHjgPw4k0ityhuHZTZPK2D9LgYuQRBJNyc11qy6Po/uueOu7asnzl9GgM5ZkKkzviZoXABzzwJIBdMADyXEfemKnnH3mwwBpY9KVc0hSVM01w0f9YN82YdPPLe6GndvOm2pqYGQ0+qipQjseiCy7qSVEqHRzTjXFI4OYrb5yZ6BfPNmd70lb/8/H/79Eff2LHz4UceD/h9wnUgRDmVA5kt7hqIXMo1a7ACwhWO01BX88cf2PpfHty2avnicDDgWDrpFxSk/MzmHGBSzr95I7gsSxwxMAbGQBxEYLl9Yd4CgUk+hWUyZtAf2Lph9eVpvdyMMMbYs089dsfmjbaR0nwhICthOZPMbdmXOUdMBLjZg8KnORUWthC2Q7LLw5K/1rJhGBlVVbmTCIme3J27jPvK39ocoV7YKpwENTtyfSaTqQqHOBPCjMsirrGMxAisaNJc9oCVHGT3vGjPAF7yDpfITvdG01wJH363c+uffskwraGou5y1zr5u1uoVSy0jI3MGzpF3CESFrcRsaWhNyHk2xjlXVHIh+pxkrwyfxqtclzMigmBe4UPSivLj3I6RICJBIqQJnjmnIqkwh/Gcz/ES5IUpiGzAxnPdNZ4z5LywMoDAOASYrGk8plvW/FlTFi+YvXv/kdHQeueWjbU11YaelNRAzsGW+qtyTUCRBytuy6LoHuQsl0myRDLpqptwhOxCAs9rqyj9eZk4oLQO3idCdmM+iqtM53nz9NpNfg4s5ayVsQK/xLPBMssJQj6uyjLLCxVgkk9T0knDFwjcuWHVaGiVJeneu7Y4tsVATFJzjRrZRsGkrBV4zV84gAPk55rJhebPvD6lneUUZVwzzmWVuSCzkJwelNlifoGi9gGAGEOIp4rUMN8pYIWDPJtULAI5YSWWlVTPeIlyFFPhJUHVfFKy3zLljWsWPxTwp/TMyGi94fp5S2+60TIzmqqAK1lCyYGdgHEJ+jlkeqB3I9MFMwonBWHBixaYDK5BqYIShlYPtR5qPbQGyAFwDRAQTqny5oKY7LG4HLNsqN6Bd0fzg4zFhKJgsN5Bll9WOChQyQr+iigXJOReCmKy6pPchG3Omtq84qZ5r+06MDJa7966KRTwZwxD0kIw+hB/B5G30H8QyfeQPgs7CVE6U7d4CmUxOMBlKGH4WhCYjPBchGbBPwVKFZgMYQFOSc+isC8S2WJmB0lxFZ14YAWGVFWAeM6JFcWqlJvmhXw8kL/xAJP9fiWRMWUlsO225SOjVVXVbXdstB3B4wfZwR8jfgiZbm9MpETlhwlyYMZgxNB/FHgZnEFrRGg2ahai5kb4WsEVCCvX0Sp2WZcV2QKzrNxy84QWuGalNpu3guIDzzsxEM/63oIs5E4toGh+hfWZlrxu5Q211aFYPDVcWpfedOON82dbtu07sx3nXoAMMEAaNo8DwQrXCBCMS8hcQu9OyBpCs1G/HLVL4WsGOMgqUl5RwmNJQrbIa5U4MZQ2HFa6L9PWHJvFzT8byeZdmWe2yPcLmKT6VYrp1pTm2jVL5z/32iDLwAan6rOf+si6taudZLev8/uM9MtGt6NC3mLIRaYXsQ707kD6JJgMrR5czWW1Sw22oLmicFDwhKUDt1lac28ylN+M4o0V3R42YI+8TXg/55ysVNqQZcVx3f/3+lsDr28Qaw0GA1s23mLarhTbzY3eETT20cEr30mjdw/69iA0E03rUbccchCuVS61JRRjQGCAIXWgzGAHD12pYLnFCpv3ltnvQPUFVClhWmbb4tnNDTUX+/rLrmkQa13btvxzn/pTx3H8p34o6acrb6qDIn91Vj+iB9D/NiDga4akFSVSS0W2kJbNezYxiCWiKH4o2CYKRoqylyh6M49SlyjJZCXTGVETDhzpPH/kRFfZ1Qxiivdu3SjLEqwos/rAclW9avDsJnMBpx7Fse8hsjuX3i7rK3sKkGfcBTyP5w6yCe99J7sXInec/0L+uLgXXlaOyKVmBFxTljiERcLdesvCgYvCyq21vq7277/2xYBPcUmyGjba1ctJDjA3ye1EiQ8Yb3iWaycQexv6afiaoNYOYrPFCuvZLyu24sGkEwXnM0iSM29BeYvOvvT8mG0Z6VS8Pxrpj6dcIsZITGqpf+a1t+NJvbj65dpaU1PTr4sWpgb8ZJrMrl5pVa9mdkxJHVajv1fi+ySjuxCNjDe8U/QfReokmtajcT0kDcIq19ZiOkRx+82FBPluqxdpZV96LTUfsRYrbD4lyMEIwrIsR8/YaUOYFhPEOGc+nyakQHfMfvPAKcMub86DcOMPBJctWXzX1k0bb1k5e3qzyoVlmrZgIMacmJI8rMb+Q020S2bP1eMXgABC0zH5bgSmQtil6RgM5rtQFJaiaPVmPmWFLI8exWVJLAYIsmxHN9y0CdOWXMEkiWmaRrK/O+buPnT2+df37W7viEUHGQy9HCWBYGjZ0sXbNm/YtG7ldVMbFeaYpukIBjBmx+TUEV//m2qyXTIvXSV+CZA0tNyO+lUA5TJqZfkt76v5lFXRz7MdqhyhJblBno1bGSCEabm6ibTJTVcWgnHONE2D7L8QFzs7zjz/RvvetzqikcsNLQ+LiVAovHz50js337rx5uUzJ9fJcEzTyPOrpo9o8Z1a8m3J6h13fj2aapegdQskX26tvCgIAkoNtpjZgoWiQKuXnQFBkGmLtMl1SzZdxSUmsSybPQnadfDM82+8tbu9IxrpHU41R0ZAuKp6xfKl225ff9vNS6a31Mhk5+2X21FFP+KL79bSHZLVN778CiA4FVPugVoHYZcSStkeUZmdUqm1slyClYRpU9qS05ZquqogLnFoqgol0JOgXYfOvfBG++72jkjfsNgsPuFoUFVds3LF0m2333rr6oXTmqs4WZZh2h6/TlRNH/Un92rpg5IdGdt5hgYBai0m3w3/lFzWsTgILRNZrw4sqwwgEmTZSFtK2tZMVxPEOSefpkEO9CRo9+FzL/x+/659HZG+Uc6AGuvlVtfUrlq5bNumdetWLpjaFOaukbNfcCem6cd8qX0+/bBkRytxtlIQIPsx6S6EZmXDg9IkbHZNYtZIyWPTdFjaUnXbbwgtZ5sKU4IXE9j9zrnn39i/u72jr3e088lyqNiF1tTWrV65bNumW25ZccOUBj9cwzQMhyQQSU5Myxzzp9p9maOSE6vkaT0n1roFoTmlNlv8DUFCmLaUtrW07TeFTxCXGGmaytTgxQT2HDn//Bv7d+07MHY286i8+NXW1betXHbnprVrl82bXOeHq5uG6RAHSLKjmvFuIH3AZxyR3HhlzkcAV9C6BaHZEFbuLQJAwjVsnra1tBOwXJ8LLjFomsKU4KUk9h7pfmHH2zv3Hui9dLEyNSnCOMZEdfUNa1Yvv3PjzTcvnt1aq1qZpG074DKE3dLzkM94r6I2q6J1CwLTiz2YcO2uRH1a1HLmSpxrgareFPYevfDCjgM79x64dLGnQqcfBFcjlG9oaFq9atmXPrF1drNmu7y2/8ma+PPjo7NboTVCONm3GExTnE22giu9Kf7dR/fs2nfgYs+Fip54cIx31g8A+vouvXfkQLWccYgH0vuqEy+NSwLXyaDnFVj9YJRPoGiq0+S7IFwnLOvxC+9eHU4xtoz/cFFbFfzJ331mxtRWlulqivxUEplxaSQMcE1YUQSn5YYLCUQ+2XZs02Hhm2+asWP/yUhcv3JRY8a408oY+9YXP7ipbaFppJqjD2t29zgKDwPsFIQF/6RszhAEICDrKZ35/eEFsxqf33ncssd90fG40/qRe9d+/sO3G5Zbl3gmnNk/7mLOACsCOQC1Nve4IcE480vpaEqZ3FRXHVJff+vUOFdinGldcv2M7//Vh7ikBvX2huSzjF2tfLjRC18zJBVwvTFwWRYK9IjuWzS7uTemHz5ZsRB1UIwjrXXVwX/+2kcmN9dzs6s18XNO5vidqxzChZNCYFJhDJHIp9iObacs36oFre3HLlzoG2QgulIYL1o5Y9/6wn23rZxvGqnW5KOqc+kqpWU9MMBOg6vQaiGc7AgCQ1DNJHXGJf+S2Y0vt59OG5VcDlmM8aL1o/e0ffZD6zOW25j+Xdg8dFU59cAAKw5/E7iUHxtnHAFFj6TkxprQpMbgK+1nhRgXXRoXWpfdMP2hv7iPMTlk7G/KvPg+cOpBuCAbvgbAzU/LlWWhwuhLaXOn1tiOaD82LiJbeVrra0I//OsPtjTUSGbXJP1JjiHn1g4fBObCx71JicOHJwVqFSStMEWDyKfZruP069ryufXHz/Wf7kmOvYZlqDCtnLNvf+6utUuvs8zU5MyTmohc+TfDQIJd183XVtNJjhGGnEQQJnz12bHu7KA3hTQjlWGuUJfNrdtxsKc/VYF7X4wK0/qxu1f+2QOrM6bbYr4Udt6tSJk2AmfZBh2NAAujfKLDFcAA14AczAVb3ui3YJyCqh5JKOGgOnty+OX9F2ynkg8oqyStyxdM/fvP30lMqrY7mqw3KlXsebQl0crI1NHoR9THRphRJIAs+Gqy8oqcyCpC40ZvXJveHPCr0puHRzascnlUjNaGmuA//dU9TXXVitU9xXp2xDo4BGI0s4dukmVFVv2upaepqYadldhIAiMGuBYUPyRvAVQu3iLh1yzhuNGUsmhWuCdqvNtVMZGtDK0SZ9/+7Ja2hdMcMznV+q1K5VO9RgcLwTNiraJoz3ck955yls/UdJMsBGt5F8NIAiMCIKAGQE7OYL2NQj4jpTPDkpbPDe873t8br4zIVobWT9y97JP3LDFMp9V5vYoq1eNmZ90VGTREDPVLP3jx1Z2Hbm5b0RpIJu2QDCvEoyMpCRA2VB84gRzABhwv6mJMhLRMJKFqsnTjjMArB6KGVQGRrQCtqxZM+daf3yZIqnEONou9Yy/QQ8Sd2ePMUzXtO788tq/juOvYh08n7ly3ULEjSVEX5n0qN0ZQHBE4QeagHKdwAAfkyIrjk81Lca2lRmmslt84FB84aDtSjJXWxtrgD/5iS311UHW6p4lXRhwADQGTQqesFYqqvPKO+Y+PvE4kAPT1RVJUs2Fxo5nRdVFdJ1/gbNiWxQC4UBhgAhZgASZgAzbI8fsM4VJfUp0/WdNN9+DpseZkx0SrJPFvf+bWlTe0OlZqOr2soTKST2Cn7SWGqIrZvr/84Y54vOD63zl+dsacBTe0WClDEiTVKMN9GAQACIJsg9s5g/U2G8wCOeFAOq3L6Yy89DrtaFemKzKmdMGYBl0+vm3hllXTM4bZSrsDGMkVXha99rSY1aCoyv95uvPc+ZJhEhLOd37y4ul0k8rNi2ZzxGoaQc+YADu3uqx4E4AQnNmzWroVnpK58+X7aifVjekJYaO31tU3TvrGJ9oEsTpxpIV1jKUSxciI0CljoSrLb7wn/uHnO2jAv9DJ6OnOXtq6ZiYykYRTXadEZD68YM67AXLpxKwiyIrwK+bFqFwToBmN/LXDpjta7zVKWptrg//7C+trw37N7ZkuvclRmS4KgZ/M3GC4wYQT/PKP9sX6B4/8z3f3SOFpa+aqum4YQmvwRYdrsjQ0rQQQ/D4HwrnUL2Y2urIk9p4Y5XWNhlZZ4t/6dNuyeQ2ulZol7VBZhQbdGHrMKT3GJJ9P/YdnL7751rHLfLfj3a6FixbPDEcSpswhqrT0cM/C8wsrSk6dR1XQSet2Im0vnCbOR9E5qrkZo9HWj985f9Oy1kzGnCy95WeVifwBpJ3QeX2KT3Z3nMCTLw6+Oi8P28x8+2c7+9gMmTLnUnVxMzBckXUGW7UhChtjmDtFaDKRiy9sYXNaRnMtI7bWpddP/btPLXcsUxAx2CEek1gF+qkC/ERytumqKVH11z85FIld+W4lEvGLRvj2pXVWui9l+xr8aWk4Y2UMkIdeZMIAwsUI+uLMcRFWae7U0IsdrjvCbPeIrTWq4534ZH+4hgkjYk9512hLuA0jLaQcDN16c9wMaKr845d6T545P8zfvfjavicO+INBLWWIU7HwsAw299C9QWyWwbJw5CSOnWa2RTKRG75+b3SRSyNmacTW2h9PPPf7w0r93KXzW5lx0XDkqNMCICTHR9ZPz4MhaQVPJqZqktjdFfrez9tH8pQw6jjeu2rFTc3y6f4MfLIb0obhZNhgXoujP4nDJ1kkwRmRX9N6fau/+ZT79ItvjfSpZRidy3Jsa+e+g8f7fCuWLq6VopZlxp26tBsKyYnhxjpFcIkf759qOUxntV95+L2+yJBPzBoUlmUcvcC2tE3imZP9GdQHSLlixMkHLIslnL2Io6eZYUEiClQ37+xf/pV/e+/YuydGejkeRh+3njp99qW3umdcv2JOM3P0vrQTiNl1Gjf88uBPLhgcDOcS9Zf0kN+n/vOr9ut7j4+iJn19EV2etm6+m0kldIs1hYfxT8nywQCHaeHoaZy5yEmQwsFqb/zZ/inff2RvMj6SbE4pxtR5TSbiz+84bIfmLF8wVTZ7TIeiVp0jpLCS5nxY3iNu+Dr76zXJab9Q/71fHBLuKL3fkc7emfOWzavp6U/ZnKE2dKWVj7k1WdF+HOpk0QTjRH6fv0dr+8avjedebSd3TJ3XsaZaSDhvdRw90MWXLl3WpMYsI5mwwgk7EFJ0VboCR47g70ZqLUeYvP6rj1y41Dey5l9aD/dAp75+9Y1V7tlomlX74fddllkJRDjTjSNnmGlBAgVqWndEl3714WMnOk+OvhqF4iuB890XXth7rmX2iuunqK7ek3HkSCascCekmkN6Z4bTsWBvSgoElH/dob2yp3OMdcjo6dPx6s3L6p1UbyLDmqsgDXVxHIaNd07iTA8jQSpnVLfox+0t//iLPelkZcLwig26ZPT0SzuP9MszVy6aqVldluVEjYDh8CrNlAYKAkNMlzojiipnDvRO/u5jJ12nAhNMzl/oleuuXzU1nUzoloOmmsG+xHEphoOdLJZgnCjgD5z3tf3Nr1Mv7dhPojIDRajwyCuJw0dP7OmkhUtWTQpGLD2SsNRYRgkqtk8pinsYbAdHLjLbMS25+euPGT2XRu8cynD4RN/Cm5ZNVbqiCfKpqCoWWQZBONHFjp1llg0Z5K+d/Fp0ydf+/cjp06crVQEPlZ9+0dvb+7td56qmrVw0Q6X0qYzt9qXBmQj7Csv4Tvay3hQF/P5/293y0q5KTot0Xftwl7tx1Vw10xVNsoYqaJq3bAO6gYOd7HwfANIkJuoX/6i98YeP7zbSiSsWO1KMy2Qh28rs2HOsy565csnsoHPaMs1omqUtVPkgK+hLoLOXaRIO9c9+6JdnnUo0/2Ik4vE+0brhBl8mEUtnWEs9uISLEXScYHEdEigYCp1V277+ZPy1nW+P07+FG7+JmPRe55nfH8W8m9ZPr07YeiJlskiKSRyne5ltk6O2fuMJ58LFykx7KcPJsxfrpy++qSHSnzCFYLEEjp5ljoDCyF8/7YWLi/7m3w+eO3duPE7tYXynDff3x17YdU5qWr1kTg1Lnzcs9CWY7SDg9/3f/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==', | 87 | icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19HvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAzzHIK1I08t6hq6zHpRdu2aYdJYuk9Q/881bzZa8Xrx6fLmJo/iu4/VXnfH1BB/rmu5ScQvI77m+BkmfxXxvcZcJY14L0DymZp7pML5yTcW61PvIN6JuGr4halQvmjNlCa4bXJ5zj6qhpxrujeKPYMXEd+q00KR5yNAlWZzrF+Ie+uNsdC/MO4tTOZafhbroyXuR3Df08bLiHsQf+ja6gTPWVimZl7l/oUrjl8OcxDWLbNU5D6JRL2gxkDu16fGuC054OMhclsyXTOOFEL+kmMGs4i5kfNuQ62EnBuam8tzP+Q+tSqhz9SuqpZlvR1EfBiOJTSgYMMM7jpYsAEyqJCHDL4dcFFTAwNMlFDUUpQYiadhDmXteeWAw3HEmA2s15k1RmnP4RHuhBybdBOF7MfnICmSQ2SYjIBM3iRvkcMki9IRcnDTthyLz2Ld2fTzPjTQK+Mdg8y5nkZfFO+se9LQr3/09xZr+5GcaSufeAfAww60mAPx+q8u/bAr8rFCLrx7s+vqEkw8qb+p26n11Aruq6m1iJH6PbWGv1VIY25mkNE8PkaQhxfLIF7DZXx80HD/A3l2jLclYs061xNpWCfoB6WHJTjbH0mV35Q/lRXlC+W8cndbl9t2SfhU+Fb4UfhO+F74GWThknBZ+Em4InwjXIyd1ePnY/Psg3pb1TJNu15TMKWMtFt6ScpKL0ivSMXIn9QtDUlj0h7U7N48t3i8eC0GnMC91dX2sTivgloDTgUVeEGHLTizbf5Da9JLhkhh29QOs1luMcScmBXTIIt7xRFxSBxnuJWfuAd1I7jntkyd/pgKaIwVr3MgmDo2q8x6IdB5QH162mcX7ajtnHGN2bov71OU1+U0fqqoXLD0wX5ZM005UHmySz3qLtDqILDvIL+iH6jB9y2x83ok898GOPQX3lk3Itl0A+BrD6D7tUjWh3fis58BXDigN9yF8M5PJH4B8Gr79/F/XRm8m241mw/wvur4BGDj42bzn+Vmc+NL9L8GcMn8F1kAcXjEKMJAAAAACXBIWXMAAAsTAAALEwEAmpwYAAABbmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNC40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgogICAgICAgICA8ZGM6c3ViamVjdD4KICAgICAgICAgICAgPHJkZjpCYWcvPgogICAgICAgICA8L2RjOnN1YmplY3Q+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgrlPw1BAAAd7klEQVR4nO19eZQV13nn797a3tr7yg5ikxCIHRohkACBEFqsJY4z8T52nPHYPp74JJ54bMfOsRMf2Z44OZ7EJ16iDLIsS5ZlydJY+2Ii1haiAQFCNGvTNHS/9/pt9Wq93/xRb+9u6OU1wif9O3Wq6223bv3qu7/vu9+9txqYwAQmMIEJTGACE5jABCbwnxTs/a4AHnjggY0bNwohxl4U5/xnP/tZe3v72Iv6g8fDDz9MlcOHP/zh9/uCAEB+vysA27YBkHAh7KK3aSRlMIDAFcZl13UrW73R4f2nNQvXYGYMjANUROkVyWXZvbBIDcLXOH4VHBGuGVoBgAMMYGAAERhAeekfyC8r+svA3n8nUYxrilYXxAFkScz6sKENlgHkfc5AYmSyMc64dmglEOW4pOyOUSlZxS9Y4RVjIHeEcjy+uGZoJYBErmlTdk/5V0NQxnLkUgXiswrimqEVAIkcTQU685+BioJsyikAkDXbCVqHABWslcpopcJfopIuTIFZMSECQ0GAWBGJA2j13mQspw8MeRumayJczeNaorVMW7MxVqkUgIEox6Yo7CdEYAhQji+UuKxyWgcFA0SWWbompODaoRUD7K40Hri8dJIgIVjRt99fXEu0FhNKpWabbfulYJTthjGAXLqW5PVapRUYwGyuj1AcGGTBQAJiQgQGotDFQkFkBwkGcpZbiAK8nqsgEsC10te6FmglAESCeZFAltPiMGvQSAtALhYAsrSSmLDWLIg8Wt0iQgdoa7nXKupm5TuvwgW5NEFrFp6kilyEVGAWGERSvT0rsWgwkEtZeZ2g1YNnX1llRIHNYlq9Dy6Tc4EgciHcPzwRuP/++9Pp9KuvvuoNk1QKRAQIKjBSrABFx9l2P2jvgIFcCAFyxyNunTVj2h/dt82nad/8zg+G+ZPh0ur3+7/70HdnXTdrz54927dvf+qpp7q7u0dbzxJkaaVSESjYbFHbz3NKJSksIOuySFTSZQX8/lvWrPjQg3dvWr92UktTV/eFH/30kYu9fcP57XBpXbOmbebMGURi1apVq1at+upX/9czTz+9/ZGf79q1a8yjciKrjCgKPEvcF8o7tRggBiRIuCQqE2DNnjXjvrs2P3jvHTfMn6sosmmayWSiqaF2w/q2X/zqt8MpYbi0Pvjgg4xzYaXgpIhrLY31f/aZP//EJz6+e/fu7du3P/3Ms5cuXRrlRQjynHhRp55KDgbpdJUIQDbf6hnsGKw1FAysu3nlnzxw94Z1bfX1dY5tO44BV6gwDVcmId+7dWMlaa2urr5j8+0kXLgW4yoTJukpwSQu+2+5Ze0t69Z9/aunnvnts9t//os9e/aO/MIIwi2JBMqZ9YS1zGXlDgRlIwHhQjijE4F5c2Y9eM8dH7hr8/Vzr+MSt03TTPerkutTuCSrINW2kpaptK1YNG3KpLNdV1a/YdG6fv26GTNnuJbByQWTwRQmSZKwyYoLMya4Nqml4bOf+++f/PhHd+7c9cijjz373O96+4alQQCIBIQrhFuqrQNsVgwwWO/TbEfLJRJCjEyOqsKhDevaPnT/tnVrVtbVVlu27ZhpmVl+iWRNYpIMcIDAFZU5KcdsrK3efNuan2z/1RVLHhatD95/Hxgn12CMgbw0vgBjjKuMXC4M0pOOLklycMNt6zZsuPXUyZO/efq3jz72RPv+t69culegtxXKH0DrQB3wDgi5/quLgt+7AhbMn/PgvVvu2bpp7uyZnDPbNKx0ROW2ooBzCVwCGIQAIxCBQ1EVltZdV7l787qfPvLkFVvklWltbGzccNt6YWUYOeBK9pqLXQqXGeOycMiOuWZEcN/USY3/44uf+/QnP/YfO3c98ugvf/fiy9FobKjyCUTCpWy/s6jkkoNSqS3skR0vIEFCkHAvf7011VWb1q/54/vvXLt6WU11tW2ZrpngyAS5KyscXAI4iCBcMMpOWgBBEJd9CqKm6Vu2aP6cWdOOd54ZK60bb1s/eXKrldEVr7kVsZGj2LMRxrgqMUcSGaEnbV1SpNDmjetu33jric7Op37z7GNP/Lrj0DuD8SqyXU+IrHqW8VvSNSjrdCH7KYmsvA4RCSxaMO/Be7bcs3XDdTOnc8ZsM+2kuzVmKpwYl8A4gKx5gmXbfvYAAIFLqkyGaVZXBbfc2lYBWh+47wMggrCYoiBvU0DBlLIXKbLHTOIS4+SQExHxXof5Zk5p/PKXPv+ZT33s9zvefPTxJ198+fX+eKLAKuWttcxlDTDYEmXIcQoAjMj1rLXMZdXX1tx+25oPfmDrmpVLqsJh28oIIyKTHuK2JDEwzzxF1iVmzbOYU++MHIIpisYyumPL226/+V8efsK5bFh5BVqnTpmybm2bbegcAkzKznIgKr0wkXtHZAc/iAAwLktMSCIjMklHl/xSeNuWW7du3nj8vfd+/fRzv3zymSPHjgPw4k0ityhuHZTZPK2D9LgYuQRBJNyc11qy6Po/uueOu7asnzl9GgM5ZkKkzviZoXABzzwJIBdMADyXEfemKnnH3mwwBpY9KVc0hSVM01w0f9YN82YdPPLe6GndvOm2pqYGQ0+qipQjseiCy7qSVEqHRzTjXFI4OYrb5yZ6BfPNmd70lb/8/H/79Eff2LHz4UceD/h9wnUgRDmVA5kt7hqIXMo1a7ACwhWO01BX88cf2PpfHty2avnicDDgWDrpFxSk/MzmHGBSzr95I7gsSxwxMAbGQBxEYLl9Yd4CgUk+hWUyZtAf2Lph9eVpvdyMMMbYs089dsfmjbaR0nwhICthOZPMbdmXOUdMBLjZg8KnORUWthC2Q7LLw5K/1rJhGBlVVbmTCIme3J27jPvK39ocoV7YKpwENTtyfSaTqQqHOBPCjMsirrGMxAisaNJc9oCVHGT3vGjPAF7yDpfITvdG01wJH363c+uffskwraGou5y1zr5u1uoVSy0jI3MGzpF3CESFrcRsaWhNyHk2xjlXVHIh+pxkrwyfxqtclzMigmBe4UPSivLj3I6RICJBIqQJnjmnIqkwh/Gcz/ES5IUpiGzAxnPdNZ4z5LywMoDAOASYrGk8plvW/FlTFi+YvXv/kdHQeueWjbU11YaelNRAzsGW+qtyTUCRBytuy6LoHuQsl0myRDLpqptwhOxCAs9rqyj9eZk4oLQO3idCdmM+iqtM53nz9NpNfg4s5ayVsQK/xLPBMssJQj6uyjLLCxVgkk9T0knDFwjcuWHVaGiVJeneu7Y4tsVATFJzjRrZRsGkrBV4zV84gAPk55rJhebPvD6lneUUZVwzzmWVuSCzkJwelNlifoGi9gGAGEOIp4rUMN8pYIWDPJtULAI5YSWWlVTPeIlyFFPhJUHVfFKy3zLljWsWPxTwp/TMyGi94fp5S2+60TIzmqqAK1lCyYGdgHEJ+jlkeqB3I9MFMwonBWHBixaYDK5BqYIShlYPtR5qPbQGyAFwDRAQTqny5oKY7LG4HLNsqN6Bd0fzg4zFhKJgsN5Bll9WOChQyQr+iigXJOReCmKy6pPchG3Omtq84qZ5r+06MDJa7966KRTwZwxD0kIw+hB/B5G30H8QyfeQPgs7CVE6U7d4CmUxOMBlKGH4WhCYjPBchGbBPwVKFZgMYQFOSc+isC8S2WJmB0lxFZ14YAWGVFWAeM6JFcWqlJvmhXw8kL/xAJP9fiWRMWUlsO225SOjVVXVbXdstB3B4wfZwR8jfgiZbm9MpETlhwlyYMZgxNB/FHgZnEFrRGg2ahai5kb4WsEVCCvX0Sp2WZcV2QKzrNxy84QWuGalNpu3guIDzzsxEM/63oIs5E4toGh+hfWZlrxu5Q211aFYPDVcWpfedOON82dbtu07sx3nXoAMMEAaNo8DwQrXCBCMS8hcQu9OyBpCs1G/HLVL4WsGOMgqUl5RwmNJQrbIa5U4MZQ2HFa6L9PWHJvFzT8byeZdmWe2yPcLmKT6VYrp1pTm2jVL5z/32iDLwAan6rOf+si6taudZLev8/uM9MtGt6NC3mLIRaYXsQ707kD6JJgMrR5czWW1Sw22oLmicFDwhKUDt1lac28ylN+M4o0V3R42YI+8TXg/55ysVNqQZcVx3f/3+lsDr28Qaw0GA1s23mLarhTbzY3eETT20cEr30mjdw/69iA0E03rUbccchCuVS61JRRjQGCAIXWgzGAHD12pYLnFCpv3ltnvQPUFVClhWmbb4tnNDTUX+/rLrmkQa13btvxzn/pTx3H8p34o6acrb6qDIn91Vj+iB9D/NiDga4akFSVSS0W2kJbNezYxiCWiKH4o2CYKRoqylyh6M49SlyjJZCXTGVETDhzpPH/kRFfZ1Qxiivdu3SjLEqwos/rAclW9avDsJnMBpx7Fse8hsjuX3i7rK3sKkGfcBTyP5w6yCe99J7sXInec/0L+uLgXXlaOyKVmBFxTljiERcLdesvCgYvCyq21vq7277/2xYBPcUmyGjba1ctJDjA3ye1EiQ8Yb3iWaycQexv6afiaoNYOYrPFCuvZLyu24sGkEwXnM0iSM29BeYvOvvT8mG0Z6VS8Pxrpj6dcIsZITGqpf+a1t+NJvbj65dpaU1PTr4sWpgb8ZJrMrl5pVa9mdkxJHVajv1fi+ySjuxCNjDe8U/QfReokmtajcT0kDcIq19ZiOkRx+82FBPluqxdpZV96LTUfsRYrbD4lyMEIwrIsR8/YaUOYFhPEOGc+nyakQHfMfvPAKcMub86DcOMPBJctWXzX1k0bb1k5e3qzyoVlmrZgIMacmJI8rMb+Q020S2bP1eMXgABC0zH5bgSmQtil6RgM5rtQFJaiaPVmPmWFLI8exWVJLAYIsmxHN9y0CdOWXMEkiWmaRrK/O+buPnT2+df37W7viEUHGQy9HCWBYGjZ0sXbNm/YtG7ldVMbFeaYpukIBjBmx+TUEV//m2qyXTIvXSV+CZA0tNyO+lUA5TJqZfkt76v5lFXRz7MdqhyhJblBno1bGSCEabm6ibTJTVcWgnHONE2D7L8QFzs7zjz/RvvetzqikcsNLQ+LiVAovHz50js337rx5uUzJ9fJcEzTyPOrpo9o8Z1a8m3J6h13fj2aapegdQskX26tvCgIAkoNtpjZgoWiQKuXnQFBkGmLtMl1SzZdxSUmsSybPQnadfDM82+8tbu9IxrpHU41R0ZAuKp6xfKl225ff9vNS6a31Mhk5+2X21FFP+KL79bSHZLVN778CiA4FVPugVoHYZcSStkeUZmdUqm1slyClYRpU9qS05ZquqogLnFoqgol0JOgXYfOvfBG++72jkjfsNgsPuFoUFVds3LF0m2333rr6oXTmqs4WZZh2h6/TlRNH/Un92rpg5IdGdt5hgYBai0m3w3/lFzWsTgILRNZrw4sqwwgEmTZSFtK2tZMVxPEOSefpkEO9CRo9+FzL/x+/659HZG+Uc6AGuvlVtfUrlq5bNumdetWLpjaFOaukbNfcCem6cd8qX0+/bBkRytxtlIQIPsx6S6EZmXDg9IkbHZNYtZIyWPTdFjaUnXbbwgtZ5sKU4IXE9j9zrnn39i/u72jr3e088lyqNiF1tTWrV65bNumW25ZccOUBj9cwzQMhyQQSU5Myxzzp9p9maOSE6vkaT0n1roFoTmlNlv8DUFCmLaUtrW07TeFTxCXGGmaytTgxQT2HDn//Bv7d+07MHY286i8+NXW1betXHbnprVrl82bXOeHq5uG6RAHSLKjmvFuIH3AZxyR3HhlzkcAV9C6BaHZEFbuLQJAwjVsnra1tBOwXJ8LLjFomsKU4KUk9h7pfmHH2zv3Hui9dLEyNSnCOMZEdfUNa1Yvv3PjzTcvnt1aq1qZpG074DKE3dLzkM94r6I2q6J1CwLTiz2YcO2uRH1a1HLmSpxrgareFPYevfDCjgM79x64dLGnQqcfBFcjlG9oaFq9atmXPrF1drNmu7y2/8ma+PPjo7NboTVCONm3GExTnE22giu9Kf7dR/fs2nfgYs+Fip54cIx31g8A+vouvXfkQLWccYgH0vuqEy+NSwLXyaDnFVj9YJRPoGiq0+S7IFwnLOvxC+9eHU4xtoz/cFFbFfzJ331mxtRWlulqivxUEplxaSQMcE1YUQSn5YYLCUQ+2XZs02Hhm2+asWP/yUhcv3JRY8a408oY+9YXP7ipbaFppJqjD2t29zgKDwPsFIQF/6RszhAEICDrKZ35/eEFsxqf33ncssd90fG40/qRe9d+/sO3G5Zbl3gmnNk/7mLOACsCOQC1Nve4IcE480vpaEqZ3FRXHVJff+vUOFdinGldcv2M7//Vh7ikBvX2huSzjF2tfLjRC18zJBVwvTFwWRYK9IjuWzS7uTemHz5ZsRB1UIwjrXXVwX/+2kcmN9dzs6s18XNO5vidqxzChZNCYFJhDJHIp9iObacs36oFre3HLlzoG2QgulIYL1o5Y9/6wn23rZxvGqnW5KOqc+kqpWU9MMBOg6vQaiGc7AgCQ1DNJHXGJf+S2Y0vt59OG5VcDlmM8aL1o/e0ffZD6zOW25j+Xdg8dFU59cAAKw5/E7iUHxtnHAFFj6TkxprQpMbgK+1nhRgXXRoXWpfdMP2hv7iPMTlk7G/KvPg+cOpBuCAbvgbAzU/LlWWhwuhLaXOn1tiOaD82LiJbeVrra0I//OsPtjTUSGbXJP1JjiHn1g4fBObCx71JicOHJwVqFSStMEWDyKfZruP069ryufXHz/Wf7kmOvYZlqDCtnLNvf+6utUuvs8zU5MyTmohc+TfDQIJd183XVtNJjhGGnEQQJnz12bHu7KA3hTQjlWGuUJfNrdtxsKc/VYF7X4wK0/qxu1f+2QOrM6bbYr4Udt6tSJk2AmfZBh2NAAujfKLDFcAA14AczAVb3ui3YJyCqh5JKOGgOnty+OX9F2ynkg8oqyStyxdM/fvP30lMqrY7mqw3KlXsebQl0crI1NHoR9THRphRJIAs+Gqy8oqcyCpC40ZvXJveHPCr0puHRzascnlUjNaGmuA//dU9TXXVitU9xXp2xDo4BGI0s4dukmVFVv2upaepqYadldhIAiMGuBYUPyRvAVQu3iLh1yzhuNGUsmhWuCdqvNtVMZGtDK0SZ9/+7Ja2hdMcMznV+q1K5VO9RgcLwTNiraJoz3ck955yls/UdJMsBGt5F8NIAiMCIKAGQE7OYL2NQj4jpTPDkpbPDe873t8br4zIVobWT9y97JP3LDFMp9V5vYoq1eNmZ90VGTREDPVLP3jx1Z2Hbm5b0RpIJu2QDCvEoyMpCRA2VB84gRzABhwv6mJMhLRMJKFqsnTjjMArB6KGVQGRrQCtqxZM+daf3yZIqnEONou9Yy/QQ8Sd2ePMUzXtO788tq/juOvYh08n7ly3ULEjSVEX5n0qN0ZQHBE4QeagHKdwAAfkyIrjk81Lca2lRmmslt84FB84aDtSjJXWxtrgD/5iS311UHW6p4lXRhwADQGTQqesFYqqvPKO+Y+PvE4kAPT1RVJUs2Fxo5nRdVFdJ1/gbNiWxQC4UBhgAhZgASZgAzbI8fsM4VJfUp0/WdNN9+DpseZkx0SrJPFvf+bWlTe0OlZqOr2soTKST2Cn7SWGqIrZvr/84Y54vOD63zl+dsacBTe0WClDEiTVKMN9GAQACIJsg9s5g/U2G8wCOeFAOq3L6Yy89DrtaFemKzKmdMGYBl0+vm3hllXTM4bZSrsDGMkVXha99rSY1aCoyv95uvPc+ZJhEhLOd37y4ul0k8rNi2ZzxGoaQc+YADu3uqx4E4AQnNmzWroVnpK58+X7aifVjekJYaO31tU3TvrGJ9oEsTpxpIV1jKUSxciI0CljoSrLb7wn/uHnO2jAv9DJ6OnOXtq6ZiYykYRTXadEZD68YM67AXLpxKwiyIrwK+bFqFwToBmN/LXDpjta7zVKWptrg//7C+trw37N7ZkuvclRmS4KgZ/M3GC4wYQT/PKP9sX6B4/8z3f3SOFpa+aqum4YQmvwRYdrsjQ0rQQQ/D4HwrnUL2Y2urIk9p4Y5XWNhlZZ4t/6dNuyeQ2ulZol7VBZhQbdGHrMKT3GJJ9P/YdnL7751rHLfLfj3a6FixbPDEcSpswhqrT0cM/C8wsrSk6dR1XQSet2Im0vnCbOR9E5qrkZo9HWj985f9Oy1kzGnCy95WeVifwBpJ3QeX2KT3Z3nMCTLw6+Oi8P28x8+2c7+9gMmTLnUnVxMzBckXUGW7UhChtjmDtFaDKRiy9sYXNaRnMtI7bWpddP/btPLXcsUxAx2CEek1gF+qkC/ERytumqKVH11z85FIld+W4lEvGLRvj2pXVWui9l+xr8aWk4Y2UMkIdeZMIAwsUI+uLMcRFWae7U0IsdrjvCbPeIrTWq4534ZH+4hgkjYk9512hLuA0jLaQcDN16c9wMaKr845d6T545P8zfvfjavicO+INBLWWIU7HwsAw299C9QWyWwbJw5CSOnWa2RTKRG75+b3SRSyNmacTW2h9PPPf7w0r93KXzW5lx0XDkqNMCICTHR9ZPz4MhaQVPJqZqktjdFfrez9tH8pQw6jjeu2rFTc3y6f4MfLIb0obhZNhgXoujP4nDJ1kkwRmRX9N6fau/+ZT79ItvjfSpZRidy3Jsa+e+g8f7fCuWLq6VopZlxp26tBsKyYnhxjpFcIkf759qOUxntV95+L2+yJBPzBoUlmUcvcC2tE3imZP9GdQHSLlixMkHLIslnL2Io6eZYUEiClQ37+xf/pV/e+/YuydGejkeRh+3njp99qW3umdcv2JOM3P0vrQTiNl1Gjf88uBPLhgcDOcS9Zf0kN+n/vOr9ut7j4+iJn19EV2etm6+m0kldIs1hYfxT8nywQCHaeHoaZy5yEmQwsFqb/zZ/inff2RvMj6SbE4pxtR5TSbiz+84bIfmLF8wVTZ7TIeiVp0jpLCS5nxY3iNu+Dr76zXJab9Q/71fHBLuKL3fkc7emfOWzavp6U/ZnKE2dKWVj7k1WdF+HOpk0QTjRH6fv0dr+8avjedebSd3TJ3XsaZaSDhvdRw90MWXLl3WpMYsI5mwwgk7EFJ0VboCR47g70ZqLUeYvP6rj1y41Dey5l9aD/dAp75+9Y1V7tlomlX74fddllkJRDjTjSNnmGlBAgVqWndEl3714WMnOk+OvhqF4iuB890XXth7rmX2iuunqK7ek3HkSCascCekmkN6Z4bTsWBvSgoElH/dob2yp3OMdcjo6dPx6s3L6p1UbyLDmqsgDXVxHIaNd07iTA8jQSpnVLfox+0t//iLPelkZcLwig26ZPT0SzuP9MszVy6aqVldluVEjYDh8CrNlAYKAkNMlzojiipnDvRO/u5jJ12nAhNMzl/oleuuXzU1nUzoloOmmsG+xHEphoOdLJZgnCjgD5z3tf3Nr1Mv7dhPojIDRajwyCuJw0dP7OmkhUtWTQpGLD2SsNRYRgkqtk8pinsYbAdHLjLbMS25+euPGT2XRu8cynD4RN/Cm5ZNVbqiCfKpqCoWWQZBONHFjp1llg0Z5K+d/Fp0ydf+/cjp06crVQEPlZ9+0dvb+7td56qmrVw0Q6X0qYzt9qXBmQj7Csv4Tvay3hQF/P5/293y0q5KTot0Xftwl7tx1Vw10xVNsoYqaJq3bAO6gYOd7HwfANIkJuoX/6i98YeP7zbSiSsWO1KMy2Qh28rs2HOsy565csnsoHPaMs1omqUtVPkgK+hLoLOXaRIO9c9+6JdnnUo0/2Ik4vE+0brhBl8mEUtnWEs9uISLEXScYHEdEigYCp1V277+ZPy1nW+P07+FG7+JmPRe55nfH8W8m9ZPr07YeiJlskiKSRyne5ltk6O2fuMJ58LFykx7KcPJsxfrpy++qSHSnzCFYLEEjp5ljoDCyF8/7YWLi/7m3w+eO3duPE7tYXynDff3x17YdU5qWr1kTg1Lnzcs9CWY7SDg9/3f/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==', |
92 | // icon4: 'jqtouch4.png', | 88 | // icon4: 'jqtouch4.png', |
93 | // startupScreen: null, //Pass a string path to a 320px x 460px startup screen for full screen apps. | 89 | // startupScreen: null, //Pass a string path to a 320px x 460px startup screen for full screen apps. |
94 | statusBar: 'black-translucent', //Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`. | 90 | statusBar: 'black-translucent', //Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`. |
@@ -119,33 +115,29 @@ MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, | |||
119 | // swapSelector: '.swap', //Link selector for 3d swap animation. (default: '.swap') | 115 | // swapSelector: '.swap', //Link selector for 3d swap animation. (default: '.swap') |
120 | // touchSelector: 'a, .touch', //Selector for items which are automatically given expanded touch events. This makes ordinary links more responsive and provides trigger events like `swipe` (default: 'a, .touch') | 116 | // touchSelector: 'a, .touch', //Selector for items which are automatically given expanded touch events. This makes ordinary links more responsive and provides trigger events like `swipe` (default: 'a, .touch') |
121 | 117 | ||
122 | debug: false | 118 | debug: false |
123 | }); | 119 | }); |
124 | 120 | ||
125 | this.setJQTouch(jqt); | 121 | this.setJQTouch(jqt); |
126 | }, | 122 | }, |
127 | 123 | */ | |
128 | //========================================================================= | 124 | //========================================================================= |
129 | 125 | ||
130 | 'showAddToHomeScreenBaloon': function () { | 126 | 'showAddToHomeScreenBaloon': function () { |
131 | console.log(">>> showAddToHomeScreenBaloon"); | ||
132 | }, | 127 | }, |
133 | 128 | ||
134 | //------------------------------------------------------------------------- | 129 | //------------------------------------------------------------------------- |
135 | 130 | ||
136 | 'selectInitialProxy': function () { | 131 | 'selectInitialProxy': function () { |
137 | //console.log(">>> selectInitialProxy"); | ||
138 | if (this.isOnline()) { | 132 | if (this.isOnline()) { |
139 | //console.log("--- selectInitialProxy: using default proxy"); | ||
140 | this._proxy = Clipperz.PM.Proxy.defaultProxy; | 133 | this._proxy = Clipperz.PM.Proxy.defaultProxy; |
141 | } else { | 134 | } else { |
142 | if (this.hasLocalData()) { | 135 | if (this.hasLocalData()) { |
143 | //console.log("--- selectInitialProxy: using local cache proxy"); | ||
144 | this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false}); | 136 | this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false}); |
145 | } else { | 137 | } else { |
146 | this.showOfflineError(); | 138 | this.showOfflineError(); |
147 | } | 139 | } |
148 | } | 140 | } |
149 | }, | 141 | }, |
150 | 142 | ||
151 | //------------------------------------------------------------------------- | 143 | //------------------------------------------------------------------------- |
@@ -162,17 +154,16 @@ console.log(">>> showAddToHomeScreenBaloon"); | |||
162 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin'); | 154 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin'); |
163 | this.loginForm().showCredentialsLogin(args); | 155 | this.loginForm().showCredentialsLogin(args); |
164 | } | 156 | } |
165 | }, | 157 | }, |
166 | 158 | ||
167 | //......................................................................... | 159 | //......................................................................... |
168 | 160 | ||
169 | 'handleFailedCredentialsLogin': function () { | 161 | 'handleFailedCredentialsLogin': function () { |
170 | console.log("LOGIN FAILED"); | ||
171 | this.showLoginForm({'previousFailedAttempt':'LOGIN'}); | 162 | this.showLoginForm({'previousFailedAttempt':'LOGIN'}); |
172 | }, | 163 | }, |
173 | 164 | ||
174 | //......................................................................... | 165 | //......................................................................... |
175 | 166 | ||
176 | 'handleFailedPinLogin': function () { | 167 | 'handleFailedPinLogin': function () { |
177 | varfailedAttempts; | 168 | varfailedAttempts; |
178 | varstatus; | 169 | varstatus; |
@@ -185,17 +176,16 @@ console.log("LOGIN FAILED"); | |||
185 | 176 | ||
186 | 'doLogin': function (someArgs) { | 177 | 'doLogin': function (someArgs) { |
187 | var deferredResult; | 178 | var deferredResult; |
188 | var credentials; | 179 | var credentials; |
189 | var errorCallback; | 180 | var errorCallback; |
190 | var user; | 181 | var user; |
191 | var getPassphraseDelegate; | 182 | var getPassphraseDelegate; |
192 | 183 | ||
193 | //console.log(">>> MainController.doLogin", someArgs); | ||
194 | credentials = someArgs['credentials']; | 184 | credentials = someArgs['credentials']; |
195 | errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop; | 185 | errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop; |
196 | 186 | ||
197 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase); | 187 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase); |
198 | user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate}); | 188 | user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate}); |
199 | 189 | ||
200 | deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false}); | 190 | deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false}); |
201 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | 191 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); |
@@ -227,17 +217,16 @@ console.log("LOGIN FAILED"); | |||
227 | return deferredResult; | 217 | return deferredResult; |
228 | }, | 218 | }, |
229 | 219 | ||
230 | //------------------------------------------------------------------------- | 220 | //------------------------------------------------------------------------- |
231 | 221 | ||
232 | 'setupApplication': function () { | 222 | 'setupApplication': function () { |
233 | vardeferredResult; | 223 | vardeferredResult; |
234 | 224 | ||
235 | console.log(">>> setupApplication"); | ||
236 | deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false}); | 225 | deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false}); |
237 | deferredResult.addMethod(this, 'welcomeFirstTimeUser'); | 226 | deferredResult.addMethod(this, 'welcomeFirstTimeUser'); |
238 | deferredResult.addMethod(this, 'showPaymentReminder'); | 227 | deferredResult.addMethod(this, 'showPaymentReminder'); |
239 | deferredResult.addMethod(this, 'copyDataLocally'); | 228 | deferredResult.addMethod(this, 'copyDataLocally'); |
240 | deferredResult.callback(arguments); | 229 | deferredResult.callback(arguments); |
241 | 230 | ||
242 | return deferredResult; | 231 | return deferredResult; |
243 | }, | 232 | }, |
@@ -250,17 +239,17 @@ console.log(">>> setupApplication"); | |||
250 | }, | 239 | }, |
251 | 240 | ||
252 | 'welcomeFirstTimeUser': function () { | 241 | 'welcomeFirstTimeUser': function () { |
253 | vardeferredResult; | 242 | vardeferredResult; |
254 | 243 | ||
255 | deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false}); | 244 | deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false}); |
256 | 245 | ||
257 | if (this.isFirstTimeUser()) { | 246 | if (this.isFirstTimeUser()) { |
258 | deferredResult.addCallback(function () { console.log("--> welcome"); }); | 247 | deferredResult.addCallback(function () { Clipperz.log("--> welcome"); }); |
259 | } | 248 | } |
260 | deferredResult.callback(); | 249 | deferredResult.callback(); |
261 | 250 | ||
262 | return deferredResult; | 251 | return deferredResult; |
263 | }, | 252 | }, |
264 | 253 | ||
265 | //.......................................................................... | 254 | //.......................................................................... |
266 | 255 | ||
@@ -269,17 +258,17 @@ console.log(">>> setupApplication"); | |||
269 | }, | 258 | }, |
270 | 259 | ||
271 | 'showPaymentReminder': function () { | 260 | 'showPaymentReminder': function () { |
272 | vardeferredResult; | 261 | vardeferredResult; |
273 | 262 | ||
274 | deferredResult = new Clipperz.Async.Deferred('MainController.showPaymentReminder', {trace:false}); | 263 | deferredResult = new Clipperz.Async.Deferred('MainController.showPaymentReminder', {trace:false}); |
275 | 264 | ||
276 | if (this.shouldShowPaymentReminder()) { | 265 | if (this.shouldShowPaymentReminder()) { |
277 | deferredResult.addCallback(function () { console.log("--> payment reminder"); }); | 266 | deferredResult.addCallback(function () { Clipperz.log("--> payment reminder"); }); |
278 | } | 267 | } |
279 | deferredResult.callback(); | 268 | deferredResult.callback(); |
280 | 269 | ||
281 | return deferredResult; | 270 | return deferredResult; |
282 | }, | 271 | }, |
283 | 272 | ||
284 | //.......................................................................... | 273 | //.......................................................................... |
285 | 274 | ||
@@ -288,30 +277,29 @@ console.log(">>> setupApplication"); | |||
288 | }, | 277 | }, |
289 | 278 | ||
290 | 'copyDataLocally': function () { | 279 | 'copyDataLocally': function () { |
291 | vardeferredResult; | 280 | vardeferredResult; |
292 | 281 | ||
293 | deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false}); | 282 | deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false}); |
294 | 283 | ||
295 | if (this.canCopyDataLocally()) { | 284 | if (this.canCopyDataLocally()) { |
296 | deferredResult.addCallback(function () { console.log("--> copy data locally"); }); | 285 | deferredResult.addCallback(function () { Clipperz.log("--> copy data locally"); }); |
297 | } | 286 | } |
298 | deferredResult.callback(); | 287 | deferredResult.callback(); |
299 | 288 | ||
300 | return deferredResult; | 289 | return deferredResult; |
301 | 290 | ||
302 | }, | 291 | }, |
303 | 292 | ||
304 | //------------------------------------------------------------------------- | 293 | //------------------------------------------------------------------------- |
305 | 294 | ||
306 | 'runApplication': function () { | 295 | 'runApplication': function () { |
307 | var deferredResult; | 296 | var deferredResult; |
308 | 297 | ||
309 | //console.log(">>> runApplication"); | ||
310 | deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true}); | 298 | deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true}); |
311 | deferredResult.addMethod(this.user(), 'getRecords'); | 299 | deferredResult.addMethod(this.user(), 'getRecords'); |
312 | deferredResult.addMethod(this, 'showCards'); | 300 | deferredResult.addMethod(this, 'showCards'); |
313 | deferredResult.callback(); | 301 | deferredResult.callback(); |
314 | 302 | ||
315 | return deferredResult; | 303 | return deferredResult; |
316 | }, | 304 | }, |
317 | 305 | ||
@@ -357,17 +345,17 @@ console.log(">>> setupApplication"); | |||
357 | MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler'); | 345 | MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler'); |
358 | } | 346 | } |
359 | 347 | ||
360 | return this._cardList; | 348 | return this._cardList; |
361 | }, | 349 | }, |
362 | 350 | ||
363 | 'showCards': function (someCards) { | 351 | 'showCards': function (someCards) { |
364 | this.cardList().showCards(someCards); | 352 | this.cardList().showCards(someCards); |
365 | this.jQTouch().goTo('#cardList', 'slideleft'); | 353 | // this.jQTouch().goTo('#cardList', 'slideleft'); |
366 | }, | 354 | }, |
367 | 355 | ||
368 | //------------------------------------------------------------------------- | 356 | //------------------------------------------------------------------------- |
369 | 357 | ||
370 | 'cardDetail': function () { | 358 | 'cardDetail': function () { |
371 | if (this._cardDetail == null) { | 359 | if (this._cardDetail == null) { |
372 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')}); | 360 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')}); |
373 | } | 361 | } |
@@ -375,17 +363,17 @@ console.log(">>> setupApplication"); | |||
375 | return this._cardDetail; | 363 | return this._cardDetail; |
376 | }, | 364 | }, |
377 | 365 | ||
378 | 'selectCardHandler': function (aCardReference) { | 366 | 'selectCardHandler': function (aCardReference) { |
379 | var deferredResult; | 367 | var deferredResult; |
380 | 368 | ||
381 | deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true}); | 369 | deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true}); |
382 | deferredResult.addMethod(this.cardDetail(), 'render'); | 370 | deferredResult.addMethod(this.cardDetail(), 'render'); |
383 | deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft'); | 371 | // deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft'); |
384 | deferredResult.addMethod(this.user(), 'getRecord', aCardReference); | 372 | deferredResult.addMethod(this.user(), 'getRecord', aCardReference); |
385 | deferredResult.addMethod(this.cardDetail(), 'showCard'); | 373 | deferredResult.addMethod(this.cardDetail(), 'showCard'); |
386 | deferredResult.callback(); | 374 | deferredResult.callback(); |
387 | 375 | ||
388 | return deferredResult; | 376 | return deferredResult; |
389 | }, | 377 | }, |
390 | 378 | ||
391 | //========================================================================= | 379 | //========================================================================= |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js index d6b0574..82c8dfd 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AccountPanel.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.AccountPanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.AccountPanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js index 3b3c8b4..da5fd76 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/AppPage.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.AppPage = function(args) { | 26 | Clipperz.PM.UI.Web.Components.AppPage = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Web.Components.AppPage.superclass.constructor.call(this, args); | 28 | Clipperz.PM.UI.Web.Components.AppPage.superclass.constructor.call(this, args); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js index 1835ca9..4cfca32 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/BookmarkletComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.BookmarkletComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.BookmarkletComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js index af33d85..8bb64f5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CardDialogComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CardDialogComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -677,17 +675,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz | |||
677 | }, | 675 | }, |
678 | 676 | ||
679 | 'showProgressMask': function () { | 677 | 'showProgressMask': function () { |
680 | this.getElement('progressDescription').innerHTML = "Saving"; | 678 | this.getElement('progressDescription').innerHTML = "Saving"; |
681 | MochiKit.DOM.addElementClass(this.getId('panel'), 'loading'); | 679 | MochiKit.DOM.addElementClass(this.getId('panel'), 'loading'); |
682 | }, | 680 | }, |
683 | 681 | ||
684 | 'showError': function (anError) { | 682 | 'showError': function (anError) { |
685 | //console.log(">>> showError", anError); | ||
686 | MochiKit.Style.hideElement(this.getId('progress')); | 683 | MochiKit.Style.hideElement(this.getId('progress')); |
687 | this.getElement('errorMessage').innerHTML = Clipperz.PM.Strings.errorDescriptionForException(anError['message']); | 684 | this.getElement('errorMessage').innerHTML = Clipperz.PM.Strings.errorDescriptionForException(anError['message']); |
688 | MochiKit.Style.showElement(this.getId('error')); | 685 | MochiKit.Style.showElement(this.getId('error')); |
689 | }, | 686 | }, |
690 | 687 | ||
691 | //------------------------------------------------------------------------- | 688 | //------------------------------------------------------------------------- |
692 | 689 | ||
693 | 'cancel': function () { | 690 | 'cancel': function () { |
@@ -757,17 +754,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz | |||
757 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); | 754 | // MochiKit.Style.hideElement(this.getElement('addDirectLoginButton')); |
758 | break; | 755 | break; |
759 | } | 756 | } |
760 | }, | 757 | }, |
761 | 758 | ||
762 | //------------------------------------------------------------------------- | 759 | //------------------------------------------------------------------------- |
763 | 760 | ||
764 | 'handleKeyEvent': function (anEvent) { | 761 | 'handleKeyEvent': function (anEvent) { |
765 | //console.log("####", anEvent.key().string); | ||
766 | if (anEvent.key().string == 'KEY_ESCAPE') { | 762 | if (anEvent.key().string == 'KEY_ESCAPE') { |
767 | MochiKit.Signal.signal(this, 'changedValue'); | 763 | MochiKit.Signal.signal(this, 'changedValue'); |
768 | this.cancel(); | 764 | this.cancel(); |
769 | } else if (anEvent.key().string == 'KEY_ENTER') { | 765 | } else if (anEvent.key().string == 'KEY_ENTER') { |
770 | if (anEvent.target().nodeName == 'TEXTAREA') { | 766 | if (anEvent.target().nodeName == 'TEXTAREA') { |
771 | 767 | ||
772 | } else { | 768 | } else { |
773 | anEvent.preventDefault(); | 769 | anEvent.preventDefault(); |
@@ -793,18 +789,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogComponent, Clipperz | |||
793 | 789 | ||
794 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.askConfirmationForLoosingPendingChanges", {trace:false}); | 790 | deferredResult = new Clipperz.Async.Deferred("CardDialogComponent.askConfirmationForLoosingPendingChanges", {trace:false}); |
795 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); | 791 | // deferredResult = confirmationDialog.deferredShow({openFromElement:anEvent.src(), onOkCloseToElement:MochiKit.DOM.currentDocument().body, onCancelCloseToElement:anEvent.src()}); |
796 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { | 792 | deferredResult.addMethod(confirmationDialog, 'deferredShow', { |
797 | 'openFromElement': this.getElement('cancelButton'), | 793 | 'openFromElement': this.getElement('cancelButton'), |
798 | 'onOkCloseToElement': null, //this.getElement('cancelButton'), | 794 | 'onOkCloseToElement': null, //this.getElement('cancelButton'), |
799 | 'onCancelCloseToElement':this.getElement('cancelButton') | 795 | 'onCancelCloseToElement':this.getElement('cancelButton') |
800 | }); | 796 | }); |
801 | // deferredResult.addCallback(function () { console.log("DELETE: " + anObject.toString(), anObject); }); | ||
802 | // deferredResult.addErrbackPass(function () { console.log("skip deletion: " + anObject.toString(), anObject); }); | ||
803 | deferredResult.callback(); | 797 | deferredResult.callback(); |
804 | 798 | ||
805 | return deferredResult; | 799 | return deferredResult; |
806 | }, | 800 | }, |
807 | 801 | ||
808 | //========================================================================= | 802 | //========================================================================= |
809 | 803 | ||
810 | 'showDirectLoginEditingComponent': function () { | 804 | 'showDirectLoginEditingComponent': function () { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js index 2e61f5f..0cee650 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordDirectLoginComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -50,17 +48,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginCo | |||
50 | 48 | ||
51 | 'reference': function () { | 49 | 'reference': function () { |
52 | return this._reference; | 50 | return this._reference; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
56 | 54 | ||
57 | 'renderSelf': function() { | 55 | 'renderSelf': function() { |
58 | //console.log(">>> CardDialogRecordDirectLoginComponent.renderSelf"); | ||
59 | this.append(this.element(), [ | 56 | this.append(this.element(), [ |
60 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_favicon', children:[ | 57 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_favicon', children:[ |
61 | {tag:'img', cls:'favicon', id:this.getId('favicon')} | 58 | {tag:'img', cls:'favicon', id:this.getId('favicon')} |
62 | ]}, | 59 | ]}, |
63 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_label', children:[ | 60 | {tag:'div', cls:'cardDialogRecordDirectLoginComponent_label', children:[ |
64 | {tag:'input', id:this.getId('label'), type:'text'} | 61 | {tag:'input', id:this.getId('label'), type:'text'} |
65 | ]}, | 62 | ]}, |
66 | {tag:'div', cls:'open', children:[ | 63 | {tag:'div', cls:'open', children:[ |
@@ -112,17 +109,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginCo | |||
112 | 'shouldShowElementWhileRendering': function () { | 109 | 'shouldShowElementWhileRendering': function () { |
113 | return false; | 110 | return false; |
114 | }, | 111 | }, |
115 | 112 | ||
116 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
117 | 114 | ||
118 | 'faviconComponent': function () { | 115 | 'faviconComponent': function () { |
119 | if (this._faviconComponent == null) { | 116 | if (this._faviconComponent == null) { |
120 | //console.log("created the FAVICON component"); | ||
121 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); | 117 | this._faviconComponent = new Clipperz.PM.UI.Common.Components.FaviconComponent({element:this.getId('favicon')}); |
122 | } | 118 | } |
123 | 119 | ||
124 | return this._faviconComponent; | 120 | return this._faviconComponent; |
125 | }, | 121 | }, |
126 | 122 | ||
127 | //========================================================================= | 123 | //========================================================================= |
128 | 124 | ||
@@ -155,25 +151,23 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordDirectLoginCo | |||
155 | }, | 151 | }, |
156 | 152 | ||
157 | //------------------------------------------------------------------------- | 153 | //------------------------------------------------------------------------- |
158 | 154 | ||
159 | 'editDirectLogin': function (anEvent) { | 155 | 'editDirectLogin': function (anEvent) { |
160 | anEvent.preventDefault(); | 156 | anEvent.preventDefault(); |
161 | 157 | ||
162 | MochiKit.Signal.signal(this, 'editDirectLogin', this.reference()); | 158 | MochiKit.Signal.signal(this, 'editDirectLogin', this.reference()); |
163 | //console.log("EDIT DIRECT LOGIN"); | ||
164 | }, | 159 | }, |
165 | 160 | ||
166 | //------------------------------------------------------------------------- | 161 | //------------------------------------------------------------------------- |
167 | 162 | ||
168 | 'deleteDirectLogin': function (anEvent) { | 163 | 'deleteDirectLogin': function (anEvent) { |
169 | anEvent.preventDefault(); | 164 | anEvent.preventDefault(); |
170 | 165 | ||
171 | MochiKit.Signal.signal(this, 'deleteDirectLogin', this.reference()); | 166 | MochiKit.Signal.signal(this, 'deleteDirectLogin', this.reference()); |
172 | //console.log("DELETE DIRECT LOGIN"); | ||
173 | }, | 167 | }, |
174 | 168 | ||
175 | 169 | ||
176 | 170 | ||
177 | //========================================================================= | 171 | //========================================================================= |
178 | __syntaxFix__: "syntax fix" | 172 | __syntaxFix__: "syntax fix" |
179 | }); | 173 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js index b58062c..689406a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CardDialogRecordFieldComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -164,18 +162,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.CardDialogRecordFieldComponen | |||
164 | this.setIsHidden(! this.isHidden()); | 162 | this.setIsHidden(! this.isHidden()); |
165 | MochiKit.Signal.signal(this, 'changedValue'); | 163 | MochiKit.Signal.signal(this, 'changedValue'); |
166 | }, | 164 | }, |
167 | 165 | ||
168 | //========================================================================= | 166 | //========================================================================= |
169 | 167 | ||
170 | 'handleActionLink': function (anEvent) { | 168 | 'handleActionLink': function (anEvent) { |
171 | anEvent.preventDefault(); | 169 | anEvent.preventDefault(); |
172 | |||
173 | //console.log("ACTION LINK - " + this.actionType()); | ||
174 | MochiKit.Signal.signal(this, 'performAction', this.reference(), anEvent.target()); | 170 | MochiKit.Signal.signal(this, 'performAction', this.reference(), anEvent.target()); |
175 | }, | 171 | }, |
176 | 172 | ||
177 | //========================================================================= | 173 | //========================================================================= |
178 | 174 | ||
179 | 'deleteField': function (anEvent) { | 175 | 'deleteField': function (anEvent) { |
180 | anEvent.preventDefault(); | 176 | anEvent.preventDefault(); |
181 | 177 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js index 391c379..41e32a0 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.ColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.ColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js index d3aa175..3d0ba76 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/CreateNewCardSplashComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js index 462d864..23f6710 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DataPanel.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DataPanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DataPanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js index ea55ba4..b305045 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DateColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.DateColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DateColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js index fe59494..6efe4c6 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DeleteObjectColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js index a1f0f9f..2dad703 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | /* | 24 | /* |
27 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 25 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
28 | 26 | ||
29 | //############################################################################# | 27 | //############################################################################# |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js index 1a76b0c..f5f99d4 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingBindingComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DirectLoginEditingBindingComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js index 5114b1d..55d2c01 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -100,17 +98,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingComponent, | |||
100 | 98 | ||
101 | //========================================================================= | 99 | //========================================================================= |
102 | 100 | ||
103 | 'label': function () { | 101 | 'label': function () { |
104 | return this.getElement('label').value | 102 | return this.getElement('label').value |
105 | }, | 103 | }, |
106 | 104 | ||
107 | 'setLabel': function (aValue) { | 105 | 'setLabel': function (aValue) { |
108 | //console.log("##> LABEL: " + aValue); | ||
109 | this.getElement('label').value = (aValue ? aValue : ''); | 106 | this.getElement('label').value = (aValue ? aValue : ''); |
110 | }, | 107 | }, |
111 | 108 | ||
112 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
113 | 110 | ||
114 | 'favicon': function () { | 111 | 'favicon': function () { |
115 | return this.getElement('faviconURL').value; | 112 | return this.getElement('faviconURL').value; |
116 | }, | 113 | }, |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js index fa57233..58b5b26 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginEditingFormValueComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -88,19 +86,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueCo | |||
88 | 86 | ||
89 | 'initialValue': function () { | 87 | 'initialValue': function () { |
90 | return this._initialValue; | 88 | return this._initialValue; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | //========================================================================= | 91 | //========================================================================= |
94 | 92 | ||
95 | 'renderSelf': function() { | 93 | 'renderSelf': function() { |
96 | //console.log(">>> DirectLoginEditingFormValueComponent.renderSelf"); | ||
97 | //console.log("FIELD OPTIONS", this.fieldOptions()); | ||
98 | //console.log("OPTION VALUES", this.optionValues()); | ||
99 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ | 94 | this.append(this.element(), {tag:'div', id:this.getId('div'), cls:'formValue', children:[ |
100 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, | 95 | {tag:'span', cls:'formFieldName', html:this.formFieldName()}, |
101 | {tag:'div', id:this.getId('values')} | 96 | {tag:'div', id:this.getId('values')} |
102 | ]}); | 97 | ]}); |
103 | 98 | ||
104 | if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { | 99 | if ((this.fieldType() == 'radio') || (this.fieldType() == 'select')) { |
105 | this.append(this.getElement('values'), | 100 | this.append(this.getElement('values'), |
106 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: | 101 | {tag:'select', name:this.formFieldName(), id:this.getId('select'), cls:'formFieldMatchinCardField', children: |
@@ -136,23 +131,21 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.DirectLoginEditingFormValueCo | |||
136 | MochiKit.Signal.connect(this.getElement('checkbox'), 'onchange', this, 'handleSelectChange'); | 131 | MochiKit.Signal.connect(this.getElement('checkbox'), 'onchange', this, 'handleSelectChange'); |
137 | 132 | ||
138 | if (this.initialValue()) { | 133 | if (this.initialValue()) { |
139 | MochiKit.DOM.updateNodeAttributes(this.getElement('checkbox'), {checked:true}); | 134 | MochiKit.DOM.updateNodeAttributes(this.getElement('checkbox'), {checked:true}); |
140 | } | 135 | } |
141 | } else { | 136 | } else { |
142 | WTF = TODO; | 137 | WTF = TODO; |
143 | } | 138 | } |
144 | //console.log("<<< DirectLoginEditingFormValueComponent.renderSelf"); | ||
145 | }, | 139 | }, |
146 | 140 | ||
147 | //========================================================================= | 141 | //========================================================================= |
148 | 142 | ||
149 | 'handleSelectChange': function (anEvent) { | 143 | 'handleSelectChange': function (anEvent) { |
150 | //console.log("handleSelectChange", anEvent, anEvent.src(), anEvent.src().value); | ||
151 | var options; | 144 | var options; |
152 | 145 | ||
153 | options = {}; | 146 | options = {}; |
154 | 147 | ||
155 | options['fieldName'] = this.formFieldName(); | 148 | options['fieldName'] = this.formFieldName(); |
156 | 149 | ||
157 | if (this.fieldType() == 'checkbox') { | 150 | if (this.fieldType() == 'checkbox') { |
158 | options['selectedValue'] = (this.getElement('checkbox').checked ? 1 : null); | 151 | options['selectedValue'] = (this.getElement('checkbox').checked ? 1 : null); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js index d8dc941..b4fc24e 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/DirectLoginsColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js index 6297002..bdb044a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/FaviconColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.FaviconColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.FaviconColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js index 51d55f4..21dddc9 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/GridComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.GridComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.GridComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -120,23 +118,21 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.GridComponent, Clipperz.PM.UI | |||
120 | 118 | ||
121 | 'focus': function () { | 119 | 'focus': function () { |
122 | this.getElement('search').focus(); | 120 | this.getElement('search').focus(); |
123 | }, | 121 | }, |
124 | 122 | ||
125 | //------------------------------------------------------------------------- | 123 | //------------------------------------------------------------------------- |
126 | 124 | ||
127 | 'startSearch': function () { | 125 | 'startSearch': function () { |
128 | //console.log("--> startSearch"); | ||
129 | MochiKit.DOM.addElementClass(this.getElement('search'), 'running'); | 126 | MochiKit.DOM.addElementClass(this.getElement('search'), 'running'); |
130 | }, | 127 | }, |
131 | 128 | ||
132 | 'endSearch': function () { | 129 | 'endSearch': function () { |
133 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'running'); | 130 | MochiKit.DOM.removeElementClass(this.getElement('search'), 'running'); |
134 | //console.log("<-- startSearch"); | ||
135 | }, | 131 | }, |
136 | 132 | ||
137 | //------------------------------------------------------------------------- | 133 | //------------------------------------------------------------------------- |
138 | 134 | ||
139 | 'disconnectColumnManagersRowsSignals': function () { | 135 | 'disconnectColumnManagersRowsSignals': function () { |
140 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | 136 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { |
141 | aColumnManager.disconnectRowsSignals(); | 137 | aColumnManager.disconnectRowsSignals(); |
142 | }); | 138 | }); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js index 3e03fcf..d1d9d7f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ImageColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.ImageColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.ImageColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js index f3f9cd5..69f735b 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LinkColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.LinkColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.LinkColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js index a10ba4f..38a9421 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.LoginForm = function(args) { | 26 | Clipperz.PM.UI.Web.Components.LoginForm = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js index 2894af8..3498e3f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginPage.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.LoginPage = function(args) { | 26 | Clipperz.PM.UI.Web.Components.LoginPage = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js index 26506e7..3fef6c5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginProgress.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.LoginProgress = function(args) { | 26 | Clipperz.PM.UI.Web.Components.LoginProgress = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -61,17 +59,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginProgress, Clipperz.PM.UI | |||
61 | // var loginProgressElement; | 59 | // var loginProgressElement; |
62 | // | 60 | // |
63 | // loginProgressElement = MochiKit.DOM.getElement('loginProgress'); | 61 | // loginProgressElement = MochiKit.DOM.getElement('loginProgress'); |
64 | // | 62 | // |
65 | // if (loginProgressElement == null) { | 63 | // if (loginProgressElement == null) { |
66 | // loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true); | 64 | // loginProgressElement = this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress'}, true); |
67 | // } | 65 | // } |
68 | 66 | ||
69 | //console.log(">> LoginProgress.renderSelf", this.element()); | ||
70 | this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [ | 67 | this.append(this.element(), {tag:'div', id:'loginProgress', cls:'LoginProgress', children: [ |
71 | // this.append(loginProgressElement, [ | 68 | // this.append(loginProgressElement, [ |
72 | {tag:'div', cls:'header', children:[ | 69 | {tag:'div', cls:'header', children:[ |
73 | {tag:'h3', id:this.getId('title'), html:"login progress"} | 70 | {tag:'h3', id:this.getId('title'), html:"login progress"} |
74 | ]}, | 71 | ]}, |
75 | {tag:'div', cls:'body', children:[ | 72 | {tag:'div', cls:'body', children:[ |
76 | {tag:'div', id:this.getId('progressBar')}, | 73 | {tag:'div', id:this.getId('progressBar')}, |
77 | {tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[ | 74 | {tag:'div', id:this.getId('errorBox'), cls:'errorBox', children:[ |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js index feb16ad..06746d1 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/NewUserCreationComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.NewUserCreationComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -118,18 +116,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.NewUserCreationComponent, Cli | |||
118 | } | 116 | } |
119 | 117 | ||
120 | return this._tabPanelController; | 118 | return this._tabPanelController; |
121 | }, | 119 | }, |
122 | 120 | ||
123 | //------------------------------------------------------------------------- | 121 | //------------------------------------------------------------------------- |
124 | 122 | ||
125 | 'renderSelf': function() { | 123 | 'renderSelf': function() { |
126 | //console.log('** Clipperz.targetModalDimensionsAndPosition', Clipperz.Base.serializeJSON(Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition)); | ||
127 | |||
128 | this.append(this.element(), {tag:'div', cls:'NewUserCreation mainDialog', id:this.getId('panel'), children: [ | 124 | this.append(this.element(), {tag:'div', cls:'NewUserCreation mainDialog', id:this.getId('panel'), children: [ |
129 | {tag:'form', id:this.getId('form'), cls:'newUserCreationForm', children:[ | 125 | {tag:'form', id:this.getId('form'), cls:'newUserCreationForm', children:[ |
130 | {tag:'div', cls:'header', children:[ | 126 | {tag:'div', cls:'header', children:[ |
131 | {tag:'div', cls:'title', children:[ | 127 | {tag:'div', cls:'title', children:[ |
132 | {tag:'h3', id:this.getId('title'), html:"Create new user"} | 128 | {tag:'h3', id:this.getId('title'), html:"Create new user"} |
133 | ]} | 129 | ]} |
134 | ]}, | 130 | ]}, |
135 | {tag:'div', id:this.getId('body'), cls:'body', children:[ | 131 | {tag:'div', id:this.getId('body'), cls:'body', children:[ |
@@ -328,20 +324,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.NewUserCreationComponent, Cli | |||
328 | 'bottomMargin': function () { | 324 | 'bottomMargin': function () { |
329 | var result; | 325 | var result; |
330 | 326 | ||
331 | //TODO: WTF!!! | 327 | //TODO: WTF!!! |
332 | // result =MochiKit.Style.getElementPosition(this.element())['y'] + | 328 | // result =MochiKit.Style.getElementPosition(this.element())['y'] + |
333 | // MochiKit.Style.getElementDimensions(this.element())['h']; | 329 | // MochiKit.Style.getElementDimensions(this.element())['h']; |
334 | 330 | ||
335 | // result =MochiKit.Style.getElementPosition(this.getElement('footer'))['y']; | 331 | // result =MochiKit.Style.getElementPosition(this.getElement('footer'))['y']; |
336 | //console.log("### bottomMargin"); | ||
337 | //console.log('displayElement', this.displayElement()); | ||
338 | //console.log('-- Clipperz.targetModalDimensionsAndPosition', Clipperz.Base.serializeJSON(Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition)); | ||
339 | //console.log('element', MochiKit.Style.getElementPosition('modalDialog') ['y'], MochiKit.Style.getElementDimensions('modalDialog')['h']); | ||
340 | // result = 450; | 332 | // result = 450; |
341 | 333 | ||
342 | result =Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['position']['y'] + | 334 | result =Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['position']['y'] + |
343 | Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['dimensions']['h'] - | 335 | Clipperz.PM.UI.Common.Components.BaseComponent.targetModalDimensionsAndPosition['dimensions']['h'] - |
344 | 60; | 336 | 60; |
345 | 337 | ||
346 | return result; | 338 | return result; |
347 | }, | 339 | }, |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js index 3cc5a37..30cbeb2 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/Page.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.Page = function(args) { | 26 | Clipperz.PM.UI.Web.Components.Page = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js index dcf506f..df3ca0c 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageFooter.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.PageFooter = function(args) { | 26 | Clipperz.PM.UI.Web.Components.PageFooter = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js index b8f3b05..5e49fb5 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PageHeader.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.PageHeader = function(args) { | 26 | Clipperz.PM.UI.Web.Components.PageHeader = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js index 987e51e..5eb0c1f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/PasswordTooltip.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Common.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.PasswordTooltip = function(args) { | 26 | Clipperz.PM.UI.Web.Components.PasswordTooltip = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js index 69c1ede..ad8d677 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/RulerComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.RulerComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.RulerComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Web.Components.RulerComponent.superclass.constructor.apply(this, arguments); | 28 | Clipperz.PM.UI.Web.Components.RulerComponent.superclass.constructor.apply(this, arguments); |
@@ -107,17 +105,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.RulerComponent, Clipperz.PM.U | |||
107 | // ]}, | 105 | // ]}, |
108 | {tag:'div', cls:'dots', id:this.getId('dotsFrame')} | 106 | {tag:'div', cls:'dots', id:this.getId('dotsFrame')} |
109 | // {tag:'div', cls:'dots' + ' ' + 'steps_' + this.steps().length, children:[ | 107 | // {tag:'div', cls:'dots' + ' ' + 'steps_' + this.steps().length, children:[ |
110 | // {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map(function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}}, this.steps())} | 108 | // {tag:'ul', id:this.getId('dots'), children:MochiKit.Base.map(function (aStep) { return {tag:'li', children:[{tag:'span', html:'*'}]}}, this.steps())} |
111 | // ]} | 109 | // ]} |
112 | ]} | 110 | ]} |
113 | ]} | 111 | ]} |
114 | ])); | 112 | ])); |
115 | //console.log("ELEMENT", this.element()); | ||
116 | 113 | ||
117 | MochiKit.Signal.connect(this.getElement('exit'), 'onclick', this, 'handleExit'); | 114 | MochiKit.Signal.connect(this.getElement('exit'), 'onclick', this, 'handleExit'); |
118 | 115 | ||
119 | MochiKit.Signal.connect(this.getElement('previousButton'), 'onclick', this, 'handlePrevious'); | 116 | MochiKit.Signal.connect(this.getElement('previousButton'), 'onclick', this, 'handlePrevious'); |
120 | MochiKit.Signal.connect(this.getElement('smallPreviousButton'),'onclick', this, 'handlePrevious'); | 117 | MochiKit.Signal.connect(this.getElement('smallPreviousButton'),'onclick', this, 'handlePrevious'); |
121 | 118 | ||
122 | MochiKit.Signal.connect(this.getElement('nextButton'), 'onclick', this, 'handleNext'); | 119 | MochiKit.Signal.connect(this.getElement('nextButton'), 'onclick', this, 'handleNext'); |
123 | MochiKit.Signal.connect(this.getElement('smallNextButton'), 'onclick', this, 'handleNext'); | 120 | MochiKit.Signal.connect(this.getElement('smallNextButton'), 'onclick', this, 'handleNext'); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js index 666afe9..edcdb62 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.TabSidePanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.TabSidePanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | Clipperz.PM.UI.Web.Components.TabSidePanel.superclass.constructor.call(this, args); | 28 | Clipperz.PM.UI.Web.Components.TabSidePanel.superclass.constructor.call(this, args); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js index 3dc9ce9..9b1796a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TextColumnManager.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.TextColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.TextColumnManager = function(args) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js index 0fa369f..034ed91 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ToolsPanel.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) { | 26 | Clipperz.PM.UI.Web.Components.ToolsPanel = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js index 21ccf2a..fe46729 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent = function(args) { | 26 | Clipperz.PM.UI.Web.Components.UnlockPasswordComponent = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -155,17 +153,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent, Clip | |||
155 | 153 | ||
156 | //------------------------------------------------------------------------- | 154 | //------------------------------------------------------------------------- |
157 | 155 | ||
158 | 'userSuccessfullyLoggedInHandler': function (anEvent) { | 156 | 'userSuccessfullyLoggedInHandler': function (anEvent) { |
159 | this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); | 157 | this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); |
160 | }, | 158 | }, |
161 | 159 | ||
162 | 'userLoginFailedHandler': function (anEvent) { | 160 | 'userLoginFailedHandler': function (anEvent) { |
163 | //console.log("############### FAILED LOGIN ################"); | ||
164 | this.showFailure(); | 161 | this.showFailure(); |
165 | }, | 162 | }, |
166 | 163 | ||
167 | //------------------------------------------------------------------------- | 164 | //------------------------------------------------------------------------- |
168 | /* | 165 | /* |
169 | 'deferredShow': function (someArgs, aResult) { | 166 | 'deferredShow': function (someArgs, aResult) { |
170 | this.deferredShowModal(someArgs); | 167 | this.deferredShowModal(someArgs); |
171 | 168 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js index d699dc6..fbf58e0 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UserInfoBox.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Components.UserInfoBox = function(args) { | 26 | Clipperz.PM.UI.Web.Components.UserInfoBox = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -71,17 +69,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UserInfoBox, Clipperz.PM.UI.C | |||
71 | 'setIsLocked': function (aValue) { | 69 | 'setIsLocked': function (aValue) { |
72 | this._isLocked = aValue; | 70 | this._isLocked = aValue; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | 'toggleLock': function(anEvent) { | 73 | 'toggleLock': function(anEvent) { |
76 | var deferredResult; | 74 | var deferredResult; |
77 | var shouldLock; | 75 | var shouldLock; |
78 | 76 | ||
79 | //console.log(">>> UserInfoBox.toggleLock [locked: " + this.isLocked() + "]"); | ||
80 | anEvent.preventDefault(); | 77 | anEvent.preventDefault(); |
81 | this.lockTooltip().hide(); | 78 | this.lockTooltip().hide(); |
82 | 79 | ||
83 | shouldLock = (this.isLocked() == false); | 80 | shouldLock = (this.isLocked() == false); |
84 | 81 | ||
85 | if (shouldLock) { | 82 | if (shouldLock) { |
86 | var maskElement; | 83 | var maskElement; |
87 | 84 | ||
@@ -93,17 +90,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UserInfoBox, Clipperz.PM.UI.C | |||
93 | MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this, 'askForPassphrase')), | 90 | MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', MochiKit.Base.method(this, 'askForPassphrase')), |
94 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'lock') | 91 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'lock') |
95 | ], {trace:false}); | 92 | ], {trace:false}); |
96 | } else { | 93 | } else { |
97 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [unlock]", [ | 94 | deferredResult = Clipperz.Async.callbacks("UserInfoBox.toggleLock [unlock]", [ |
98 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'unlock') | 95 | MochiKit.Base.partial(MochiKit.Signal.signal, this, 'unlock') |
99 | ], {trace:false}); | 96 | ], {trace:false}); |
100 | } | 97 | } |
101 | //console.log("<<< UserInfoBox.toggleLock"); | ||
102 | 98 | ||
103 | return deferredResult; | 99 | return deferredResult; |
104 | }, | 100 | }, |
105 | 101 | ||
106 | //------------------------------------------------------------------------- | 102 | //------------------------------------------------------------------------- |
107 | 103 | ||
108 | 'unlock': function () { | 104 | 'unlock': function () { |
109 | var deferredResult; | 105 | var deferredResult; |
@@ -128,30 +124,28 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UserInfoBox, Clipperz.PM.UI.C | |||
128 | 124 | ||
129 | deferredResult = new Clipperz.Async.Deferred("UserInfoBox.askForPassphrase", {trace:false}); | 125 | deferredResult = new Clipperz.Async.Deferred("UserInfoBox.askForPassphrase", {trace:false}); |
130 | deferredResult.addCallback(MochiKit.Async.succeed, 'test'); | 126 | deferredResult.addCallback(MochiKit.Async.succeed, 'test'); |
131 | 127 | ||
132 | deferredResult.callback(); | 128 | deferredResult.callback(); |
133 | 129 | ||
134 | return deferredResult; | 130 | return deferredResult; |
135 | */ | 131 | */ |
136 | //console.log(">>> UserInfoBox.askForPassphrase"); | ||
137 | unlockPasswordComponent = new Clipperz.PM.UI.Web.Components.UnlockPasswordComponent({ | 132 | unlockPasswordComponent = new Clipperz.PM.UI.Web.Components.UnlockPasswordComponent({ |
138 | 'title':"Unlock account", | 133 | 'title':"Unlock account", |
139 | 'text': "Insert the passprase to unlock the account", | 134 | 'text': "Insert the passprase to unlock the account", |
140 | 'type': 'INFO', | 135 | 'type': 'INFO', |
141 | 'buttons': [ | 136 | 'buttons': [ |
142 | {text:"Cancel",result:'CANCEL'}, | 137 | {text:"Cancel",result:'CANCEL'}, |
143 | {text:"Unlock", result:'OK',isDefault:true} | 138 | {text:"Unlock", result:'OK',isDefault:true} |
144 | ], | 139 | ], |
145 | 'openFromElement': this.getElement('lock'), | 140 | 'openFromElement': this.getElement('lock'), |
146 | 'onOkCloseToElement': null, | 141 | 'onOkCloseToElement': null, |
147 | 'onCancelCloseToElement':this.getId('lock') | 142 | 'onCancelCloseToElement':this.getId('lock') |
148 | }); | 143 | }); |
149 | //console.log("<<< UserInfoBox.askForPassphrase"); | ||
150 | 144 | ||
151 | return unlockPasswordComponent.getPassphrase(); | 145 | return unlockPasswordComponent.getPassphrase(); |
152 | }, | 146 | }, |
153 | 147 | ||
154 | //========================================================================= | 148 | //========================================================================= |
155 | 149 | ||
156 | 'renderSelf': function(/*aContainer, aPosition*/) { | 150 | 'renderSelf': function(/*aContainer, aPosition*/) { |
157 | this.append(this.element(), [ | 151 | this.append(this.element(), [ |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js index 1ab2e69..3d9d6d3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/AppController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.AppController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.AppController = function(args) { |
29 | 27 | ||
30 | this._user = null; | 28 | this._user = null; |
@@ -319,17 +317,16 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, { | |||
319 | MochiKit.Base.method(this.user(), 'login'), | 317 | MochiKit.Base.method(this.user(), 'login'), |
320 | MochiKit.Base.method(this.cardsController(), 'focus'), | 318 | MochiKit.Base.method(this.cardsController(), 'focus'), |
321 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'), | 319 | MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'progressDone'), |
322 | MochiKit.Base.method(this.userInfoBox(), 'unlock') | 320 | MochiKit.Base.method(this.userInfoBox(), 'unlock') |
323 | ], {trace:false}); | 321 | ], {trace:false}); |
324 | }, | 322 | }, |
325 | 323 | ||
326 | 'handleDownloadOfflineCopy': function (anEvent) { | 324 | 'handleDownloadOfflineCopy': function (anEvent) { |
327 | console.log("AppController.handleDownloadOfflineCopy"); | ||
328 | var downloadHref; | 325 | var downloadHref; |
329 | 326 | ||
330 | downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl; | 327 | downloadHref = window.location.href.replace(/\/[^\/]*$/,'') + Clipperz_dumpUrl; |
331 | 328 | ||
332 | if (Clipperz_IEisBroken == true) { | 329 | if (Clipperz_IEisBroken == true) { |
333 | window.open(downloadHref, ""); | 330 | window.open(downloadHref, ""); |
334 | } else { | 331 | } else { |
335 | vardeferredResult; | 332 | vardeferredResult; |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js index effde31..b1ff81f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardDialogController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.CardDialogController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
@@ -369,17 +367,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object | |||
369 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), | 367 | MochiKit.Base.method(this.cardDialogComponent(), 'fixRendering'), |
370 | MochiKit.Base.method(this, 'handleChangedValue') | 368 | MochiKit.Base.method(this, 'handleChangedValue') |
371 | ], {trace:false}) | 369 | ], {trace:false}) |
372 | }, | 370 | }, |
373 | 371 | ||
374 | //------------------------------------------------------------------------- | 372 | //------------------------------------------------------------------------- |
375 | 373 | ||
376 | 'handlePerformFieldAction': function (aFieldID, aTargetElement) { | 374 | 'handlePerformFieldAction': function (aFieldID, aTargetElement) { |
377 | //console.log("### targetElement", aTargetElement); | ||
378 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ | 375 | return Clipperz.Async.callbacks("CardDialogController.handleDeleteField", [ |
379 | MochiKit.Base.method(this.record(), 'fields'), | 376 | MochiKit.Base.method(this.record(), 'fields'), |
380 | MochiKit.Base.itemgetter(aFieldID), | 377 | MochiKit.Base.itemgetter(aFieldID), |
381 | Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", { | 378 | Clipperz.Async.collectResults("CardDialogController.handleDeleteField <collect results>", { |
382 | 'value':MochiKit.Base.methodcaller('value'), | 379 | 'value':MochiKit.Base.methodcaller('value'), |
383 | 'type': MochiKit.Base.methodcaller('actionType') | 380 | 'type': MochiKit.Base.methodcaller('actionType') |
384 | }, {trace:false}), | 381 | }, {trace:false}), |
385 | MochiKit.Base.bind(function (someValues) { | 382 | MochiKit.Base.bind(function (someValues) { |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js index f58f0b8..68b5b9f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { | 26 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { |
29 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); | 27 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js index c025a51..92ed6e3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginWizardController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController = function(args) { |
29 | this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); | 27 | this._directLoginEditingComponent = args.directLoginEditingComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); |
30 | this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter'); | 28 | this._cardLabel = args.cardLabel || Clipperz.Base.exception.raise('MandatoryParameter'); |
@@ -158,17 +156,16 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController. | |||
158 | 156 | ||
159 | //----------------------------------------------------------------------------- | 157 | //----------------------------------------------------------------------------- |
160 | 158 | ||
161 | 'originalBindings': function () { | 159 | 'originalBindings': function () { |
162 | return this._originalBindings; | 160 | return this._originalBindings; |
163 | }, | 161 | }, |
164 | 162 | ||
165 | 'setOriginalBindings': function (aValue) { | 163 | 'setOriginalBindings': function (aValue) { |
166 | //console.log("BINDINGS", aValue); | ||
167 | this._originalBindings = aValue; | 164 | this._originalBindings = aValue; |
168 | }, | 165 | }, |
169 | 166 | ||
170 | //============================================================================= | 167 | //============================================================================= |
171 | 168 | ||
172 | 'rulerComponent': function () { | 169 | 'rulerComponent': function () { |
173 | if (this._rulerComponent == null) { | 170 | if (this._rulerComponent == null) { |
174 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ | 171 | this._rulerComponent = new Clipperz.PM.UI.Web.Components.RulerComponent({ |
@@ -402,18 +399,16 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.DirectLoginWizardController. | |||
402 | 399 | ||
403 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'), | 400 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bookmarkletConfiguration'), |
404 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'), | 401 | MochiKit.Base.method(this.directLogin(), 'setBookmarkletConfiguration'), |
405 | 402 | ||
406 | //Bindings | 403 | //Bindings |
407 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'), | 404 | MochiKit.Base.method(this.directLoginEditingComponent(), 'bindingComponents'), |
408 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) { | 405 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.bind(function (aBindingComponent) { |
409 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) { | 406 | Clipperz.Async.forEach(MochiKit.Base.bind(function (aBindingComponent) { |
410 | //console.log("aBindingComponent", aBindingComponent); | ||
411 | // this.directLogin(). | ||
412 | return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [ | 407 | return Clipperz.Async.callbacks("DirectLoginWizardController.done - update directLogin bindings", [ |
413 | MochiKit.Base.method(this.directLogin(), 'bindings'), | 408 | MochiKit.Base.method(this.directLogin(), 'bindings'), |
414 | MochiKit.Base.itemgetter(aBindingComponent.formFieldName()), | 409 | MochiKit.Base.itemgetter(aBindingComponent.formFieldName()), |
415 | MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue()) | 410 | MochiKit.Base.methodcaller('setFieldKey', aBindingComponent.selectedValue()) |
416 | ], {trace:false}); | 411 | ], {trace:false}); |
417 | }, this)), | 412 | }, this)), |
418 | 413 | ||
419 | MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), | 414 | MochiKit.Base.method(this.directLoginEditingComponent(), 'favicon'), |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js index 6ca3be4..7ab512a 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/DirectLoginsController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | /* | 24 | /* |
27 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 25 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
28 | 26 | ||
29 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() { | 27 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController = function() { |
30 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments); | 28 | Clipperz.PM.UI.Web.Controllers.DirectLoginsController.superclass.constructor.apply(this, arguments); |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js index bfc093a..de59ec3 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/FilterController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.FilterController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.FilterController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js index 8bb3016..44fbdef 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.GridController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.GridController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js index a57152d..ac85d36 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.LoginController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.LoginController = function(args) { |
29 | this._args = args || {}; | 27 | this._args = args || {}; |
30 | 28 | ||
@@ -207,23 +205,22 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, { | |||
207 | }, | 205 | }, |
208 | 206 | ||
209 | 207 | ||
210 | //========================================================================= | 208 | //========================================================================= |
211 | 209 | ||
212 | 'handleFailedLogin': function(aLoginProgress, anError) { | 210 | 'handleFailedLogin': function(aLoginProgress, anError) { |
213 | var result; | 211 | var result; |
214 | 212 | ||
215 | //console.log("anError", anError); | ||
216 | if (anError instanceof MochiKit.Async.CancelledError) { | 213 | if (anError instanceof MochiKit.Async.CancelledError) { |
217 | result = anError; | 214 | result = anError; |
218 | } else { | 215 | } else { |
219 | var deferredResult; | 216 | var deferredResult; |
220 | 217 | ||
221 | MochiKit.Logging.logError("## MainController - FAILED LOGIN: " + anError); | 218 | Clipperz.logError("## MainController - FAILED LOGIN: " + anError); |
222 | deferredResult = new MochiKit.Async.Deferred(); | 219 | deferredResult = new MochiKit.Async.Deferred(); |
223 | 220 | ||
224 | aLoginProgress.showErrorMessage("failed login"); | 221 | aLoginProgress.showErrorMessage("failed login"); |
225 | // Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback'); | 222 | // Clipperz.NotificationCenter.register(loginProgress, 'cancelEvent', deferredResult, 'callback'); |
226 | MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback'); | 223 | MochiKit.Signal.connect(aLoginProgress, 'cancelEvent', deferredResult, 'callback'); |
227 | deferredResult.addCallback(MochiKit.Async.fail, anError) | 224 | deferredResult.addCallback(MochiKit.Async.fail, anError) |
228 | result = deferredResult; | 225 | result = deferredResult; |
229 | } | 226 | } |
@@ -232,18 +229,17 @@ MochiKit.Logging.logError("## MainController - FAILED LOGIN: " + anError); | |||
232 | }, | 229 | }, |
233 | 230 | ||
234 | 'handleGenericError': function(anError) { | 231 | 'handleGenericError': function(anError) { |
235 | var result; | 232 | var result; |
236 | 233 | ||
237 | if (anError instanceof MochiKit.Async.CancelledError) { | 234 | if (anError instanceof MochiKit.Async.CancelledError) { |
238 | result = anError; | 235 | result = anError; |
239 | } else { | 236 | } else { |
240 | MochiKit.Logging.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); | 237 | Clipperz.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); |
241 | //console.log(anError); | ||
242 | result = new MochiKit.Async.CancelledError(anError); | 238 | result = new MochiKit.Async.CancelledError(anError); |
243 | } | 239 | } |
244 | 240 | ||
245 | return result; | 241 | return result; |
246 | }, | 242 | }, |
247 | 243 | ||
248 | //----------------------------------------------------------------------------- | 244 | //----------------------------------------------------------------------------- |
249 | __syntaxFix__: "syntax fix" | 245 | __syntaxFix__: "syntax fix" |
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js index c83e3c0..9194125 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/MainController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.MainController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.MainController = function(args) { |
29 | this._args = args; | 27 | this._args = args; |
30 | 28 | ||
@@ -170,24 +168,18 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, { | |||
170 | this._passphraseDelegate = null; | 168 | this._passphraseDelegate = null; |
171 | this._passphraseDelegateLock.acquire(); | 169 | this._passphraseDelegateLock.acquire(); |
172 | } | 170 | } |
173 | }, | 171 | }, |
174 | 172 | ||
175 | //------------------------------------------------------------------------- | 173 | //------------------------------------------------------------------------- |
176 | 174 | ||
177 | 'loginControllerUserLoggedInCallback': function(anEvent) { | 175 | 'loginControllerUserLoggedInCallback': function(anEvent) { |
178 | //Clipperz.log(">>> loginControllerUserLoggedInCallback", anEvent); | ||
179 | // this.setUser(anEvent.parameters()['user']); | ||
180 | //console.log("--- loginControllerUserLoggedInCallback - 1"); | ||
181 | |||
182 | //console.log("--- loginControllerUserLoggedInCallback - 2"); | ||
183 | this.headerComponent().switchToLoggedMode(); | 176 | this.headerComponent().switchToLoggedMode(); |
184 | this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']}); | 177 | this.appController().run({slot:this.pageComponent().slotNamed('body'), user:anEvent['user']}); |
185 | //Clipperz.log("<<< loginControllerUserLoggedInCallback"); | ||
186 | }, | 178 | }, |
187 | 179 | ||
188 | //----------------------------------------------------------------------------- | 180 | //----------------------------------------------------------------------------- |
189 | 181 | ||
190 | 'handleRemoteRequestSent': function () { | 182 | 'handleRemoteRequestSent': function () { |
191 | //Clipperz.log("REMOTE REQUEST sent >>>"); | 183 | //Clipperz.log("REMOTE REQUEST sent >>>"); |
192 | }, | 184 | }, |
193 | 185 | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js index 7db6888..b70aa17 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) { |
29 | this._newUserCreationComponent = args.newUserCreationComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); | 27 | this._newUserCreationComponent = args.newUserCreationComponent|| Clipperz.Base.exception.raise('MandatoryParameter'); |
30 | 28 | ||
@@ -67,17 +65,16 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot | |||
67 | 65 | ||
68 | //----------------------------------------------------------------------------- | 66 | //----------------------------------------------------------------------------- |
69 | 67 | ||
70 | 'userCreationState': function () { | 68 | 'userCreationState': function () { |
71 | return this._userCreationState; | 69 | return this._userCreationState; |
72 | }, | 70 | }, |
73 | 71 | ||
74 | 'setUserCreationState': function (aValue) { | 72 | 'setUserCreationState': function (aValue) { |
75 | //console.log("+++ NewUserWizardController.setUserCreationState", aValue); | ||
76 | this._userCreationState = aValue; | 73 | this._userCreationState = aValue; |
77 | this.checkState(); | 74 | this.checkState(); |
78 | }, | 75 | }, |
79 | 76 | ||
80 | //============================================================================= | 77 | //============================================================================= |
81 | 78 | ||
82 | 'resetCurrentStepIndex': function () { | 79 | 'resetCurrentStepIndex': function () { |
83 | this._currentStepIndex = 0; | 80 | this._currentStepIndex = 0; |
@@ -217,26 +214,23 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot | |||
217 | this.newUserCreationComponent().enableCheckCredentialsPanel(); | 214 | this.newUserCreationComponent().enableCheckCredentialsPanel(); |
218 | 215 | ||
219 | enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase()); | 216 | enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase()); |
220 | // enablePrevious = true; | 217 | // enablePrevious = true; |
221 | break | 218 | break |
222 | case 'TERMS_OF_SERVICE': | 219 | case 'TERMS_OF_SERVICE': |
223 | this.newUserCreationComponent().enableTermsOfServicePanel(); | 220 | this.newUserCreationComponent().enableTermsOfServicePanel(); |
224 | 221 | ||
225 | //console.log("awareOfUnrecoverablePassphrase", this.newUserCreationComponent().awareOfUnrecoverablePassphrase()); | ||
226 | //console.log("readTermsOfService", this.newUserCreationComponent().readTermsOfService()); | ||
227 | enableNext = ( | 222 | enableNext = ( |
228 | (this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on') | 223 | (this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on') |
229 | && | 224 | && |
230 | (this.newUserCreationComponent().readTermsOfService() == 'on') | 225 | (this.newUserCreationComponent().readTermsOfService() == 'on') |
231 | ) | 226 | ) |
232 | break; | 227 | break; |
233 | case 'CREATE_USER': | 228 | case 'CREATE_USER': |
234 | //console.log(">>> CREATE_USER", this.userCreationState()); | ||
235 | this.newUserCreationComponent().enableCreateUserPanel(); | 229 | this.newUserCreationComponent().enableCreateUserPanel(); |
236 | 230 | ||
237 | switch (this.userCreationState()) { | 231 | switch (this.userCreationState()) { |
238 | case 'IDLE': | 232 | case 'IDLE': |
239 | this.setUserCreationState('IN PROGRESS'); | 233 | this.setUserCreationState('IN PROGRESS'); |
240 | this.preformActualUserRegistration(); | 234 | this.preformActualUserRegistration(); |
241 | 235 | ||
242 | enablePrevious = false; | 236 | enablePrevious = false; |
@@ -332,17 +326,16 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot | |||
332 | //============================================================================= | 326 | //============================================================================= |
333 | 327 | ||
334 | 'handleMoveBackward': function () { | 328 | 'handleMoveBackward': function () { |
335 | if (this._currentStepIndex > 0) { | 329 | if (this._currentStepIndex > 0) { |
336 | varafterMoveAction; | 330 | varafterMoveAction; |
337 | 331 | ||
338 | afterMoveAction = MochiKit.Base.noop; | 332 | afterMoveAction = MochiKit.Base.noop; |
339 | 333 | ||
340 | //console.log("<-- backward", this.currentStep()); | ||
341 | switch(this.currentStep()) { | 334 | switch(this.currentStep()) { |
342 | case 'CREDENTIALS': | 335 | case 'CREDENTIALS': |
343 | case 'CHECK_CREDENTIALS': | 336 | case 'CHECK_CREDENTIALS': |
344 | case 'TERMS_OF_SERVICE': | 337 | case 'TERMS_OF_SERVICE': |
345 | this._currentStepIndex --; | 338 | this._currentStepIndex --; |
346 | this.rulerComponent().moveBackward(afterMoveAction); | 339 | this.rulerComponent().moveBackward(afterMoveAction); |
347 | break; | 340 | break; |
348 | case 'CREATE_USER': | 341 | case 'CREATE_USER': |
@@ -401,17 +394,16 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot | |||
401 | 394 | ||
402 | 'handleChangedValue': function (anEvent) { | 395 | 'handleChangedValue': function (anEvent) { |
403 | this.checkState(); | 396 | this.checkState(); |
404 | }, | 397 | }, |
405 | 398 | ||
406 | //------------------------------------------------------------------------- | 399 | //------------------------------------------------------------------------- |
407 | 400 | ||
408 | 'handleNewUserCreationComponentKeyPressed': function (anEvent) { | 401 | 'handleNewUserCreationComponentKeyPressed': function (anEvent) { |
409 | //console.log(">>> handleNewUserCreationComponentKeyPressed", anEvent.key().string); | ||
410 | if (anEvent.key().string == 'KEY_ENTER') { | 402 | if (anEvent.key().string == 'KEY_ENTER') { |
411 | if (anEvent.target().nodeName != 'TEXTAREA') { | 403 | if (anEvent.target().nodeName != 'TEXTAREA') { |
412 | anEvent.preventDefault(); | 404 | anEvent.preventDefault(); |
413 | this.handleMoveForward(); | 405 | this.handleMoveForward(); |
414 | } | 406 | } |
415 | } else if (anEvent.key().string == 'KEY_TAB') { | 407 | } else if (anEvent.key().string == 'KEY_TAB') { |
416 | if (anEvent.target() == this.newUserCreationComponent().usernameElement()) { | 408 | if (anEvent.target() == this.newUserCreationComponent().usernameElement()) { |
417 | } else { | 409 | } else { |
diff --git a/frontend/gamma/js/Clipperz/Set.js b/frontend/gamma/js/Clipperz/Set.js index 7023888..b3831a4 100644 --- a/frontend/gamma/js/Clipperz/Set.js +++ b/frontend/gamma/js/Clipperz/Set.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | 24 | ||
27 | if (typeof(Clipperz) == 'undefined') { | 25 | if (typeof(Clipperz) == 'undefined') { |
28 | Clipperz = {}; | 26 | Clipperz = {}; |
29 | } | 27 | } |
30 | 28 | ||
diff --git a/frontend/gamma/js/Clipperz/Signal.js b/frontend/gamma/js/Clipperz/Signal.js index ca3e322..f9b74c9 100644 --- a/frontend/gamma/js/Clipperz/Signal.js +++ b/frontend/gamma/js/Clipperz/Signal.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Signal) == 'undefined') { Clipperz.Signal = {}; } | 25 | if (typeof(Clipperz.Signal) == 'undefined') { Clipperz.Signal = {}; } |
28 | 26 | ||
29 | Clipperz.Signal.VERSION = "0.1"; | 27 | Clipperz.Signal.VERSION = "0.1"; |
30 | Clipperz.Signal.NAME = "Clipperz.Signal"; | 28 | Clipperz.Signal.NAME = "Clipperz.Signal"; |
diff --git a/frontend/gamma/js/Clipperz/Style.js b/frontend/gamma/js/Clipperz/Style.js index d377893..acbe71b 100644 --- a/frontend/gamma/js/Clipperz/Style.js +++ b/frontend/gamma/js/Clipperz/Style.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Style) == 'undefined') { Clipperz.Style = {}; } | 25 | if (typeof(Clipperz.Style) == 'undefined') { Clipperz.Style = {}; } |
28 | 26 | ||
29 | Clipperz.Style.VERSION = "0.1"; | 27 | Clipperz.Style.VERSION = "0.1"; |
30 | Clipperz.Style.NAME = "Clipperz.DOM"; | 28 | Clipperz.Style.NAME = "Clipperz.DOM"; |
diff --git a/frontend/gamma/js/Clipperz/Visual.js b/frontend/gamma/js/Clipperz/Visual.js index c2da3b7..93ed725 100644 --- a/frontend/gamma/js/Clipperz/Visual.js +++ b/frontend/gamma/js/Clipperz/Visual.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.Visual) == 'undefined') { Clipperz.Visual = {}; } | 25 | if (typeof(Clipperz.Visual) == 'undefined') { Clipperz.Visual = {}; } |
28 | 26 | ||
29 | Clipperz.Visual.VERSION = "0.1"; | 27 | Clipperz.Visual.VERSION = "0.1"; |
30 | Clipperz.Visual.NAME = "Clipperz.Visual"; | 28 | Clipperz.Visual.NAME = "Clipperz.Visual"; |
diff --git a/frontend/gamma/js/Clipperz/YUI/DomHelper.js b/frontend/gamma/js/Clipperz/YUI/DomHelper.js index 87c74f5..0a1f9fe 100644 --- a/frontend/gamma/js/Clipperz/YUI/DomHelper.js +++ b/frontend/gamma/js/Clipperz/YUI/DomHelper.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } | 25 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
28 | 26 | ||
29 | 27 | ||
30 | /** | 28 | /** |
@@ -435,28 +433,23 @@ Clipperz.YUI.DomHelper.Template.prototype = { | |||
435 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) | 433 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) |
436 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element | 434 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element |
437 | * @return {HTMLElement} The new node | 435 | * @return {HTMLElement} The new node |
438 | */ | 436 | */ |
439 | append : function(el, values, returnElement){ | 437 | append : function(el, values, returnElement){ |
440 | var sanitizedValues; | 438 | var sanitizedValues; |
441 | var key; | 439 | var key; |
442 | 440 | ||
443 | // sanitizedValues = MochiKit.Base.map(sanitizedValues) | ||
444 | //console.log("values", values); | ||
445 | sanitizedValues = {}; | 441 | sanitizedValues = {}; |
446 | for (key in values) { | 442 | for (key in values) { |
447 | sanitizedValues[key] = Clipperz.Base.sanitizeString(values[key]); | 443 | sanitizedValues[key] = Clipperz.Base.sanitizeString(values[key]); |
448 | } | 444 | } |
449 | //console.log("sanitizedValues", sanitizedValues); | ||
450 | // el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | ||
451 | el = (typeof el == 'string') ? YAHOO.util.Dom.get(el) : el; | 445 | el = (typeof el == 'string') ? YAHOO.util.Dom.get(el) : el; |
452 | //Clipperz.log(this.applyTemplate(sanitizedValues)); | ||
453 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(sanitizedValues)); | 446 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(sanitizedValues)); |
454 | // return returnElement ? YAHOO.Element.get(newNode, true) : newNode; | 447 | |
455 | return newNode; | 448 | return newNode; |
456 | }, | 449 | }, |
457 | 450 | ||
458 | /** | 451 | /** |
459 | * Applies the supplied values to the template and overwrites the content of el with the new node(s) | 452 | * Applies the supplied values to the template and overwrites the content of el with the new node(s) |
460 | * @param {String/HTMLElement/Element} el The context element | 453 | * @param {String/HTMLElement/Element} el The context element |
461 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) | 454 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) |
462 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element | 455 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element |
diff --git a/frontend/gamma/js/Clipperz/YUI/DomQuery.js b/frontend/gamma/js/Clipperz/YUI/DomQuery.js index 76d0fae..c1af0ca 100644 --- a/frontend/gamma/js/Clipperz/YUI/DomQuery.js +++ b/frontend/gamma/js/Clipperz/YUI/DomQuery.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } | 25 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
28 | 26 | ||
29 | 27 | ||
30 | /* | 28 | /* |
diff --git a/frontend/gamma/js/Clipperz/YUI/Utils.js b/frontend/gamma/js/Clipperz/YUI/Utils.js index e9929fc..4def842 100644 --- a/frontend/gamma/js/Clipperz/YUI/Utils.js +++ b/frontend/gamma/js/Clipperz/YUI/Utils.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof YAHOO == 'undefined') { YAHOO = {}; }; | 24 | if (typeof YAHOO == 'undefined') { YAHOO = {}; }; |
27 | if (typeof YAHOO.util == 'undefined') { YAHOO.util = {}; }; | 25 | if (typeof YAHOO.util == 'undefined') { YAHOO.util = {}; }; |
28 | if (typeof YAHOO.util.Dom == 'undefined') { YAHOO.util.Dom = {}; }; | 26 | if (typeof YAHOO.util.Dom == 'undefined') { YAHOO.util.Dom = {}; }; |
29 | 27 | ||
30 | YAHOO.extend = function(subc, superc, overrides) { | 28 | YAHOO.extend = function(subc, superc, overrides) { |
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/AES.js b/frontend/gamma/js/ClipperzCryptoLibrary/AES.js new file mode 100644 index 0000000..cbbbb13 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/AES.js | |||
@@ -0,0 +1,864 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!"; | ||
26 | } | ||
27 | |||
28 | //Dependency commented to avoid a circular reference | ||
29 | //try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { | ||
30 | //throw "Clipperz.Crypto.AES depends on Clipperz.Crypto.PRNG!"; | ||
31 | //} | ||
32 | |||
33 | if (typeof(Clipperz.Crypto.AES) == 'undefined') { Clipperz.Crypto.AES = {}; } | ||
34 | |||
35 | //############################################################################# | ||
36 | |||
37 | Clipperz.Crypto.AES.DeferredExecutionContext = function(args) { | ||
38 | args = args || {}; | ||
39 | |||
40 | this._key = args.key; | ||
41 | this._message = args.message; | ||
42 | this._result = args.message.clone(); | ||
43 | this._nonce = args.nonce; | ||
44 | this._messageLength = this._message.length(); | ||
45 | |||
46 | this._messageArray = this._message.arrayValues(); | ||
47 | this._resultArray = this._result.arrayValues(); | ||
48 | this._nonceArray = this._nonce.arrayValues(); | ||
49 | |||
50 | this._executionStep = 0; | ||
51 | |||
52 | // this._elaborationChunkSize = 1024; // 4096; // 16384; //4096; | ||
53 | this._elaborationChunks = 10; | ||
54 | this._pauseTime = 0.02; // 0.02 //0.2; | ||
55 | |||
56 | return this; | ||
57 | } | ||
58 | |||
59 | Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(null, { | ||
60 | |||
61 | 'key': function() { | ||
62 | return this._key; | ||
63 | }, | ||
64 | |||
65 | 'message': function() { | ||
66 | return this._message; | ||
67 | }, | ||
68 | |||
69 | 'messageLength': function() { | ||
70 | return this._messageLength; | ||
71 | }, | ||
72 | |||
73 | 'result': function() { | ||
74 | return new Clipperz.ByteArray(this.resultArray()); | ||
75 | }, | ||
76 | |||
77 | 'nonce': function() { | ||
78 | return this._nonce; | ||
79 | }, | ||
80 | |||
81 | 'messageArray': function() { | ||
82 | return this._messageArray; | ||
83 | }, | ||
84 | |||
85 | 'resultArray': function() { | ||
86 | return this._resultArray; | ||
87 | }, | ||
88 | |||
89 | 'nonceArray': function() { | ||
90 | return this._nonceArray; | ||
91 | }, | ||
92 | |||
93 | 'elaborationChunkSize': function() { | ||
94 | // return Clipperz.Crypto.AES.DeferredExecution.chunkSize; | ||
95 | // return this._elaborationChunkSize; | ||
96 | return (this._elaborationChunks * 1024); | ||
97 | }, | ||
98 | |||
99 | 'executionStep': function() { | ||
100 | return this._executionStep; | ||
101 | }, | ||
102 | |||
103 | 'setExecutionStep': function(aValue) { | ||
104 | this._executionStep = aValue; | ||
105 | }, | ||
106 | |||
107 | 'tuneExecutionParameters': function (anElapsedTime) { | ||
108 | //var originalChunks = this._elaborationChunks; | ||
109 | if (anElapsedTime > 0) { | ||
110 | this._elaborationChunks = Math.round(this._elaborationChunks * ((anElapsedTime + 1000)/(anElapsedTime * 2))); | ||
111 | } | ||
112 | //Clipperz.log("tuneExecutionParameters - elapsedTime: " + anElapsedTime + /*originalChunks,*/ " chunks # " + this._elaborationChunks + " [" + this._executionStep + " / " + this._messageLength + "]"); | ||
113 | }, | ||
114 | |||
115 | 'pause': function(aValue) { | ||
116 | // return MochiKit.Async.wait(Clipperz.Crypto.AES.DeferredExecution.pauseTime, aValue); | ||
117 | return MochiKit.Async.wait(this._pauseTime, aValue); | ||
118 | }, | ||
119 | |||
120 | 'isDone': function () { | ||
121 | //console.log("isDone", this.executionStep(), this.messageLength()); | ||
122 | return (this._executionStep >= this._messageLength); | ||
123 | }, | ||
124 | |||
125 | //----------------------------------------------------------------------------- | ||
126 | __syntaxFix__: "syntax fix" | ||
127 | |||
128 | }); | ||
129 | |||
130 | //############################################################################# | ||
131 | |||
132 | Clipperz.Crypto.AES.Key = function(args) { | ||
133 | args = args || {}; | ||
134 | |||
135 | this._key = args.key; | ||
136 | this._keySize = args.keySize || this.key().length(); | ||
137 | |||
138 | if (this.keySize() == 128/8) { | ||
139 | this._b = 176; | ||
140 | this._numberOfRounds = 10; | ||
141 | } else if (this.keySize() == 256/8) { | ||
142 | this._b = 240; | ||
143 | this._numberOfRounds = 14; | ||
144 | } else { | ||
145 | MochiKit.Logging.logError("AES unsupported key size: " + (this.keySize() * 8) + " bits"); | ||
146 | throw Clipperz.Crypto.AES.exception.UnsupportedKeySize; | ||
147 | } | ||
148 | |||
149 | this._stretchedKey = null; | ||
150 | |||
151 | return this; | ||
152 | } | ||
153 | |||
154 | Clipperz.Crypto.AES.Key.prototype = MochiKit.Base.update(null, { | ||
155 | |||
156 | 'asString': function() { | ||
157 | return "Clipperz.Crypto.AES.Key (" + this.key().toHexString() + ")"; | ||
158 | }, | ||
159 | |||
160 | //----------------------------------------------------------------------------- | ||
161 | |||
162 | 'key': function() { | ||
163 | return this._key; | ||
164 | }, | ||
165 | |||
166 | 'keySize': function() { | ||
167 | return this._keySize; | ||
168 | }, | ||
169 | |||
170 | 'b': function() { | ||
171 | return this._b; | ||
172 | }, | ||
173 | |||
174 | 'numberOfRounds': function() { | ||
175 | return this._numberOfRounds; | ||
176 | }, | ||
177 | //========================================================================= | ||
178 | |||
179 | 'keyScheduleCore': function(aWord, aRoundConstantsIndex) { | ||
180 | varresult; | ||
181 | var sbox; | ||
182 | |||
183 | sbox = Clipperz.Crypto.AES.sbox(); | ||
184 | |||
185 | result = [sbox[aWord[1]] ^ Clipperz.Crypto.AES.roundConstants()[aRoundConstantsIndex], | ||
186 | sbox[aWord[2]], | ||
187 | sbox[aWord[3]], | ||
188 | sbox[aWord[0]]]; | ||
189 | |||
190 | return result; | ||
191 | }, | ||
192 | |||
193 | //----------------------------------------------------------------------------- | ||
194 | |||
195 | 'xorWithPreviousStretchValues': function(aKey, aWord, aPreviousWordIndex) { | ||
196 | varresult; | ||
197 | var i,c; | ||
198 | |||
199 | result = []; | ||
200 | c = 4; | ||
201 | for (i=0; i<c; i++) { | ||
202 | result[i] = aWord[i] ^ aKey.byteAtIndex(aPreviousWordIndex + i); | ||
203 | } | ||
204 | |||
205 | return result; | ||
206 | }, | ||
207 | |||
208 | //----------------------------------------------------------------------------- | ||
209 | |||
210 | 'sboxShakeup': function(aWord) { | ||
211 | var result; | ||
212 | var sbox; | ||
213 | var i,c; | ||
214 | |||
215 | result = []; | ||
216 | sbox = Clipperz.Crypto.AES.sbox(); | ||
217 | c =4; | ||
218 | for (i=0; i<c; i++) { | ||
219 | result[i] = sbox[aWord[i]]; | ||
220 | } | ||
221 | |||
222 | return result; | ||
223 | }, | ||
224 | |||
225 | //----------------------------------------------------------------------------- | ||
226 | |||
227 | 'stretchKey': function(aKey) { | ||
228 | varcurrentWord; | ||
229 | varkeyLength; | ||
230 | varpreviousStretchIndex; | ||
231 | var i,c; | ||
232 | |||
233 | keyLength = aKey.length(); | ||
234 | previousStretchIndex = keyLength - this.keySize(); | ||
235 | |||
236 | currentWord = [aKey.byteAtIndex(keyLength - 4), | ||
237 | aKey.byteAtIndex(keyLength - 3), | ||
238 | aKey.byteAtIndex(keyLength - 2), | ||
239 | aKey.byteAtIndex(keyLength - 1)]; | ||
240 | currentWord = this.keyScheduleCore(currentWord, keyLength / this.keySize()); | ||
241 | |||
242 | if (this.keySize() == 256/8) { | ||
243 | c = 8; | ||
244 | } else if (this.keySize() == 128/8){ | ||
245 | c = 4; | ||
246 | } | ||
247 | |||
248 | for (i=0; i<c; i++) { | ||
249 | if (i == 4) { | ||
250 | //fifth streatch word | ||
251 | currentWord = this.sboxShakeup(currentWord); | ||
252 | } | ||
253 | |||
254 | currentWord = this.xorWithPreviousStretchValues(aKey, currentWord, previousStretchIndex + (i*4)); | ||
255 | aKey.appendBytes(currentWord); | ||
256 | } | ||
257 | |||
258 | return aKey; | ||
259 | }, | ||
260 | |||
261 | //----------------------------------------------------------------------------- | ||
262 | |||
263 | 'stretchedKey': function() { | ||
264 | if (this._stretchedKey == null) { | ||
265 | var stretchedKey; | ||
266 | |||
267 | stretchedKey = this.key().clone(); | ||
268 | |||
269 | while (stretchedKey.length() < this.keySize()) { | ||
270 | stretchedKey.appendByte(0); | ||
271 | } | ||
272 | |||
273 | while (stretchedKey.length() < this.b()) { | ||
274 | stretchedKey = this.stretchKey(stretchedKey); | ||
275 | } | ||
276 | |||
277 | this._stretchedKey = stretchedKey.split(0, this.b()); | ||
278 | } | ||
279 | |||
280 | return this._stretchedKey; | ||
281 | }, | ||
282 | |||
283 | //========================================================================= | ||
284 | __syntaxFix__: "syntax fix" | ||
285 | }); | ||
286 | |||
287 | //############################################################################# | ||
288 | |||
289 | Clipperz.Crypto.AES.State = function(args) { | ||
290 | args = args || {}; | ||
291 | |||
292 | this._data = args.block; | ||
293 | this._key = args.key; | ||
294 | |||
295 | return this; | ||
296 | } | ||
297 | |||
298 | Clipperz.Crypto.AES.State.prototype = MochiKit.Base.update(null, { | ||
299 | |||
300 | 'key': function() { | ||
301 | return this._key; | ||
302 | }, | ||
303 | |||
304 | //----------------------------------------------------------------------------- | ||
305 | |||
306 | 'data': function() { | ||
307 | return this._data; | ||
308 | }, | ||
309 | |||
310 | 'setData': function(aValue) { | ||
311 | this._data = aValue; | ||
312 | }, | ||
313 | |||
314 | //========================================================================= | ||
315 | |||
316 | 'addRoundKey': function(aRoundNumber) { | ||
317 | //each byte of the state is combined with the round key; each round key is derived from the cipher key using a key schedule. | ||
318 | vardata; | ||
319 | varstretchedKey; | ||
320 | varfirstStretchedKeyIndex; | ||
321 | var i,c; | ||
322 | |||
323 | data = this.data(); | ||
324 | stretchedKey = this.key().stretchedKey(); | ||
325 | firstStretchedKeyIndex = aRoundNumber * (128/8); | ||
326 | c = 128/8; | ||
327 | for (i=0; i<c; i++) { | ||
328 | data[i] = data[i] ^ stretchedKey.byteAtIndex(firstStretchedKeyIndex + i); | ||
329 | } | ||
330 | }, | ||
331 | |||
332 | //----------------------------------------------------------------------------- | ||
333 | |||
334 | 'subBytes': function() { | ||
335 | // a non-linear substitution step where each byte is replaced with another according to a lookup table. | ||
336 | var i,c; | ||
337 | vardata; | ||
338 | var sbox; | ||
339 | |||
340 | data = this.data(); | ||
341 | sbox = Clipperz.Crypto.AES.sbox(); | ||
342 | |||
343 | c = 16; | ||
344 | for (i=0; i<c; i++) { | ||
345 | data[i] = sbox[data[i]]; | ||
346 | } | ||
347 | }, | ||
348 | |||
349 | //----------------------------------------------------------------------------- | ||
350 | |||
351 | 'shiftRows': function() { | ||
352 | //a transposition step where each row of the state is shifted cyclically a certain number of steps. | ||
353 | varnewValue; | ||
354 | vardata; | ||
355 | varshiftMapping; | ||
356 | vari,c; | ||
357 | |||
358 | newValue = new Array(16); | ||
359 | data = this.data(); | ||
360 | shiftMapping = Clipperz.Crypto.AES.shiftRowMapping(); | ||
361 | // [0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11]; | ||
362 | c = 16; | ||
363 | for (i=0; i<c; i++) { | ||
364 | newValue[i] = data[shiftMapping[i]]; | ||
365 | } | ||
366 | for (i=0; i<c; i++) { | ||
367 | data[i] = newValue[i]; | ||
368 | } | ||
369 | }, | ||
370 | |||
371 | //----------------------------------------------------------------------------- | ||
372 | /* | ||
373 | 'mixColumnsWithValues': function(someValues) { | ||
374 | varresult; | ||
375 | vara; | ||
376 | var i,c; | ||
377 | |||
378 | c = 4; | ||
379 | result = []; | ||
380 | a = []; | ||
381 | for (i=0; i<c; i++) { | ||
382 | a[i] = []; | ||
383 | a[i][1] = someValues[i] | ||
384 | if ((a[i][1] & 0x80) == 0x80) { | ||
385 | a[i][2] = (a[i][1] << 1) ^ 0x11b; | ||
386 | } else { | ||
387 | a[i][2] = a[i][1] << 1; | ||
388 | } | ||
389 | |||
390 | a[i][3] = a[i][2] ^ a[i][1]; | ||
391 | } | ||
392 | |||
393 | for (i=0; i<c; i++) { | ||
394 | varx; | ||
395 | |||
396 | x = Clipperz.Crypto.AES.mixColumnsMatrix()[i]; | ||
397 | result[i] = a[0][x[0]] ^ a[1][x[1]] ^ a[2][x[2]] ^ a[3][x[3]]; | ||
398 | } | ||
399 | |||
400 | return result; | ||
401 | }, | ||
402 | |||
403 | 'mixColumns': function() { | ||
404 | //a mixing operation which operates on the columns of the state, combining the four bytes in each column using a linear transformation. | ||
405 | var data; | ||
406 | var i, c; | ||
407 | |||
408 | data = this.data(); | ||
409 | c = 4; | ||
410 | for(i=0; i<c; i++) { | ||
411 | varblockIndex; | ||
412 | var mixedValues; | ||
413 | |||
414 | blockIndex = i * 4; | ||
415 | mixedValues = this.mixColumnsWithValues([data[blockIndex + 0], | ||
416 | data[blockIndex + 1], | ||
417 | data[blockIndex + 2], | ||
418 | data[blockIndex + 3]]); | ||
419 | data[blockIndex + 0] = mixedValues[0]; | ||
420 | data[blockIndex + 1] = mixedValues[1]; | ||
421 | data[blockIndex + 2] = mixedValues[2]; | ||
422 | data[blockIndex + 3] = mixedValues[3]; | ||
423 | } | ||
424 | }, | ||
425 | */ | ||
426 | |||
427 | 'mixColumns': function() { | ||
428 | //a mixing operation which operates on the columns of the state, combining the four bytes in each column using a linear transformation. | ||
429 | var data; | ||
430 | var i, c; | ||
431 | var a_1; | ||
432 | var a_2; | ||
433 | |||
434 | a_1 = new Array(4); | ||
435 | a_2 = new Array(4); | ||
436 | |||
437 | data = this.data(); | ||
438 | c = 4; | ||
439 | for(i=0; i<c; i++) { | ||
440 | varblockIndex; | ||
441 | var ii, cc; | ||
442 | |||
443 | blockIndex = i * 4; | ||
444 | |||
445 | cc = 4; | ||
446 | for (ii=0; ii<cc; ii++) { | ||
447 | var value; | ||
448 | |||
449 | value = data[blockIndex + ii]; | ||
450 | a_1[ii] = value; | ||
451 | a_2[ii] = (value & 0x80) ? ((value << 1) ^ 0x011b) : (value << 1); | ||
452 | } | ||
453 | |||
454 | data[blockIndex + 0] = a_2[0] ^ a_1[1] ^ a_2[1] ^ a_1[2] ^ a_1[3]; | ||
455 | data[blockIndex + 1] = a_1[0] ^ a_2[1] ^ a_1[2] ^ a_2[2] ^ a_1[3]; | ||
456 | data[blockIndex + 2] = a_1[0] ^ a_1[1] ^ a_2[2] ^ a_1[3] ^ a_2[3]; | ||
457 | data[blockIndex + 3] = a_1[0] ^ a_2[0] ^ a_1[1] ^ a_1[2] ^ a_2[3]; | ||
458 | } | ||
459 | }, | ||
460 | |||
461 | //========================================================================= | ||
462 | |||
463 | 'spinRound': function(aRoundNumber) { | ||
464 | this.addRoundKey(aRoundNumber); | ||
465 | this.subBytes(); | ||
466 | this.shiftRows(); | ||
467 | this.mixColumns(); | ||
468 | }, | ||
469 | |||
470 | 'spinLastRound': function() { | ||
471 | this.addRoundKey(this.key().numberOfRounds() - 1); | ||
472 | this.subBytes(); | ||
473 | this.shiftRows(); | ||
474 | this.addRoundKey(this.key().numberOfRounds()); | ||
475 | }, | ||
476 | |||
477 | //========================================================================= | ||
478 | |||
479 | 'encrypt': function() { | ||
480 | vari,c; | ||
481 | |||
482 | c = this.key().numberOfRounds() - 1; | ||
483 | for (i=0; i<c; i++) { | ||
484 | this.spinRound(i); | ||
485 | } | ||
486 | |||
487 | this.spinLastRound(); | ||
488 | }, | ||
489 | |||
490 | //========================================================================= | ||
491 | __syntaxFix__: "syntax fix" | ||
492 | }); | ||
493 | |||
494 | //############################################################################# | ||
495 | |||
496 | Clipperz.Crypto.AES.VERSION = "0.1"; | ||
497 | Clipperz.Crypto.AES.NAME = "Clipperz.Crypto.AES"; | ||
498 | |||
499 | MochiKit.Base.update(Clipperz.Crypto.AES, { | ||
500 | |||
501 | //http://www.cs.eku.edu/faculty/styer/460/Encrypt/JS-AES.html | ||
502 | //http://en.wikipedia.org/wiki/Advanced_Encryption_Standard | ||
503 | //http://en.wikipedia.org/wiki/Rijndael_key_schedule | ||
504 | //http://en.wikipedia.org/wiki/Rijndael_S-box | ||
505 | |||
506 | '__repr__': function () { | ||
507 | return "[" + this.NAME + " " + this.VERSION + "]"; | ||
508 | }, | ||
509 | |||
510 | 'toString': function () { | ||
511 | return this.__repr__(); | ||
512 | }, | ||
513 | |||
514 | //============================================================================= | ||
515 | |||
516 | '_sbox': null, | ||
517 | 'sbox': function() { | ||
518 | if (Clipperz.Crypto.AES._sbox == null) { | ||
519 | Clipperz.Crypto.AES._sbox = [ | ||
520 | 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, | ||
521 | 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, | ||
522 | 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, | ||
523 | 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, | ||
524 | 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, | ||
525 | 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, | ||
526 | 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, | ||
527 | 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, | ||
528 | 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, | ||
529 | 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, | ||
530 | 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, | ||
531 | 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, | ||
532 | 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, | ||
533 | 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, | ||
534 | 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, | ||
535 | 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 | ||
536 | ]; | ||
537 | } | ||
538 | |||
539 | return Clipperz.Crypto.AES._sbox; | ||
540 | }, | ||
541 | |||
542 | //----------------------------------------------------------------------------- | ||
543 | // | ||
544 | // 0 4 8 12 0 4 812 | ||
545 | // 1 5 9 13 => 5 9 131 | ||
546 | // 2 6 10 14 10 14 26 | ||
547 | // 3 7 11 15 15 3 711 | ||
548 | // | ||
549 | '_shiftRowMapping': null, | ||
550 | 'shiftRowMapping': function() { | ||
551 | if (Clipperz.Crypto.AES._shiftRowMapping == null) { | ||
552 | Clipperz.Crypto.AES._shiftRowMapping = [0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11]; | ||
553 | } | ||
554 | |||
555 | return Clipperz.Crypto.AES._shiftRowMapping; | ||
556 | }, | ||
557 | |||
558 | //----------------------------------------------------------------------------- | ||
559 | |||
560 | '_mixColumnsMatrix': null, | ||
561 | 'mixColumnsMatrix': function() { | ||
562 | if (Clipperz.Crypto.AES._mixColumnsMatrix == null) { | ||
563 | Clipperz.Crypto.AES._mixColumnsMatrix = [[2, 3, 1 ,1], | ||
564 | [1, 2, 3, 1], | ||
565 | [1, 1, 2, 3], | ||
566 | [3, 1, 1, 2] ]; | ||
567 | } | ||
568 | |||
569 | return Clipperz.Crypto.AES._mixColumnsMatrix; | ||
570 | }, | ||
571 | |||
572 | '_roundConstants': null, | ||
573 | 'roundConstants': function() { | ||
574 | if (Clipperz.Crypto.AES._roundConstants == null) { | ||
575 | Clipperz.Crypto.AES._roundConstants = [ , 1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154]; | ||
576 | // Clipperz.Crypto.AES._roundConstants = [ , 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a]; | ||
577 | } | ||
578 | |||
579 | return Clipperz.Crypto.AES._roundConstants; | ||
580 | }, | ||
581 | |||
582 | //============================================================================= | ||
583 | |||
584 | 'incrementNonce': function(aNonce) { | ||
585 | //Clipperz.Profile.start("Clipperz.Crypto.AES.incrementNonce"); | ||
586 | var i; | ||
587 | var done; | ||
588 | |||
589 | done = false; | ||
590 | i = aNonce.length - 1; | ||
591 | |||
592 | while ((i>=0) && (done == false)) { | ||
593 | var currentByteValue; | ||
594 | |||
595 | currentByteValue = aNonce[i]; | ||
596 | |||
597 | if (currentByteValue == 0xff) { | ||
598 | aNonce[i] = 0; | ||
599 | if (i>= 0) { | ||
600 | i --; | ||
601 | } else { | ||
602 | done = true; | ||
603 | } | ||
604 | } else { | ||
605 | aNonce[i] = currentByteValue + 1; | ||
606 | done = true; | ||
607 | } | ||
608 | } | ||
609 | //Clipperz.Profile.stop("Clipperz.Crypto.AES.incrementNonce"); | ||
610 | }, | ||
611 | |||
612 | //----------------------------------------------------------------------------- | ||
613 | |||
614 | 'encryptBlock': function(aKey, aBlock) { | ||
615 | varresult; | ||
616 | varstate; | ||
617 | |||
618 | state = new Clipperz.Crypto.AES.State({block:aBlock, key:aKey}); | ||
619 | //is(state.data(), 'before'); | ||
620 | state.encrypt(); | ||
621 | result = state.data(); | ||
622 | |||
623 | return result; | ||
624 | }, | ||
625 | |||
626 | //----------------------------------------------------------------------------- | ||
627 | |||
628 | 'encryptBlocks': function(aKey, aMessage, aNonce) { | ||
629 | varresult; | ||
630 | var nonce; | ||
631 | var self; | ||
632 | varmessageIndex; | ||
633 | varmessageLength; | ||
634 | var blockSize; | ||
635 | |||
636 | self = Clipperz.Crypto.AES; | ||
637 | blockSize = 128/8; | ||
638 | messageLength = aMessage.length; | ||
639 | nonce = aNonce; | ||
640 | |||
641 | result = aMessage; | ||
642 | messageIndex = 0; | ||
643 | while (messageIndex < messageLength) { | ||
644 | var encryptedBlock; | ||
645 | var i,c; | ||
646 | |||
647 | self.incrementNonce(nonce); | ||
648 | encryptedBlock = self.encryptBlock(aKey, nonce); | ||
649 | |||
650 | if ((messageLength - messageIndex) > blockSize) { | ||
651 | c = blockSize; | ||
652 | } else { | ||
653 | c = messageLength - messageIndex; | ||
654 | } | ||
655 | |||
656 | for (i=0; i<c; i++) { | ||
657 | result[messageIndex + i] = result[messageIndex + i] ^ encryptedBlock[i]; | ||
658 | } | ||
659 | |||
660 | messageIndex += blockSize; | ||
661 | } | ||
662 | |||
663 | return result; | ||
664 | }, | ||
665 | |||
666 | //----------------------------------------------------------------------------- | ||
667 | |||
668 | 'encrypt': function(aKey, someData, aNonce) { | ||
669 | var result; | ||
670 | var nonce; | ||
671 | varencryptedData; | ||
672 | var key; | ||
673 | |||
674 | key = new Clipperz.Crypto.AES.Key({key:aKey}); | ||
675 | nonce = aNonce ? aNonce.clone() : Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(128/8); | ||
676 | |||
677 | encryptedData = Clipperz.Crypto.AES.encryptBlocks(key, someData.arrayValues(), nonce.arrayValues()); | ||
678 | |||
679 | result = nonce.appendBytes(encryptedData); | ||
680 | |||
681 | return result; | ||
682 | }, | ||
683 | |||
684 | //----------------------------------------------------------------------------- | ||
685 | |||
686 | 'decrypt': function(aKey, someData) { | ||
687 | var result; | ||
688 | var nonce; | ||
689 | var encryptedData; | ||
690 | var decryptedData; | ||
691 | vardataIterator; | ||
692 | var key; | ||
693 | |||
694 | key = new Clipperz.Crypto.AES.Key({key:aKey}); | ||
695 | |||
696 | encryptedData = someData.arrayValues(); | ||
697 | nonce = encryptedData.slice(0, (128/8)); | ||
698 | encryptedData = encryptedData.slice(128/8); | ||
699 | decryptedData = Clipperz.Crypto.AES.encryptBlocks(key, encryptedData, nonce); | ||
700 | |||
701 | result = new Clipperz.ByteArray(decryptedData); | ||
702 | |||
703 | return result; | ||
704 | }, | ||
705 | |||
706 | //============================================================================= | ||
707 | |||
708 | 'deferredEncryptExecutionChunk': function(anExecutionContext) { | ||
709 | varresult; | ||
710 | var nonce; | ||
711 | var self; | ||
712 | varmessageIndex; | ||
713 | varmessageLength; | ||
714 | var blockSize; | ||
715 | var executionLimit; | ||
716 | var startTime, endTime; | ||
717 | |||
718 | self = Clipperz.Crypto.AES; | ||
719 | startTime = new Date(); | ||
720 | blockSize = 128/8; | ||
721 | messageLength = anExecutionContext.messageArray().length; | ||
722 | nonce = anExecutionContext.nonceArray(); | ||
723 | result = anExecutionContext.resultArray(); | ||
724 | |||
725 | messageIndex = anExecutionContext.executionStep(); | ||
726 | executionLimit = messageIndex + anExecutionContext.elaborationChunkSize(); | ||
727 | executionLimit = Math.min(executionLimit, messageLength); | ||
728 | |||
729 | while (messageIndex < executionLimit) { | ||
730 | var encryptedBlock; | ||
731 | var i,c; | ||
732 | |||
733 | self.incrementNonce(nonce); | ||
734 | encryptedBlock = self.encryptBlock(anExecutionContext.key(), nonce); | ||
735 | |||
736 | if ((executionLimit - messageIndex) > blockSize) { | ||
737 | c = blockSize; | ||
738 | } else { | ||
739 | c = executionLimit - messageIndex; | ||
740 | } | ||
741 | |||
742 | for (i=0; i<c; i++) { | ||
743 | result[messageIndex + i] = result[messageIndex + i] ^ encryptedBlock[i]; | ||
744 | } | ||
745 | |||
746 | messageIndex += blockSize; | ||
747 | } | ||
748 | anExecutionContext.setExecutionStep(messageIndex); | ||
749 | endTime = new Date(); | ||
750 | anExecutionContext.tuneExecutionParameters(endTime - startTime); | ||
751 | |||
752 | return anExecutionContext; | ||
753 | }, | ||
754 | |||
755 | //----------------------------------------------------------------------------- | ||
756 | /* | ||
757 | 'deferredEncryptBlocks': function(anExecutionContext) { | ||
758 | vardeferredResult; | ||
759 | varmessageSize; | ||
760 | var i,c; | ||
761 | |||
762 | messageSize = anExecutionContext.messageLength(); | ||
763 | |||
764 | deferredResult = new Clipperz.Async.Deferred("AES.deferredEncryptBloks"); | ||
765 | |||
766 | c = Math.ceil(messageSize / anExecutionContext.elaborationChunkSize()); | ||
767 | for (i=0; i<c; i++) { | ||
768 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptExecutionChunk); | ||
769 | deferredResult.addMethod(anExecutionContext, 'pause'); | ||
770 | } | ||
771 | |||
772 | deferredResult.callback(anExecutionContext); | ||
773 | |||
774 | return deferredResult; | ||
775 | }, | ||
776 | */ | ||
777 | |||
778 | 'deferredEncryptBlocks': function(anExecutionContext) { | ||
779 | vardeferredResult; | ||
780 | |||
781 | if (! anExecutionContext.isDone()) { | ||
782 | deferredResult = Clipperz.Async.callbacks("Clipperz.Crypto.AES.deferredEncryptBloks", [ | ||
783 | Clipperz.Crypto.AES.deferredEncryptExecutionChunk, | ||
784 | MochiKit.Base.method(anExecutionContext, 'pause'), | ||
785 | Clipperz.Crypto.AES.deferredEncryptBlocks | ||
786 | ], {trace:false}, anExecutionContext); | ||
787 | } else { | ||
788 | deferredResult = MochiKit.Async.succeed(anExecutionContext); | ||
789 | } | ||
790 | |||
791 | return deferredResult; | ||
792 | }, | ||
793 | |||
794 | //----------------------------------------------------------------------------- | ||
795 | |||
796 | 'deferredEncrypt': function(aKey, someData, aNonce) { | ||
797 | var deferredResult; | ||
798 | varexecutionContext; | ||
799 | var result; | ||
800 | var nonce; | ||
801 | var key; | ||
802 | |||
803 | key = new Clipperz.Crypto.AES.Key({key:aKey}); | ||
804 | nonce = aNonce ? aNonce.clone() : Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(128/8); | ||
805 | |||
806 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:someData, nonce:nonce}); | ||
807 | |||
808 | deferredResult = new Clipperz.Async.Deferred("AES.deferredEncrypt"); | ||
809 | //deferredResult.addCallback(function (aValue) { console.log(">>> deferredEncrypt"); return aValue; }); | ||
810 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); | ||
811 | deferredResult.addCallback(function(anExecutionContext) { | ||
812 | var result; | ||
813 | |||
814 | result = anExecutionContext.nonce().clone(); | ||
815 | result.appendBytes(anExecutionContext.resultArray()); | ||
816 | |||
817 | return result; | ||
818 | }); | ||
819 | //deferredResult.addCallback(function (aValue) { console.log("<<< deferredEncrypt"); return aValue; }); | ||
820 | deferredResult.callback(executionContext) | ||
821 | |||
822 | return deferredResult; | ||
823 | }, | ||
824 | |||
825 | //----------------------------------------------------------------------------- | ||
826 | |||
827 | 'deferredDecrypt': function(aKey, someData) { | ||
828 | var deferredResult | ||
829 | var nonce; | ||
830 | var message; | ||
831 | var key; | ||
832 | |||
833 | key = new Clipperz.Crypto.AES.Key({key:aKey}); | ||
834 | nonce = someData.split(0, (128/8)); | ||
835 | message = someData.split(128/8); | ||
836 | executionContext = new Clipperz.Crypto.AES.DeferredExecutionContext({key:key, message:message, nonce:nonce}); | ||
837 | |||
838 | deferredResult = new Clipperz.Async.Deferred("AES.deferredDecrypt"); | ||
839 | //deferredResult.addCallback(function (aValue) { console.log(">>> deferredDecrypt"); return aValue; }); | ||
840 | deferredResult.addCallback(Clipperz.Crypto.AES.deferredEncryptBlocks); | ||
841 | deferredResult.addCallback(function(anExecutionContext) { | ||
842 | return anExecutionContext.result(); | ||
843 | }); | ||
844 | //deferredResult.addCallback(function (aValue) { console.log("<<< deferredDecrypt"); return aValue; }); | ||
845 | deferredResult.callback(executionContext); | ||
846 | |||
847 | return deferredResult; | ||
848 | }, | ||
849 | |||
850 | //----------------------------------------------------------------------------- | ||
851 | __syntaxFix__: "syntax fix" | ||
852 | |||
853 | }); | ||
854 | |||
855 | //############################################################################# | ||
856 | |||
857 | //Clipperz.Crypto.AES.DeferredExecution = { | ||
858 | // 'chunkSize': 16384, // 4096, // 1024 4096 8192 1638432768; | ||
859 | // 'pauseTime': 0.02 //0.2 | ||
860 | //} | ||
861 | |||
862 | Clipperz.Crypto.AES.exception = { | ||
863 | 'UnsupportedKeySize': new MochiKit.Base.NamedError("Clipperz.Crypto.AES.exception.UnsupportedKeySize") | ||
864 | }; | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/Base.js b/frontend/gamma/js/ClipperzCryptoLibrary/Base.js new file mode 100644 index 0000000..9acfc49 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/Base.js | |||
@@ -0,0 +1,1847 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) { | ||
25 | throw "Clipperz.Crypto.Base depends on Clipperz.Base!"; | ||
26 | } | ||
27 | |||
28 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | ||
29 | if (typeof(Clipperz.Crypto.Base) == 'undefined') { Clipperz.Crypto.Base = {}; } | ||
30 | |||
31 | Clipperz.Crypto.Base.VERSION = "0.1"; | ||
32 | Clipperz.Crypto.Base.NAME = "Clipperz.Crypto.Base"; | ||
33 | |||
34 | //############################################################################# | ||
35 | //Downloaded on March 30, 2006 from http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip (jsSha2/sha256.js) | ||
36 | //############################################################################# | ||
37 | |||
38 | /* A JavaScript implementation of the Secure Hash Algorithm, SHA-256 | ||
39 | * Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/ | ||
40 | * Distributed under the BSD License | ||
41 | * Some bits taken from Paul Johnston's SHA-1 implementation | ||
42 | */ | ||
43 | var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | ||
44 | function safe_add (x, y) { | ||
45 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); | ||
46 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | ||
47 | return (msw << 16) | (lsw & 0xFFFF); | ||
48 | } | ||
49 | function S (X, n) {return ( X >>> n ) | (X << (32 - n));} | ||
50 | function R (X, n) {return ( X >>> n );} | ||
51 | function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));} | ||
52 | function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));} | ||
53 | function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));} | ||
54 | function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));} | ||
55 | function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));} | ||
56 | function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));} | ||
57 | function core_sha256 (m, l) { | ||
58 | var K = new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2); | ||
59 | var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19); | ||
60 | var W = new Array(64); | ||
61 | var a, b, c, d, e, f, g, h, i, j; | ||
62 | var T1, T2; | ||
63 | /* append padding */ | ||
64 | m[l >> 5] |= 0x80 << (24 - l % 32); | ||
65 | m[((l + 64 >> 9) << 4) + 15] = l; | ||
66 | for ( var i = 0; i<m.length; i+=16 ) { | ||
67 | a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7]; | ||
68 | for ( var j = 0; j<64; j++) { | ||
69 | if (j < 16) W[j] = m[j + i]; | ||
70 | else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]); | ||
71 | T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]); | ||
72 | T2 = safe_add(Sigma0256(a), Maj(a, b, c)); | ||
73 | h = g; g = f; f = e; e = safe_add(d, T1); d = c; c = b; b = a; a = safe_add(T1, T2); | ||
74 | } | ||
75 | HASH[0] = safe_add(a, HASH[0]); HASH[1] = safe_add(b, HASH[1]); HASH[2] = safe_add(c, HASH[2]); HASH[3] = safe_add(d, HASH[3]); HASH[4] = safe_add(e, HASH[4]); HASH[5] = safe_add(f, HASH[5]); HASH[6] = safe_add(g, HASH[6]); HASH[7] = safe_add(h, HASH[7]); | ||
76 | } | ||
77 | return HASH; | ||
78 | } | ||
79 | function str2binb (str) { | ||
80 | var bin = Array(); | ||
81 | var mask = (1 << chrsz) - 1; | ||
82 | for(var i = 0; i < str.length * chrsz; i += chrsz) | ||
83 | bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32); | ||
84 | return bin; | ||
85 | } | ||
86 | function binb2hex (binarray) { | ||
87 | var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
88 | var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; | ||
89 | var str = ""; | ||
90 | for (var i = 0; i < binarray.length * 4; i++) { | ||
91 | str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); | ||
92 | } | ||
93 | return str; | ||
94 | } | ||
95 | function hex_sha256(s){return binb2hex(core_sha256(str2binb(s),s.length * chrsz));} | ||
96 | |||
97 | |||
98 | |||
99 | //############################################################################# | ||
100 | //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (entropy.js) | ||
101 | //############################################################################# | ||
102 | |||
103 | // Entropy collection utilities | ||
104 | |||
105 | /*Start by declaring static storage and initialise | ||
106 | the entropy vector from the time we come through | ||
107 | here. */ | ||
108 | |||
109 | var entropyData = new Array(); // Collected entropy data | ||
110 | var edlen = 0; // Keyboard array data length | ||
111 | |||
112 | addEntropyTime(); // Start entropy collection with page load time | ||
113 | ce(); // Roll milliseconds into initial entropy | ||
114 | |||
115 | //Add a byte to the entropy vector | ||
116 | |||
117 | function addEntropyByte(b) { | ||
118 | entropyData[edlen++] = b; | ||
119 | } | ||
120 | |||
121 | /*Capture entropy. When the user presses a key or performs | ||
122 | various other events for which we can request | ||
123 | notification, add the time in 255ths of a second to the | ||
124 | entropyData array. The name of the function is short | ||
125 | so it doesn't bloat the form object declarations in | ||
126 | which it appears in various "onXXX" events. */ | ||
127 | |||
128 | function ce() { | ||
129 | addEntropyByte(Math.floor((((new Date).getMilliseconds()) * 255) / 999)); | ||
130 | } | ||
131 | |||
132 | //Add a 32 bit quantity to the entropy vector | ||
133 | |||
134 | function addEntropy32(w) { | ||
135 | var i; | ||
136 | |||
137 | for (i = 0; i < 4; i++) { | ||
138 | addEntropyByte(w & 0xFF); | ||
139 | w >>= 8; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | /*Add the current time and date (milliseconds since the epoch, | ||
144 | truncated to 32 bits) to the entropy vector. */ | ||
145 | |||
146 | function addEntropyTime() { | ||
147 | addEntropy32((new Date()).getTime()); | ||
148 | } | ||
149 | |||
150 | /* Start collection of entropy from mouse movements. The | ||
151 | argument specifies the number of entropy items to be | ||
152 | obtained from mouse motion, after which mouse motion | ||
153 | will be ignored. Note that you can re-enable mouse | ||
154 | motion collection at any time if not already underway. */ | ||
155 | |||
156 | var mouseMotionCollect = 0; | ||
157 | var oldMoveHandler; // For saving and restoring mouse move handler in IE4 | ||
158 | |||
159 | function mouseMotionEntropy(maxsamp) { | ||
160 | if (mouseMotionCollect <= 0) { | ||
161 | mouseMotionCollect = maxsamp; | ||
162 | if ((document.implementation.hasFeature("Events", "2.0")) && | ||
163 | document.addEventListener) { | ||
164 | // Browser supports Document Object Model (DOM) 2 events | ||
165 | document.addEventListener("mousemove", mouseMoveEntropy, false); | ||
166 | } else { | ||
167 | if (document.attachEvent) { | ||
168 | // Internet Explorer 5 and above event model | ||
169 | document.attachEvent("onmousemove", mouseMoveEntropy); | ||
170 | } else { | ||
171 | //Internet Explorer 4 event model | ||
172 | oldMoveHandler = document.onmousemove; | ||
173 | document.onmousemove = mouseMoveEntropy; | ||
174 | } | ||
175 | } | ||
176 | //dump("Mouse enable", mouseMotionCollect); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | /*Collect entropy from mouse motion events. Note that | ||
181 | this is craftily coded to work with either DOM2 or Internet | ||
182 | Explorer style events. Note that we don't use every successive | ||
183 | mouse movement event. Instead, we XOR the three bytes collected | ||
184 | from the mouse and use that to determine how many subsequent | ||
185 | mouse movements we ignore before capturing the next one. */ | ||
186 | |||
187 | var mouseEntropyTime = 0; // Delay counter for mouse entropy collection | ||
188 | |||
189 | function mouseMoveEntropy(e) { | ||
190 | if (!e) { | ||
191 | e = window.event; // Internet Explorer event model | ||
192 | } | ||
193 | if (mouseMotionCollect > 0) { | ||
194 | if (mouseEntropyTime-- <= 0) { | ||
195 | addEntropyByte(e.screenX & 0xFF); | ||
196 | addEntropyByte(e.screenY & 0xFF); | ||
197 | ce(); | ||
198 | mouseMotionCollect--; | ||
199 | mouseEntropyTime = (entropyData[edlen - 3] ^ entropyData[edlen - 2] ^ | ||
200 | entropyData[edlen - 1]) % 19; | ||
201 | //dump("Mouse Move", byteArrayToHex(entropyData.slice(-3))); | ||
202 | } | ||
203 | if (mouseMotionCollect <= 0) { | ||
204 | if (document.removeEventListener) { | ||
205 | document.removeEventListener("mousemove", mouseMoveEntropy, false); | ||
206 | } else if (document.detachEvent) { | ||
207 | document.detachEvent("onmousemove", mouseMoveEntropy); | ||
208 | } else { | ||
209 | document.onmousemove = oldMoveHandler; | ||
210 | } | ||
211 | //dump("Spung!", 0); | ||
212 | } | ||
213 | } | ||
214 | } | ||
215 | |||
216 | /*Compute a 32 byte key value from the entropy vector. | ||
217 | We compute the value by taking the MD5 sum of the even | ||
218 | and odd bytes respectively of the entropy vector, then | ||
219 | concatenating the two MD5 sums. */ | ||
220 | |||
221 | function keyFromEntropy() { | ||
222 | var i, k = new Array(32); | ||
223 | |||
224 | if (edlen == 0) { | ||
225 | alert("Blooie! Entropy vector void at call to keyFromEntropy."); | ||
226 | } | ||
227 | //dump("Entropy bytes", edlen); | ||
228 | |||
229 | md5_init(); | ||
230 | for (i = 0; i < edlen; i += 2) { | ||
231 | md5_update(entropyData[i]); | ||
232 | } | ||
233 | md5_finish(); | ||
234 | for (i = 0; i < 16; i++) { | ||
235 | k[i] = digestBits[i]; | ||
236 | } | ||
237 | |||
238 | md5_init(); | ||
239 | for (i = 1; i < edlen; i += 2) { | ||
240 | md5_update(entropyData[i]); | ||
241 | } | ||
242 | md5_finish(); | ||
243 | for (i = 0; i < 16; i++) { | ||
244 | k[i + 16] = digestBits[i]; | ||
245 | } | ||
246 | |||
247 | //dump("keyFromEntropy", byteArrayToHex(k)); | ||
248 | return k; | ||
249 | } | ||
250 | |||
251 | //############################################################################# | ||
252 | //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (aesprng.js) | ||
253 | //############################################################################# | ||
254 | |||
255 | |||
256 | // AES based pseudorandom number generator | ||
257 | |||
258 | /* Constructor. Called with an array of 32 byte (0-255) values | ||
259 | containing the initial seed. */ | ||
260 | |||
261 | function AESprng(seed) { | ||
262 | this.key = new Array(); | ||
263 | this.key = seed; | ||
264 | this.itext = hexToByteArray("9F489613248148F9C27945C6AE62EECA3E3367BB14064E4E6DC67A9F28AB3BD1"); | ||
265 | this.nbytes = 0; // Bytes left in buffer | ||
266 | |||
267 | this.next = AESprng_next; | ||
268 | this.nextbits = AESprng_nextbits; | ||
269 | this.nextInt = AESprng_nextInt; | ||
270 | this.round = AESprng_round; | ||
271 | |||
272 | /* Encrypt the initial text with the seed key | ||
273 | three times, feeding the output of the encryption | ||
274 | back into the key for the next round. */ | ||
275 | |||
276 | bsb = blockSizeInBits; | ||
277 | blockSizeInBits = 256; | ||
278 | var i, ct; | ||
279 | for (i = 0; i < 3; i++) { | ||
280 | this.key = rijndaelEncrypt(this.itext, this.key, "ECB"); | ||
281 | } | ||
282 | |||
283 | /* Now make between one and four additional | ||
284 | key-feedback rounds, with the number determined | ||
285 | by bits from the result of the first three | ||
286 | rounds. */ | ||
287 | |||
288 | var n = 1 + (this.key[3] & 2) + (this.key[9] & 1); | ||
289 | for (i = 0; i < n; i++) { | ||
290 | this.key = rijndaelEncrypt(this.itext, this.key, "ECB"); | ||
291 | } | ||
292 | blockSizeInBits = bsb; | ||
293 | } | ||
294 | |||
295 | function AESprng_round() { | ||
296 | bsb = blockSizeInBits; | ||
297 | blockSizeInBits = 256; | ||
298 | this.key = rijndaelEncrypt(this.itext, this.key, "ECB"); | ||
299 | this.nbytes = 32; | ||
300 | blockSizeInBits = bsb; | ||
301 | } | ||
302 | |||
303 | //Return next byte from the generator | ||
304 | |||
305 | function AESprng_next() { | ||
306 | if (this.nbytes <= 0) { | ||
307 | this.round(); | ||
308 | } | ||
309 | return(this.key[--this.nbytes]); | ||
310 | } | ||
311 | |||
312 | //Return n bit integer value (up to maximum integer size) | ||
313 | |||
314 | function AESprng_nextbits(n) { | ||
315 | var i, w = 0, nbytes = Math.floor((n + 7) / 8); | ||
316 | |||
317 | for (i = 0; i < nbytes; i++) { | ||
318 | w = (w << 8) | this.next(); | ||
319 | } | ||
320 | return w & ((1 << n) - 1); | ||
321 | } | ||
322 | |||
323 | // Return integer between 0 and n inclusive | ||
324 | |||
325 | function AESprng_nextInt(n) { | ||
326 | var p = 1, nb = 0; | ||
327 | |||
328 | // Determine smallest p, 2^p > n | ||
329 | // nb = log_2 p | ||
330 | |||
331 | while (n >= p) { | ||
332 | p <<= 1; | ||
333 | nb++; | ||
334 | } | ||
335 | p--; | ||
336 | |||
337 | /* Generate values from 0 through n by first generating | ||
338 | values v from 0 to (2^p)-1, then discarding any results v > n. | ||
339 | For the rationale behind this (and why taking | ||
340 | values mod (n + 1) is biased toward smaller values, see | ||
341 | Ferguson and Schneier, "Practical Cryptography", | ||
342 | ISBN 0-471-22357-3, section 10.8). */ | ||
343 | |||
344 | while (true) { | ||
345 | var v = this.nextbits(nb) & p; | ||
346 | |||
347 | if (v <= n) { | ||
348 | return v; | ||
349 | } | ||
350 | } | ||
351 | } | ||
352 | |||
353 | //############################################################################# | ||
354 | //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (md5.js) | ||
355 | //############################################################################# | ||
356 | |||
357 | /* | ||
358 | * md5.jvs 1.0b 27/06/96 | ||
359 | * | ||
360 | * Javascript implementation of the RSA Data Security, Inc. MD5 | ||
361 | * Message-Digest Algorithm. | ||
362 | * | ||
363 | * Copyright (c) 1996 Henri Torgemane. All Rights Reserved. | ||
364 | * | ||
365 | * Permission to use, copy, modify, and distribute this software | ||
366 | * and its documentation for any purposes and without | ||
367 | * fee is hereby granted provided that this copyright notice | ||
368 | * appears in all copies. | ||
369 | * | ||
370 | * Of course, this soft is provided "as is" without express or implied | ||
371 | * warranty of any kind. | ||
372 | |||
373 | This version contains some trivial reformatting modifications | ||
374 | by John Walker. | ||
375 | |||
376 | */ | ||
377 | |||
378 | function array(n) { | ||
379 | for (i = 0; i < n; i++) { | ||
380 | this[i] = 0; | ||
381 | } | ||
382 | this.length = n; | ||
383 | } | ||
384 | |||
385 | /* Some basic logical functions had to be rewritten because of a bug in | ||
386 | * Javascript.. Just try to compute 0xffffffff >> 4 with it.. | ||
387 | * Of course, these functions are slower than the original would be, but | ||
388 | * at least, they work! | ||
389 | */ | ||
390 | |||
391 | function integer(n) { | ||
392 | return n % (0xffffffff + 1); | ||
393 | } | ||
394 | |||
395 | function shr(a, b) { | ||
396 | a = integer(a); | ||
397 | b = integer(b); | ||
398 | if (a - 0x80000000 >= 0) { | ||
399 | a = a % 0x80000000; | ||
400 | a >>= b; | ||
401 | a += 0x40000000 >> (b - 1); | ||
402 | } else { | ||
403 | a >>= b; | ||
404 | } | ||
405 | return a; | ||
406 | } | ||
407 | |||
408 | function shl1(a) { | ||
409 | a = a % 0x80000000; | ||
410 | if (a & 0x40000000 == 0x40000000) { | ||
411 | a -= 0x40000000; | ||
412 | a *= 2; | ||
413 | a += 0x80000000; | ||
414 | } else { | ||
415 | a *= 2; | ||
416 | } | ||
417 | return a; | ||
418 | } | ||
419 | |||
420 | function shl(a, b) { | ||
421 | a = integer(a); | ||
422 | b = integer(b); | ||
423 | for (var i = 0; i < b; i++) { | ||
424 | a = shl1(a); | ||
425 | } | ||
426 | return a; | ||
427 | } | ||
428 | |||
429 | function and(a, b) { | ||
430 | a = integer(a); | ||
431 | b = integer(b); | ||
432 | var t1 = a - 0x80000000; | ||
433 | var t2 = b - 0x80000000; | ||
434 | if (t1 >= 0) { | ||
435 | if (t2 >= 0) { | ||
436 | return ((t1 & t2) + 0x80000000); | ||
437 | } else { | ||
438 | return (t1 & b); | ||
439 | } | ||
440 | } else { | ||
441 | if (t2 >= 0) { | ||
442 | return (a & t2); | ||
443 | } else { | ||
444 | return (a & b); | ||
445 | } | ||
446 | } | ||
447 | } | ||
448 | |||
449 | function or(a, b) { | ||
450 | a = integer(a); | ||
451 | b = integer(b); | ||
452 | var t1 = a - 0x80000000; | ||
453 | var t2 = b - 0x80000000; | ||
454 | if (t1 >= 0) { | ||
455 | if (t2 >= 0) { | ||
456 | return ((t1 | t2) + 0x80000000); | ||
457 | } else { | ||
458 | return ((t1 | b) + 0x80000000); | ||
459 | } | ||
460 | } else { | ||
461 | if (t2 >= 0) { | ||
462 | return ((a | t2) + 0x80000000); | ||
463 | } else { | ||
464 | return (a | b); | ||
465 | } | ||
466 | } | ||
467 | } | ||
468 | |||
469 | function xor(a, b) { | ||
470 | a = integer(a); | ||
471 | b = integer(b); | ||
472 | var t1 = a - 0x80000000; | ||
473 | var t2 = b - 0x80000000; | ||
474 | if (t1 >= 0) { | ||
475 | if (t2 >= 0) { | ||
476 | return (t1 ^ t2); | ||
477 | } else { | ||
478 | return ((t1 ^ b) + 0x80000000); | ||
479 | } | ||
480 | } else { | ||
481 | if (t2 >= 0) { | ||
482 | return ((a ^ t2) + 0x80000000); | ||
483 | } else { | ||
484 | return (a ^ b); | ||
485 | } | ||
486 | } | ||
487 | } | ||
488 | |||
489 | function not(a) { | ||
490 | a = integer(a); | ||
491 | return 0xffffffff - a; | ||
492 | } | ||
493 | |||
494 | /* Here begin the real algorithm */ | ||
495 | |||
496 | var state = new array(4); | ||
497 | var count = new array(2); | ||
498 | count[0] = 0; | ||
499 | count[1] = 0; | ||
500 | var buffer = new array(64); | ||
501 | var transformBuffer = new array(16); | ||
502 | var digestBits = new array(16); | ||
503 | |||
504 | var S11 = 7; | ||
505 | var S12 = 12; | ||
506 | var S13 = 17; | ||
507 | var S14 = 22; | ||
508 | var S21 = 5; | ||
509 | var S22 = 9; | ||
510 | var S23 = 14; | ||
511 | var S24 = 20; | ||
512 | var S31 = 4; | ||
513 | var S32 = 11; | ||
514 | var S33 = 16; | ||
515 | var S34 = 23; | ||
516 | var S41 = 6; | ||
517 | var S42 = 10; | ||
518 | var S43 = 15; | ||
519 | var S44 = 21; | ||
520 | |||
521 | function F(x, y, z) { | ||
522 | return or(and(x, y), and(not(x), z)); | ||
523 | } | ||
524 | |||
525 | function G(x, y, z) { | ||
526 | return or(and(x, z), and(y, not(z))); | ||
527 | } | ||
528 | |||
529 | function H(x, y, z) { | ||
530 | return xor(xor(x, y), z); | ||
531 | } | ||
532 | |||
533 | function I(x, y, z) { | ||
534 | return xor(y ,or(x , not(z))); | ||
535 | } | ||
536 | |||
537 | function rotateLeft(a, n) { | ||
538 | return or(shl(a, n), (shr(a, (32 - n)))); | ||
539 | } | ||
540 | |||
541 | function FF(a, b, c, d, x, s, ac) { | ||
542 | a = a + F(b, c, d) + x + ac; | ||
543 | a = rotateLeft(a, s); | ||
544 | a = a + b; | ||
545 | return a; | ||
546 | } | ||
547 | |||
548 | function GG(a, b, c, d, x, s, ac) { | ||
549 | a = a + G(b, c, d) + x + ac; | ||
550 | a = rotateLeft(a, s); | ||
551 | a = a + b; | ||
552 | return a; | ||
553 | } | ||
554 | |||
555 | function HH(a, b, c, d, x, s, ac) { | ||
556 | a = a + H(b, c, d) + x + ac; | ||
557 | a = rotateLeft(a, s); | ||
558 | a = a + b; | ||
559 | return a; | ||
560 | } | ||
561 | |||
562 | function II(a, b, c, d, x, s, ac) { | ||
563 | a = a + I(b, c, d) + x + ac; | ||
564 | a = rotateLeft(a, s); | ||
565 | a = a + b; | ||
566 | return a; | ||
567 | } | ||
568 | |||
569 | function transform(buf, offset) { | ||
570 | var a = 0, b = 0, c = 0, d = 0; | ||
571 | var x = transformBuffer; | ||
572 | |||
573 | a = state[0]; | ||
574 | b = state[1]; | ||
575 | c = state[2]; | ||
576 | d = state[3]; | ||
577 | |||
578 | for (i = 0; i < 16; i++) { | ||
579 | x[i] = and(buf[i * 4 + offset], 0xFF); | ||
580 | for (j = 1; j < 4; j++) { | ||
581 | x[i] += shl(and(buf[i * 4 + j + offset] ,0xFF), j * 8); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | /* Round 1 */ | ||
586 | a = FF( a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ | ||
587 | d = FF( d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ | ||
588 | c = FF( c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ | ||
589 | b = FF( b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ | ||
590 | a = FF( a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ | ||
591 | d = FF( d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ | ||
592 | c = FF( c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ | ||
593 | b = FF( b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ | ||
594 | a = FF( a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ | ||
595 | d = FF( d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ | ||
596 | c = FF( c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ | ||
597 | b = FF( b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ | ||
598 | a = FF( a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ | ||
599 | d = FF( d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ | ||
600 | c = FF( c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ | ||
601 | b = FF( b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ | ||
602 | |||
603 | /* Round 2 */ | ||
604 | a = GG( a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ | ||
605 | d = GG( d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ | ||
606 | c = GG( c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ | ||
607 | b = GG( b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ | ||
608 | a = GG( a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ | ||
609 | d = GG( d, a, b, c, x[10], S22, 0x2441453); /* 22 */ | ||
610 | c = GG( c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ | ||
611 | b = GG( b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ | ||
612 | a = GG( a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ | ||
613 | d = GG( d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ | ||
614 | c = GG( c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ | ||
615 | b = GG( b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ | ||
616 | a = GG( a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ | ||
617 | d = GG( d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ | ||
618 | c = GG( c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ | ||
619 | b = GG( b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ | ||
620 | |||
621 | /* Round 3 */ | ||
622 | a = HH( a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ | ||
623 | d = HH( d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ | ||
624 | c = HH( c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ | ||
625 | b = HH( b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ | ||
626 | a = HH( a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ | ||
627 | d = HH( d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ | ||
628 | c = HH( c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ | ||
629 | b = HH( b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ | ||
630 | a = HH( a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ | ||
631 | d = HH( d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ | ||
632 | c = HH( c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ | ||
633 | b = HH( b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ | ||
634 | a = HH( a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ | ||
635 | d = HH( d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ | ||
636 | c = HH( c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ | ||
637 | b = HH( b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ | ||
638 | |||
639 | /* Round 4 */ | ||
640 | a = II( a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ | ||
641 | d = II( d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ | ||
642 | c = II( c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ | ||
643 | b = II( b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ | ||
644 | a = II( a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ | ||
645 | d = II( d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ | ||
646 | c = II( c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ | ||
647 | b = II( b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ | ||
648 | a = II( a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ | ||
649 | d = II( d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ | ||
650 | c = II( c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ | ||
651 | b = II( b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ | ||
652 | a = II( a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ | ||
653 | d = II( d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ | ||
654 | c = II( c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ | ||
655 | b = II( b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ | ||
656 | |||
657 | state[0] += a; | ||
658 | state[1] += b; | ||
659 | state[2] += c; | ||
660 | state[3] += d; | ||
661 | |||
662 | } | ||
663 | |||
664 | function md5_init() { | ||
665 | count[0] = count[1] = 0; | ||
666 | state[0] = 0x67452301; | ||
667 | state[1] = 0xefcdab89; | ||
668 | state[2] = 0x98badcfe; | ||
669 | state[3] = 0x10325476; | ||
670 | for (i = 0; i < digestBits.length; i++) { | ||
671 | digestBits[i] = 0; | ||
672 | } | ||
673 | } | ||
674 | |||
675 | function md5_update(b) { | ||
676 | var index, i; | ||
677 | |||
678 | index = and(shr(count[0],3) , 0x3F); | ||
679 | if (count[0] < 0xFFFFFFFF - 7) { | ||
680 | count[0] += 8; | ||
681 | } else { | ||
682 | count[1]++; | ||
683 | count[0] -= 0xFFFFFFFF + 1; | ||
684 | count[0] += 8; | ||
685 | } | ||
686 | buffer[index] = and(b, 0xff); | ||
687 | if (index >= 63) { | ||
688 | transform(buffer, 0); | ||
689 | } | ||
690 | } | ||
691 | |||
692 | function md5_finish() { | ||
693 | var bits = new array(8); | ||
694 | var padding; | ||
695 | var i = 0, index = 0, padLen = 0; | ||
696 | |||
697 | for (i = 0; i < 4; i++) { | ||
698 | bits[i] = and(shr(count[0], (i * 8)), 0xFF); | ||
699 | } | ||
700 | for (i = 0; i < 4; i++) { | ||
701 | bits[i + 4] = and(shr(count[1], (i * 8)), 0xFF); | ||
702 | } | ||
703 | index = and(shr(count[0], 3), 0x3F); | ||
704 | padLen = (index < 56) ? (56 - index) : (120 - index); | ||
705 | padding = new array(64); | ||
706 | padding[0] = 0x80; | ||
707 | for (i = 0; i < padLen; i++) { | ||
708 | md5_update(padding[i]); | ||
709 | } | ||
710 | for (i = 0; i < 8; i++) { | ||
711 | md5_update(bits[i]); | ||
712 | } | ||
713 | |||
714 | for (i = 0; i < 4; i++) { | ||
715 | for (j = 0; j < 4; j++) { | ||
716 | digestBits[i * 4 + j] = and(shr(state[i], (j * 8)) , 0xFF); | ||
717 | } | ||
718 | } | ||
719 | } | ||
720 | |||
721 | /* End of the MD5 algorithm */ | ||
722 | |||
723 | //############################################################################# | ||
724 | //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (aes.js) | ||
725 | //############################################################################# | ||
726 | |||
727 | |||
728 | /* rijndael.js Rijndael Reference Implementation | ||
729 | |||
730 | This is a modified version of the software described below, | ||
731 | produced in September 2003 by John Walker for use in the | ||
732 | JavsScrypt browser-based encryption package. The principal | ||
733 | changes are replacing the original getRandomBytes function with | ||
734 | one which calls our pseudorandom generator (which must | ||
735 | be instantiated and seeded before the first call on getRandomBytes), | ||
736 | and changing keySizeInBits to 256. Some code not required by the | ||
737 | JavsScrypt application has been commented out. Please see | ||
738 | http://www.fourmilab.ch/javascrypt/ for further information on | ||
739 | JavaScrypt. | ||
740 | |||
741 | The following is the original copyright and application | ||
742 | information. | ||
743 | |||
744 | Copyright (c) 2001 Fritz Schneider | ||
745 | |||
746 | This software is provided as-is, without express or implied warranty. | ||
747 | Permission to use, copy, modify, distribute or sell this software, with or | ||
748 | without fee, for any purpose and by any individual or organization, is hereby | ||
749 | granted, provided that the above copyright notice and this paragraph appear | ||
750 | in all copies. Distribution as a part of an application or binary must | ||
751 | include the above copyright notice in the documentation and/or other materials | ||
752 | provided with the application or distribution. | ||
753 | |||
754 | As the above disclaimer notes, you are free to use this code however you | ||
755 | want. However, I would request that you send me an email | ||
756 | (fritz /at/ cs /dot/ ucsd /dot/ edu) to say hi if you find this code useful | ||
757 | or instructional. Seeing that people are using the code acts as | ||
758 | encouragement for me to continue development. If you *really* want to thank | ||
759 | me you can buy the book I wrote with Thomas Powell, _JavaScript: | ||
760 | _The_Complete_Reference_ :) | ||
761 | |||
762 | This code is an UNOPTIMIZED REFERENCE implementation of Rijndael. | ||
763 | If there is sufficient interest I can write an optimized (word-based, | ||
764 | table-driven) version, although you might want to consider using a | ||
765 | compiled language if speed is critical to your application. As it stands, | ||
766 | one run of the monte carlo test (10,000 encryptions) can take up to | ||
767 | several minutes, depending upon your processor. You shouldn't expect more | ||
768 | than a few kilobytes per second in throughput. | ||
769 | |||
770 | Also note that there is very little error checking in these functions. | ||
771 | Doing proper error checking is always a good idea, but the ideal | ||
772 | implementation (using the instanceof operator and exceptions) requires | ||
773 | IE5+/NS6+, and I've chosen to implement this code so that it is compatible | ||
774 | with IE4/NS4. | ||
775 | |||
776 | And finally, because JavaScript doesn't have an explicit byte/char data | ||
777 | type (although JavaScript 2.0 most likely will), when I refer to "byte" | ||
778 | in this code I generally mean "32 bit integer with value in the interval | ||
779 | [0,255]" which I treat as a byte. | ||
780 | |||
781 | See http://www-cse.ucsd.edu/~fritz/rijndael.html for more documentation | ||
782 | of the (very simple) API provided by this code. | ||
783 | |||
784 | Fritz Schneider | ||
785 | fritz at cs.ucsd.edu | ||
786 | |||
787 | */ | ||
788 | |||
789 | |||
790 | // Rijndael parameters -- Valid values are 128, 192, or 256 | ||
791 | |||
792 | var keySizeInBits = 256; | ||
793 | var blockSizeInBits = 128; | ||
794 | |||
795 | // | ||
796 | // Note: in the following code the two dimensional arrays are indexed as | ||
797 | // you would probably expect, as array[row][column]. The state arrays | ||
798 | // are 2d arrays of the form state[4][Nb]. | ||
799 | |||
800 | |||
801 | // The number of rounds for the cipher, indexed by [Nk][Nb] | ||
802 | var roundsArray = [ ,,,,[,,,,10,, 12,, 14],, | ||
803 | [,,,,12,, 12,, 14],, | ||
804 | [,,,,14,, 14,, 14] ]; | ||
805 | |||
806 | // The number of bytes to shift by in shiftRow, indexed by [Nb][row] | ||
807 | var shiftOffsets = [ ,,,,[,1, 2, 3],,[,1, 2, 3],,[,1, 3, 4] ]; | ||
808 | |||
809 | // The round constants used in subkey expansion | ||
810 | var Rcon = [ | ||
811 | 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, | ||
812 | 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, | ||
813 | 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, | ||
814 | 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, | ||
815 | 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91 ]; | ||
816 | |||
817 | // Precomputed lookup table for the SBox | ||
818 | var SBox = [ | ||
819 | 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, | ||
820 | 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, | ||
821 | 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, | ||
822 | 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, | ||
823 | 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, | ||
824 | 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, | ||
825 | 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, | ||
826 | 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, | ||
827 | 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, | ||
828 | 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, | ||
829 | 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, | ||
830 | 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, | ||
831 | 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, | ||
832 | 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, | ||
833 | 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, | ||
834 | 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, | ||
835 | 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, | ||
836 | 22 ]; | ||
837 | |||
838 | // Precomputed lookup table for the inverse SBox | ||
839 | var SBoxInverse = [ | ||
840 | 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, | ||
841 | 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, | ||
842 | 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, | ||
843 | 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, | ||
844 | 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, | ||
845 | 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, | ||
846 | 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, | ||
847 | 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, | ||
848 | 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, | ||
849 | 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, | ||
850 | 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, | ||
851 | 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, | ||
852 | 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, | ||
853 | 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, | ||
854 | 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, | ||
855 | 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, | ||
856 | 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, | ||
857 | 125 ]; | ||
858 | |||
859 | // This method circularly shifts the array left by the number of elements | ||
860 | // given in its parameter. It returns the resulting array and is used for | ||
861 | // the ShiftRow step. Note that shift() and push() could be used for a more | ||
862 | // elegant solution, but they require IE5.5+, so I chose to do it manually. | ||
863 | |||
864 | function cyclicShiftLeft(theArray, positions) { | ||
865 | var temp = theArray.slice(0, positions); | ||
866 | theArray = theArray.slice(positions).concat(temp); | ||
867 | return theArray; | ||
868 | } | ||
869 | |||
870 | // Cipher parameters ... do not change these | ||
871 | var Nk = keySizeInBits / 32; | ||
872 | var Nb = blockSizeInBits / 32; | ||
873 | var Nr = roundsArray[Nk][Nb]; | ||
874 | |||
875 | // Multiplies the element "poly" of GF(2^8) by x. See the Rijndael spec. | ||
876 | |||
877 | function xtime(poly) { | ||
878 | poly <<= 1; | ||
879 | return ((poly & 0x100) ? (poly ^ 0x11B) : (poly)); | ||
880 | } | ||
881 | |||
882 | // Multiplies the two elements of GF(2^8) together and returns the result. | ||
883 | // See the Rijndael spec, but should be straightforward: for each power of | ||
884 | // the indeterminant that has a 1 coefficient in x, add y times that power | ||
885 | // to the result. x and y should be bytes representing elements of GF(2^8) | ||
886 | |||
887 | function mult_GF256(x, y) { | ||
888 | var bit, result = 0; | ||
889 | |||
890 | for (bit = 1; bit < 256; bit *= 2, y = xtime(y)) { | ||
891 | if (x & bit) | ||
892 | result ^= y; | ||
893 | } | ||
894 | return result; | ||
895 | } | ||
896 | |||
897 | // Performs the substitution step of the cipher. State is the 2d array of | ||
898 | // state information (see spec) and direction is string indicating whether | ||
899 | // we are performing the forward substitution ("encrypt") or inverse | ||
900 | // substitution (anything else) | ||
901 | |||
902 | function byteSub(state, direction) { | ||
903 | var S; | ||
904 | if (direction == "encrypt") // Point S to the SBox we're using | ||
905 | S = SBox; | ||
906 | else | ||
907 | S = SBoxInverse; | ||
908 | for (var i = 0; i < 4; i++) // Substitute for every byte in state | ||
909 | for (var j = 0; j < Nb; j++) | ||
910 | state[i][j] = S[state[i][j]]; | ||
911 | } | ||
912 | |||
913 | // Performs the row shifting step of the cipher. | ||
914 | |||
915 | function shiftRow(state, direction) { | ||
916 | for (var i=1; i<4; i++) // Row 0 never shifts | ||
917 | if (direction == "encrypt") | ||
918 | state[i] = cyclicShiftLeft(state[i], shiftOffsets[Nb][i]); | ||
919 | else | ||
920 | state[i] = cyclicShiftLeft(state[i], Nb - shiftOffsets[Nb][i]); | ||
921 | |||
922 | } | ||
923 | |||
924 | // Performs the column mixing step of the cipher. Most of these steps can | ||
925 | // be combined into table lookups on 32bit values (at least for encryption) | ||
926 | // to greatly increase the speed. | ||
927 | |||
928 | function mixColumn(state, direction) { | ||
929 | var b = []; // Result of matrix multiplications | ||
930 | for (var j = 0; j < Nb; j++) { // Go through each column... | ||
931 | for (var i = 0; i < 4; i++) { // and for each row in the column... | ||
932 | if (direction == "encrypt") | ||
933 | b[i] = mult_GF256(state[i][j], 2) ^ // perform mixing | ||
934 | mult_GF256(state[(i+1)%4][j], 3) ^ | ||
935 | state[(i+2)%4][j] ^ | ||
936 | state[(i+3)%4][j]; | ||
937 | else | ||
938 | b[i] = mult_GF256(state[i][j], 0xE) ^ | ||
939 | mult_GF256(state[(i+1)%4][j], 0xB) ^ | ||
940 | mult_GF256(state[(i+2)%4][j], 0xD) ^ | ||
941 | mult_GF256(state[(i+3)%4][j], 9); | ||
942 | } | ||
943 | for (var i = 0; i < 4; i++) // Place result back into column | ||
944 | state[i][j] = b[i]; | ||
945 | } | ||
946 | } | ||
947 | |||
948 | // Adds the current round key to the state information. Straightforward. | ||
949 | |||
950 | function addRoundKey(state, roundKey) { | ||
951 | for (var j = 0; j < Nb; j++) { // Step through columns... | ||
952 | state[0][j] ^= (roundKey[j] & 0xFF); // and XOR | ||
953 | state[1][j] ^= ((roundKey[j]>>8) & 0xFF); | ||
954 | state[2][j] ^= ((roundKey[j]>>16) & 0xFF); | ||
955 | state[3][j] ^= ((roundKey[j]>>24) & 0xFF); | ||
956 | } | ||
957 | } | ||
958 | |||
959 | // This function creates the expanded key from the input (128/192/256-bit) | ||
960 | // key. The parameter key is an array of bytes holding the value of the key. | ||
961 | // The returned value is an array whose elements are the 32-bit words that | ||
962 | // make up the expanded key. | ||
963 | |||
964 | function keyExpansion(key) { | ||
965 | var expandedKey = new Array(); | ||
966 | var temp; | ||
967 | |||
968 | // in case the key size or parameters were changed... | ||
969 | Nk = keySizeInBits / 32; | ||
970 | Nb = blockSizeInBits / 32; | ||
971 | Nr = roundsArray[Nk][Nb]; | ||
972 | |||
973 | for (var j=0; j < Nk; j++) // Fill in input key first | ||
974 | expandedKey[j] = | ||
975 | (key[4*j]) | (key[4*j+1]<<8) | (key[4*j+2]<<16) | (key[4*j+3]<<24); | ||
976 | |||
977 | // Now walk down the rest of the array filling in expanded key bytes as | ||
978 | // per Rijndael's spec | ||
979 | for (j = Nk; j < Nb * (Nr + 1); j++) { // For each word of expanded key | ||
980 | temp = expandedKey[j - 1]; | ||
981 | if (j % Nk == 0) | ||
982 | temp = ( (SBox[(temp>>8) & 0xFF]) | | ||
983 | (SBox[(temp>>16) & 0xFF]<<8) | | ||
984 | (SBox[(temp>>24) & 0xFF]<<16) | | ||
985 | (SBox[temp & 0xFF]<<24) ) ^ Rcon[Math.floor(j / Nk) - 1]; | ||
986 | else if (Nk > 6 && j % Nk == 4) | ||
987 | temp = (SBox[(temp>>24) & 0xFF]<<24) | | ||
988 | (SBox[(temp>>16) & 0xFF]<<16) | | ||
989 | (SBox[(temp>>8) & 0xFF]<<8) | | ||
990 | (SBox[temp & 0xFF]); | ||
991 | expandedKey[j] = expandedKey[j-Nk] ^ temp; | ||
992 | } | ||
993 | return expandedKey; | ||
994 | } | ||
995 | |||
996 | // Rijndael's round functions... | ||
997 | |||
998 | function Round(state, roundKey) { | ||
999 | byteSub(state, "encrypt"); | ||
1000 | shiftRow(state, "encrypt"); | ||
1001 | mixColumn(state, "encrypt"); | ||
1002 | addRoundKey(state, roundKey); | ||
1003 | } | ||
1004 | |||
1005 | function InverseRound(state, roundKey) { | ||
1006 | addRoundKey(state, roundKey); | ||
1007 | mixColumn(state, "decrypt"); | ||
1008 | shiftRow(state, "decrypt"); | ||
1009 | byteSub(state, "decrypt"); | ||
1010 | } | ||
1011 | |||
1012 | function FinalRound(state, roundKey) { | ||
1013 | byteSub(state, "encrypt"); | ||
1014 | shiftRow(state, "encrypt"); | ||
1015 | addRoundKey(state, roundKey); | ||
1016 | } | ||
1017 | |||
1018 | function InverseFinalRound(state, roundKey){ | ||
1019 | addRoundKey(state, roundKey); | ||
1020 | shiftRow(state, "decrypt"); | ||
1021 | byteSub(state, "decrypt"); | ||
1022 | } | ||
1023 | |||
1024 | // encrypt is the basic encryption function. It takes parameters | ||
1025 | // block, an array of bytes representing a plaintext block, and expandedKey, | ||
1026 | // an array of words representing the expanded key previously returned by | ||
1027 | // keyExpansion(). The ciphertext block is returned as an array of bytes. | ||
1028 | |||
1029 | function encrypt(block, expandedKey) { | ||
1030 | var i; | ||
1031 | if (!block || block.length*8 != blockSizeInBits) | ||
1032 | return; | ||
1033 | if (!expandedKey) | ||
1034 | return; | ||
1035 | |||
1036 | block = packBytes(block); | ||
1037 | addRoundKey(block, expandedKey); | ||
1038 | for (i=1; i<Nr; i++) | ||
1039 | Round(block, expandedKey.slice(Nb*i, Nb*(i+1))); | ||
1040 | FinalRound(block, expandedKey.slice(Nb*Nr)); | ||
1041 | return unpackBytes(block); | ||
1042 | } | ||
1043 | |||
1044 | // decrypt is the basic decryption function. It takes parameters | ||
1045 | // block, an array of bytes representing a ciphertext block, and expandedKey, | ||
1046 | // an array of words representing the expanded key previously returned by | ||
1047 | // keyExpansion(). The decrypted block is returned as an array of bytes. | ||
1048 | |||
1049 | function decrypt(block, expandedKey) { | ||
1050 | var i; | ||
1051 | if (!block || block.length*8 != blockSizeInBits) | ||
1052 | return; | ||
1053 | if (!expandedKey) | ||
1054 | return; | ||
1055 | |||
1056 | block = packBytes(block); | ||
1057 | InverseFinalRound(block, expandedKey.slice(Nb*Nr)); | ||
1058 | for (i = Nr - 1; i>0; i--) | ||
1059 | InverseRound(block, expandedKey.slice(Nb*i, Nb*(i+1))); | ||
1060 | addRoundKey(block, expandedKey); | ||
1061 | return unpackBytes(block); | ||
1062 | } | ||
1063 | |||
1064 | /* !NEEDED | ||
1065 | // This method takes a byte array (byteArray) and converts it to a string by | ||
1066 | // applying String.fromCharCode() to each value and concatenating the result. | ||
1067 | // The resulting string is returned. Note that this function SKIPS zero bytes | ||
1068 | // under the assumption that they are padding added in formatPlaintext(). | ||
1069 | // Obviously, do not invoke this method on raw data that can contain zero | ||
1070 | // bytes. It is really only appropriate for printable ASCII/Latin-1 | ||
1071 | // values. Roll your own function for more robust functionality :) | ||
1072 | |||
1073 | function byteArrayToString(byteArray) { | ||
1074 | var result = ""; | ||
1075 | for(var i=0; i<byteArray.length; i++) | ||
1076 | if (byteArray[i] != 0) | ||
1077 | result += String.fromCharCode(byteArray[i]); | ||
1078 | return result; | ||
1079 | } | ||
1080 | */ | ||
1081 | |||
1082 | // This function takes an array of bytes (byteArray) and converts them | ||
1083 | // to a hexadecimal string. Array element 0 is found at the beginning of | ||
1084 | // the resulting string, high nibble first. Consecutive elements follow | ||
1085 | // similarly, for example [16, 255] --> "10ff". The function returns a | ||
1086 | // string. | ||
1087 | |||
1088 | function byteArrayToHex(byteArray) { | ||
1089 | var result = ""; | ||
1090 | if (!byteArray) | ||
1091 | return; | ||
1092 | for (var i=0; i<byteArray.length; i++) | ||
1093 | result += ((byteArray[i]<16) ? "0" : "") + byteArray[i].toString(16); | ||
1094 | |||
1095 | return result; | ||
1096 | } | ||
1097 | |||
1098 | // This function converts a string containing hexadecimal digits to an | ||
1099 | // array of bytes. The resulting byte array is filled in the order the | ||
1100 | // values occur in the string, for example "10FF" --> [16, 255]. This | ||
1101 | // function returns an array. | ||
1102 | |||
1103 | function hexToByteArray(hexString) { | ||
1104 | var byteArray = []; | ||
1105 | if (hexString.length % 2) // must have even length | ||
1106 | return; | ||
1107 | if (hexString.indexOf("0x") == 0 || hexString.indexOf("0X") == 0) | ||
1108 | hexString = hexString.substring(2); | ||
1109 | for (var i = 0; i<hexString.length; i += 2) | ||
1110 | byteArray[Math.floor(i/2)] = parseInt(hexString.slice(i, i+2), 16); | ||
1111 | return byteArray; | ||
1112 | } | ||
1113 | |||
1114 | // This function packs an array of bytes into the four row form defined by | ||
1115 | // Rijndael. It assumes the length of the array of bytes is divisible by | ||
1116 | // four. Bytes are filled in according to the Rijndael spec (starting with | ||
1117 | // column 0, row 0 to 3). This function returns a 2d array. | ||
1118 | |||
1119 | function packBytes(octets) { | ||
1120 | var state = new Array(); | ||
1121 | if (!octets || octets.length % 4) | ||
1122 | return; | ||
1123 | |||
1124 | state[0] = new Array(); state[1] = new Array(); | ||
1125 | state[2] = new Array(); state[3] = new Array(); | ||
1126 | for (var j=0; j<octets.length; j+= 4) { | ||
1127 | state[0][j/4] = octets[j]; | ||
1128 | state[1][j/4] = octets[j+1]; | ||
1129 | state[2][j/4] = octets[j+2]; | ||
1130 | state[3][j/4] = octets[j+3]; | ||
1131 | } | ||
1132 | return state; | ||
1133 | } | ||
1134 | |||
1135 | // This function unpacks an array of bytes from the four row format preferred | ||
1136 | // by Rijndael into a single 1d array of bytes. It assumes the input "packed" | ||
1137 | // is a packed array. Bytes are filled in according to the Rijndael spec. | ||
1138 | // This function returns a 1d array of bytes. | ||
1139 | |||
1140 | function unpackBytes(packed) { | ||
1141 | var result = new Array(); | ||
1142 | for (var j=0; j<packed[0].length; j++) { | ||
1143 | result[result.length] = packed[0][j]; | ||
1144 | result[result.length] = packed[1][j]; | ||
1145 | result[result.length] = packed[2][j]; | ||
1146 | result[result.length] = packed[3][j]; | ||
1147 | } | ||
1148 | return result; | ||
1149 | } | ||
1150 | |||
1151 | // This function takes a prospective plaintext (string or array of bytes) | ||
1152 | // and pads it with pseudorandom bytes if its length is not a multiple of the block | ||
1153 | // size. If plaintext is a string, it is converted to an array of bytes | ||
1154 | // in the process. The type checking can be made much nicer using the | ||
1155 | // instanceof operator, but this operator is not available until IE5.0 so I | ||
1156 | // chose to use the heuristic below. | ||
1157 | |||
1158 | function formatPlaintext(plaintext) { | ||
1159 | var bpb = blockSizeInBits / 8; // bytes per block | ||
1160 | var fillWithRandomBits; | ||
1161 | var i; | ||
1162 | |||
1163 | // if primitive string or String instance | ||
1164 | if ((!((typeof plaintext == "object") && | ||
1165 | ((typeof (plaintext[0])) == "number"))) && | ||
1166 | ((typeof plaintext == "string") || plaintext.indexOf)) | ||
1167 | { | ||
1168 | plaintext = plaintext.split(""); | ||
1169 | // Unicode issues here (ignoring high byte) | ||
1170 | for (i=0; i<plaintext.length; i++) { | ||
1171 | plaintext[i] = plaintext[i].charCodeAt(0) & 0xFF; | ||
1172 | } | ||
1173 | } | ||
1174 | |||
1175 | i = plaintext.length % bpb; | ||
1176 | if (i > 0) { | ||
1177 | //alert("adding " + (bpb - 1) + " bytes"); | ||
1178 | // plaintext = plaintext.concat(getRandomBytes(bpb - i)); | ||
1179 | { | ||
1180 | varpaddingBytes; | ||
1181 | var ii,cc; | ||
1182 | |||
1183 | paddingBytes = new Array(); | ||
1184 | cc = bpb - i; | ||
1185 | for (ii=0; ii<cc; ii++) { | ||
1186 | paddingBytes[ii] = cc; | ||
1187 | } | ||
1188 | |||
1189 | //is("cc", cc); | ||
1190 | //is(getRandomBytes(bpb - i) + "", paddingBytes + ""); | ||
1191 | plaintext = plaintext.concat(paddingBytes); | ||
1192 | } | ||
1193 | } | ||
1194 | |||
1195 | return plaintext; | ||
1196 | } | ||
1197 | |||
1198 | // Returns an array containing "howMany" random bytes. | ||
1199 | |||
1200 | function getRandomBytes(howMany) { | ||
1201 | var i, bytes = new Array(); | ||
1202 | |||
1203 | //alert("getting some random bytes"); | ||
1204 | for (i = 0; i < howMany; i++) { | ||
1205 | bytes[i] = prng.nextInt(255); | ||
1206 | } | ||
1207 | return bytes; | ||
1208 | } | ||
1209 | |||
1210 | // rijndaelEncrypt(plaintext, key, mode) | ||
1211 | // Encrypts the plaintext using the given key and in the given mode. | ||
1212 | // The parameter "plaintext" can either be a string or an array of bytes. | ||
1213 | // The parameter "key" must be an array of key bytes. If you have a hex | ||
1214 | // string representing the key, invoke hexToByteArray() on it to convert it | ||
1215 | // to an array of bytes. The third parameter "mode" is a string indicating | ||
1216 | // the encryption mode to use, either "ECB" or "CBC". If the parameter is | ||
1217 | // omitted, ECB is assumed. | ||
1218 | // | ||
1219 | // An array of bytes representing the cihpertext is returned. To convert | ||
1220 | // this array to hex, invoke byteArrayToHex() on it. | ||
1221 | |||
1222 | function rijndaelEncrypt(plaintext, key, mode) { | ||
1223 | var expandedKey, i, aBlock; | ||
1224 | var bpb = blockSizeInBits / 8; // bytes per block | ||
1225 | var ct; // ciphertext | ||
1226 | |||
1227 | if (!plaintext || !key) | ||
1228 | return; | ||
1229 | if (key.length*8 != keySizeInBits) | ||
1230 | return; | ||
1231 | if (mode == "CBC") { | ||
1232 | ct = getRandomBytes(bpb); // get IV | ||
1233 | //dump("IV", byteArrayToHex(ct)); | ||
1234 | } else { | ||
1235 | mode = "ECB"; | ||
1236 | ct = new Array(); | ||
1237 | } | ||
1238 | |||
1239 | // convert plaintext to byte array and pad with zeros if necessary. | ||
1240 | plaintext = formatPlaintext(plaintext); | ||
1241 | |||
1242 | expandedKey = keyExpansion(key); | ||
1243 | |||
1244 | for (var block = 0; block < plaintext.length / bpb; block++) { | ||
1245 | aBlock = plaintext.slice(block * bpb, (block + 1) * bpb); | ||
1246 | if (mode == "CBC") { | ||
1247 | for (var i = 0; i < bpb; i++) { | ||
1248 | aBlock[i] ^= ct[(block * bpb) + i]; | ||
1249 | } | ||
1250 | } | ||
1251 | ct = ct.concat(encrypt(aBlock, expandedKey)); | ||
1252 | } | ||
1253 | |||
1254 | return ct; | ||
1255 | } | ||
1256 | |||
1257 | // rijndaelDecrypt(ciphertext, key, mode) | ||
1258 | // Decrypts the using the given key and mode. The parameter "ciphertext" | ||
1259 | // must be an array of bytes. The parameter "key" must be an array of key | ||
1260 | // bytes. If you have a hex string representing the ciphertext or key, | ||
1261 | // invoke hexToByteArray() on it to convert it to an array of bytes. The | ||
1262 | // parameter "mode" is a string, either "CBC" or "ECB". | ||
1263 | // | ||
1264 | // An array of bytes representing the plaintext is returned. To convert | ||
1265 | // this array to a hex string, invoke byteArrayToHex() on it. To convert it | ||
1266 | // to a string of characters, you can use byteArrayToString(). | ||
1267 | |||
1268 | function rijndaelDecrypt(ciphertext, key, mode) { | ||
1269 | var expandedKey; | ||
1270 | var bpb = blockSizeInBits / 8; // bytes per block | ||
1271 | var pt = new Array(); // plaintext array | ||
1272 | var aBlock; // a decrypted block | ||
1273 | var block; // current block number | ||
1274 | |||
1275 | if (!ciphertext || !key || typeof ciphertext == "string") | ||
1276 | return; | ||
1277 | if (key.length*8 != keySizeInBits) | ||
1278 | return; | ||
1279 | if (!mode) { | ||
1280 | mode = "ECB"; // assume ECB if mode omitted | ||
1281 | } | ||
1282 | |||
1283 | expandedKey = keyExpansion(key); | ||
1284 | |||
1285 | // work backwards to accomodate CBC mode | ||
1286 | for (block=(ciphertext.length / bpb)-1; block>0; block--) { | ||
1287 | aBlock = | ||
1288 | decrypt(ciphertext.slice(block*bpb,(block+1)*bpb), expandedKey); | ||
1289 | if (mode == "CBC") | ||
1290 | for (var i=0; i<bpb; i++) | ||
1291 | pt[(block-1)*bpb + i] = aBlock[i] ^ ciphertext[(block-1)*bpb + i]; | ||
1292 | else | ||
1293 | pt = aBlock.concat(pt); | ||
1294 | } | ||
1295 | |||
1296 | // do last block if ECB (skips the IV in CBC) | ||
1297 | if (mode == "ECB") | ||
1298 | pt = decrypt(ciphertext.slice(0, bpb), expandedKey).concat(pt); | ||
1299 | |||
1300 | return pt; | ||
1301 | } | ||
1302 | |||
1303 | //############################################################################# | ||
1304 | //Downloaded on March 30, 2006 from http://www.fourmilab.ch/javascrypt/javascrypt.zip (utf-8.js) | ||
1305 | //############################################################################# | ||
1306 | |||
1307 | |||
1308 | /*Encoding and decoding of Unicode character strings as | ||
1309 | UTF-8 byte streams. */ | ||
1310 | |||
1311 | //UNICODE_TO_UTF8 -- Encode Unicode argument string as UTF-8 return value | ||
1312 | |||
1313 | function unicode_to_utf8(s) { | ||
1314 | var utf8 = ""; | ||
1315 | |||
1316 | for (var n = 0; n < s.length; n++) { | ||
1317 | var c = s.charCodeAt(n); | ||
1318 | |||
1319 | if (c <= 0x7F) { | ||
1320 | // 0x00 - 0x7F: Emit as single byte, unchanged | ||
1321 | utf8 += String.fromCharCode(c); | ||
1322 | } else if ((c >= 0x80) && (c <= 0x7FF)) { | ||
1323 | // 0x80 - 0x7FF: Output as two byte code, 0xC0 in first byte | ||
1324 | // 0x80 in second byte | ||
1325 | utf8 += String.fromCharCode((c >> 6) | 0xC0); | ||
1326 | utf8 += String.fromCharCode((c & 0x3F) | 0x80); | ||
1327 | } else { | ||
1328 | // 0x800 - 0xFFFF: Output as three bytes, 0xE0 in first byte | ||
1329 | // 0x80 in second byte | ||
1330 | // 0x80 in third byte | ||
1331 | utf8 += String.fromCharCode((c >> 12) | 0xE0); | ||
1332 | utf8 += String.fromCharCode(((c >> 6) & 0x3F) | 0x80); | ||
1333 | utf8 += String.fromCharCode((c & 0x3F) | 0x80); | ||
1334 | } | ||
1335 | } | ||
1336 | return utf8; | ||
1337 | } | ||
1338 | |||
1339 | //UTF8_TO_UNICODE -- Decode UTF-8 argument into Unicode string return value | ||
1340 | |||
1341 | function utf8_to_unicode(utf8) { | ||
1342 | var s = "", i = 0, b1, b2, b2; | ||
1343 | |||
1344 | while (i < utf8.length) { | ||
1345 | b1 = utf8.charCodeAt(i); | ||
1346 | if (b1 < 0x80) { // One byte code: 0x00 0x7F | ||
1347 | s += String.fromCharCode(b1); | ||
1348 | i++; | ||
1349 | } else if((b1 >= 0xC0) && (b1 < 0xE0)) {// Two byte code: 0x80 - 0x7FF | ||
1350 | b2 = utf8.charCodeAt(i + 1); | ||
1351 | s += String.fromCharCode(((b1 & 0x1F) << 6) | (b2 & 0x3F)); | ||
1352 | i += 2; | ||
1353 | } else { // Three byte code: 0x800 - 0xFFFF | ||
1354 | b2 = utf8.charCodeAt(i + 1); | ||
1355 | b3 = utf8.charCodeAt(i + 2); | ||
1356 | s += String.fromCharCode(((b1 & 0xF) << 12) | | ||
1357 | ((b2 & 0x3F) << 6) | | ||
1358 | (b3 & 0x3F)); | ||
1359 | i += 3; | ||
1360 | } | ||
1361 | } | ||
1362 | return s; | ||
1363 | } | ||
1364 | |||
1365 | /*ENCODE_UTF8 -- Encode string as UTF8 only if it contains | ||
1366 | a character of 0x9D (Unicode OPERATING | ||
1367 | SYSTEM COMMAND) or a character greater | ||
1368 | than 0xFF. This permits all strings | ||
1369 | consisting exclusively of 8 bit | ||
1370 | graphic characters to be encoded as | ||
1371 | themselves. We choose 0x9D as the sentinel | ||
1372 | character as opposed to one of the more | ||
1373 | logical PRIVATE USE characters because 0x9D | ||
1374 | is not overloaded by the regrettable | ||
1375 | "Windows-1252" character set. Now such characters | ||
1376 | don't belong in JavaScript strings, but you never | ||
1377 | know what somebody is going to paste into a | ||
1378 | text box, so this choice keeps Windows-encoded | ||
1379 | strings from bloating to UTF-8 encoding. */ | ||
1380 | |||
1381 | function encode_utf8(s) { | ||
1382 | var i, necessary = false; | ||
1383 | |||
1384 | for (i = 0; i < s.length; i++) { | ||
1385 | if ((s.charCodeAt(i) == 0x9D) || | ||
1386 | (s.charCodeAt(i) > 0xFF)) { | ||
1387 | necessary = true; | ||
1388 | break; | ||
1389 | } | ||
1390 | } | ||
1391 | if (!necessary) { | ||
1392 | return s; | ||
1393 | } | ||
1394 | return String.fromCharCode(0x9D) + unicode_to_utf8(s); | ||
1395 | } | ||
1396 | |||
1397 | /* DECODE_UTF8 -- Decode a string encoded with encode_utf8 | ||
1398 | above. If the string begins with the | ||
1399 | sentinel character 0x9D (OPERATING | ||
1400 | SYSTEM COMMAND), then we decode the | ||
1401 | balance as a UTF-8 stream. Otherwise, | ||
1402 | the string is output unchanged, as | ||
1403 | it's guaranteed to contain only 8 bit | ||
1404 | characters excluding 0x9D. */ | ||
1405 | |||
1406 | function decode_utf8(s) { | ||
1407 | if ((s.length > 0) && (s.charCodeAt(0) == 0x9D)) { | ||
1408 | return utf8_to_unicode(s.substring(1)); | ||
1409 | } | ||
1410 | return s; | ||
1411 | } | ||
1412 | |||
1413 | |||
1414 | //############################################################################# | ||
1415 | //Downloaded on April 26, 2006 from http://pajhome.org.uk/crypt/md5/md5.js | ||
1416 | //############################################################################# | ||
1417 | |||
1418 | /* | ||
1419 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message | ||
1420 | * Digest Algorithm, as defined in RFC 1321. | ||
1421 | * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. | ||
1422 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | ||
1423 | * Distributed under the BSD License | ||
1424 | * See http://pajhome.org.uk/crypt/md5 for more info. | ||
1425 | */ | ||
1426 | |||
1427 | /* | ||
1428 | * Configurable variables. You may need to tweak these to be compatible with | ||
1429 | * the server-side, but the defaults work in most cases. | ||
1430 | */ | ||
1431 | var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
1432 | var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ | ||
1433 | var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | ||
1434 | |||
1435 | /* | ||
1436 | * These are the functions you'll usually want to call | ||
1437 | * They take string arguments and return either hex or base-64 encoded strings | ||
1438 | */ | ||
1439 | function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} | ||
1440 | function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} | ||
1441 | function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} | ||
1442 | function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } | ||
1443 | function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } | ||
1444 | function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } | ||
1445 | |||
1446 | /* | ||
1447 | * Perform a simple self-test to see if the VM is working | ||
1448 | */ | ||
1449 | function md5_vm_test() | ||
1450 | { | ||
1451 | return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; | ||
1452 | } | ||
1453 | |||
1454 | /* | ||
1455 | * Calculate the MD5 of an array of little-endian words, and a bit length | ||
1456 | */ | ||
1457 | function core_md5(x, len) | ||
1458 | { | ||
1459 | /* append padding */ | ||
1460 | x[len >> 5] |= 0x80 << ((len) % 32); | ||
1461 | x[(((len + 64) >>> 9) << 4) + 14] = len; | ||
1462 | |||
1463 | var a = 1732584193; | ||
1464 | var b = -271733879; | ||
1465 | var c = -1732584194; | ||
1466 | var d = 271733878; | ||
1467 | |||
1468 | for(var i = 0; i < x.length; i += 16) | ||
1469 | { | ||
1470 | var olda = a; | ||
1471 | var oldb = b; | ||
1472 | var oldc = c; | ||
1473 | var oldd = d; | ||
1474 | |||
1475 | a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); | ||
1476 | d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); | ||
1477 | c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); | ||
1478 | b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); | ||
1479 | a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); | ||
1480 | d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); | ||
1481 | c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); | ||
1482 | b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); | ||
1483 | a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); | ||
1484 | d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); | ||
1485 | c = md5_ff(c, d, a, b, x[i+10], 17, -42063); | ||
1486 | b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); | ||
1487 | a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); | ||
1488 | d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); | ||
1489 | c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); | ||
1490 | b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); | ||
1491 | |||
1492 | a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); | ||
1493 | d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); | ||
1494 | c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); | ||
1495 | b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); | ||
1496 | a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); | ||
1497 | d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); | ||
1498 | c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); | ||
1499 | b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); | ||
1500 | a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); | ||
1501 | d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); | ||
1502 | c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); | ||
1503 | b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); | ||
1504 | a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); | ||
1505 | d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); | ||
1506 | c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); | ||
1507 | b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); | ||
1508 | |||
1509 | a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); | ||
1510 | d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); | ||
1511 | c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); | ||
1512 | b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); | ||
1513 | a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); | ||
1514 | d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); | ||
1515 | c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); | ||
1516 | b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); | ||
1517 | a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); | ||
1518 | d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); | ||
1519 | c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); | ||
1520 | b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); | ||
1521 | a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); | ||
1522 | d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); | ||
1523 | c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); | ||
1524 | b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); | ||
1525 | |||
1526 | a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); | ||
1527 | d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); | ||
1528 | c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); | ||
1529 | b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); | ||
1530 | a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); | ||
1531 | d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); | ||
1532 | c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); | ||
1533 | b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); | ||
1534 | a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); | ||
1535 | d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); | ||
1536 | c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); | ||
1537 | b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); | ||
1538 | a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); | ||
1539 | d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); | ||
1540 | c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); | ||
1541 | b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); | ||
1542 | |||
1543 | a = safe_add(a, olda); | ||
1544 | b = safe_add(b, oldb); | ||
1545 | c = safe_add(c, oldc); | ||
1546 | d = safe_add(d, oldd); | ||
1547 | } | ||
1548 | return Array(a, b, c, d); | ||
1549 | |||
1550 | } | ||
1551 | |||
1552 | /* | ||
1553 | * These functions implement the four basic operations the algorithm uses. | ||
1554 | */ | ||
1555 | function md5_cmn(q, a, b, x, s, t) | ||
1556 | { | ||
1557 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); | ||
1558 | } | ||
1559 | function md5_ff(a, b, c, d, x, s, t) | ||
1560 | { | ||
1561 | return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); | ||
1562 | } | ||
1563 | function md5_gg(a, b, c, d, x, s, t) | ||
1564 | { | ||
1565 | return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); | ||
1566 | } | ||
1567 | function md5_hh(a, b, c, d, x, s, t) | ||
1568 | { | ||
1569 | return md5_cmn(b ^ c ^ d, a, b, x, s, t); | ||
1570 | } | ||
1571 | function md5_ii(a, b, c, d, x, s, t) | ||
1572 | { | ||
1573 | return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); | ||
1574 | } | ||
1575 | |||
1576 | /* | ||
1577 | * Calculate the HMAC-MD5, of a key and some data | ||
1578 | */ | ||
1579 | function core_hmac_md5(key, data) | ||
1580 | { | ||
1581 | var bkey = str2binl(key); | ||
1582 | if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); | ||
1583 | |||
1584 | var ipad = Array(16), opad = Array(16); | ||
1585 | for(var i = 0; i < 16; i++) | ||
1586 | { | ||
1587 | ipad[i] = bkey[i] ^ 0x36363636; | ||
1588 | opad[i] = bkey[i] ^ 0x5C5C5C5C; | ||
1589 | } | ||
1590 | |||
1591 | var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); | ||
1592 | return core_md5(opad.concat(hash), 512 + 128); | ||
1593 | } | ||
1594 | |||
1595 | /* | ||
1596 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally | ||
1597 | * to work around bugs in some JS interpreters. | ||
1598 | */ | ||
1599 | function safe_add(x, y) | ||
1600 | { | ||
1601 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); | ||
1602 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | ||
1603 | return (msw << 16) | (lsw & 0xFFFF); | ||
1604 | } | ||
1605 | |||
1606 | /* | ||
1607 | * Bitwise rotate a 32-bit number to the left. | ||
1608 | */ | ||
1609 | function bit_rol(num, cnt) | ||
1610 | { | ||
1611 | return (num << cnt) | (num >>> (32 - cnt)); | ||
1612 | } | ||
1613 | |||
1614 | /* | ||
1615 | * Convert a string to an array of little-endian words | ||
1616 | * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. | ||
1617 | */ | ||
1618 | function str2binl(str) | ||
1619 | { | ||
1620 | var bin = Array(); | ||
1621 | var mask = (1 << chrsz) - 1; | ||
1622 | for(var i = 0; i < str.length * chrsz; i += chrsz) | ||
1623 | bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); | ||
1624 | return bin; | ||
1625 | } | ||
1626 | |||
1627 | /* | ||
1628 | * Convert an array of little-endian words to a string | ||
1629 | */ | ||
1630 | function binl2str(bin) | ||
1631 | { | ||
1632 | var str = ""; | ||
1633 | var mask = (1 << chrsz) - 1; | ||
1634 | for(var i = 0; i < bin.length * 32; i += chrsz) | ||
1635 | str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); | ||
1636 | return str; | ||
1637 | } | ||
1638 | |||
1639 | /* | ||
1640 | * Convert an array of little-endian words to a hex string. | ||
1641 | */ | ||
1642 | function binl2hex(binarray) | ||
1643 | { | ||
1644 | var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; | ||
1645 | var str = ""; | ||
1646 | for(var i = 0; i < binarray.length * 4; i++) | ||
1647 | { | ||
1648 | str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + | ||
1649 | hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); | ||
1650 | } | ||
1651 | return str; | ||
1652 | } | ||
1653 | |||
1654 | /* | ||
1655 | * Convert an array of little-endian words to a base-64 string | ||
1656 | */ | ||
1657 | function binl2b64(binarray) | ||
1658 | { | ||
1659 | var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
1660 | var str = ""; | ||
1661 | for(var i = 0; i < binarray.length * 4; i += 3) | ||
1662 | { | ||
1663 | var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | ||
1664 | | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ||
1665 | | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); | ||
1666 | for(var j = 0; j < 4; j++) | ||
1667 | { | ||
1668 | if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; | ||
1669 | else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); | ||
1670 | } | ||
1671 | } | ||
1672 | return str; | ||
1673 | } | ||
1674 | |||
1675 | |||
1676 | //############################################################################# | ||
1677 | //############################################################################# | ||
1678 | //############################################################################# | ||
1679 | |||
1680 | |||
1681 | |||
1682 | MochiKit.Base.update(Clipperz.Crypto.Base, { | ||
1683 | |||
1684 | '__repr__': function () { | ||
1685 | return "[" + this.NAME + " " + this.VERSION + "]"; | ||
1686 | }, | ||
1687 | |||
1688 | 'toString': function () { | ||
1689 | return this.__repr__(); | ||
1690 | }, | ||
1691 | |||
1692 | //----------------------------------------------------------------------------- | ||
1693 | |||
1694 | 'encryptUsingSecretKey': function (aKey, aMessage) { | ||
1695 | //Clipperz.Profile.start("Clipperz.Crypto.Base.encryptUsingSecretKey"); | ||
1696 | var result; | ||
1697 | var plaintext; | ||
1698 | varheader; | ||
1699 | varkey; | ||
1700 | |||
1701 | key = hexToByteArray(Clipperz.Crypto.Base.computeHashValue(aKey)); | ||
1702 | |||
1703 | addEntropyTime(); | ||
1704 | prng = new AESprng(keyFromEntropy()); | ||
1705 | |||
1706 | plaintext = encode_utf8(aMessage); | ||
1707 | |||
1708 | header = Clipperz.Base.byteArrayToString(hexToByteArray(Clipperz.Crypto.Base.computeMD5HashValue(plaintext))); | ||
1709 | |||
1710 | // Add message length in bytes to header | ||
1711 | i = plaintext.length; | ||
1712 | header += String.fromCharCode(i >>> 24); | ||
1713 | header += String.fromCharCode(i >>> 16); | ||
1714 | header += String.fromCharCode(i >>> 8); | ||
1715 | header += String.fromCharCode(i & 0xFF); | ||
1716 | |||
1717 | //The format of the actual message passed to rijndaelEncrypt | ||
1718 | //is: | ||
1719 | // | ||
1720 | // Bytes Content | ||
1721 | // 0-15 MD5 signature of plaintext | ||
1722 | // 16-19 Length of plaintext, big-endian order | ||
1723 | // 20-end Plaintext | ||
1724 | // | ||
1725 | //Note that this message will be padded with zero bytes | ||
1726 | //to an integral number of AES blocks (blockSizeInBits / 8). | ||
1727 | //This does not include the initial vector for CBC | ||
1728 | //encryption, which is added internally by rijndaelEncrypt. | ||
1729 | result = byteArrayToHex(rijndaelEncrypt(header + plaintext, key, "CBC")); | ||
1730 | |||
1731 | delete prng; | ||
1732 | |||
1733 | //Clipperz.Profile.stop("Clipperz.Crypto.Base.encryptUsingSecretKey"); | ||
1734 | return result; | ||
1735 | }, | ||
1736 | |||
1737 | //............................................................................. | ||
1738 | |||
1739 | 'decryptUsingSecretKey': function (aKey, aMessage) { | ||
1740 | //Clipperz.Profile.start("Clipperz.Crypto.Base.decryptUsingSecretKey"); | ||
1741 | varkey; | ||
1742 | var decryptedText; | ||
1743 | vartextLength; | ||
1744 | varheader; | ||
1745 | varheaderDigest; | ||
1746 | var plaintext; | ||
1747 | var i; | ||
1748 | |||
1749 | key = hexToByteArray(Clipperz.Crypto.Base.computeHashValue(aKey)); | ||
1750 | |||
1751 | decryptedText = rijndaelDecrypt(hexToByteArray(aMessage), key, "CBC"); | ||
1752 | |||
1753 | header = decryptedText.slice(0, 20); | ||
1754 | decryptedText = decryptedText.slice(20); | ||
1755 | |||
1756 | headerDigest = byteArrayToHex(header.slice(0,16)); | ||
1757 | textLength = (header[16] << 24) | (header[17] << 16) | (header[18] << 8) | header[19]; | ||
1758 | |||
1759 | if ((textLength < 0) || (textLength > decryptedText.length)) { | ||
1760 | // jslog.warning("Message (length " + decryptedText.length + ") truncated. " + textLength + " characters expected."); | ||
1761 | //Try to sauve qui peut by setting length to entire message | ||
1762 | textLength = decryptedText.length; | ||
1763 | } | ||
1764 | |||
1765 | plainText = ""; | ||
1766 | |||
1767 | for (i=0; i<textLength; i++) { | ||
1768 | plainText += String.fromCharCode(decryptedText[i]); | ||
1769 | } | ||
1770 | |||
1771 | if (Clipperz.Crypto.Base.computeMD5HashValue(plainText) != headerDigest) { | ||
1772 | // jslog.warning("Message corrupted. Checksum of decrypted message does not match."); | ||
1773 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | ||
1774 | // throw new Error("Message corrupted. Checksum of decrypted message does not match. Parsed result: " + decode_utf8(plainText)); | ||
1775 | } | ||
1776 | |||
1777 | // That's it; plug plaintext into the result field | ||
1778 | |||
1779 | result = decode_utf8(plainText); | ||
1780 | |||
1781 | //Clipperz.Profile.stop("Clipperz.Crypto.Base.decryptUsingSecretKey"); | ||
1782 | return result; | ||
1783 | }, | ||
1784 | |||
1785 | //----------------------------------------------------------------------------- | ||
1786 | |||
1787 | 'computeHashValue': function (aMessage) { | ||
1788 | //Clipperz.Profile.start("Clipperz.Crypto.Base.computeHashValue"); | ||
1789 | varresult; | ||
1790 | |||
1791 | result = hex_sha256(aMessage); | ||
1792 | //Clipperz.Profile.stop("Clipperz.Crypto.Base.computeHashValue"); | ||
1793 | |||
1794 | return result; | ||
1795 | }, | ||
1796 | |||
1797 | //......................................................................... | ||
1798 | |||
1799 | 'computeMD5HashValue': function (aMessage) { | ||
1800 | varresult; | ||
1801 | //Clipperz.Profile.start("Clipperz.Crypto.Base.computeMD5HashValue"); | ||
1802 | result = hex_md5(aMessage); | ||
1803 | //Clipperz.Profile.stop("Clipperz.Crypto.Base.computeMD5HashValue"); | ||
1804 | |||
1805 | return result; | ||
1806 | }, | ||
1807 | |||
1808 | //----------------------------------------------------------------------------- | ||
1809 | |||
1810 | 'generateRandomSeed': function () { | ||
1811 | //Clipperz.Profile.start("Clipperz.Crypto.Base.generateRandomSeed"); | ||
1812 | varresult; | ||
1813 | var seed; | ||
1814 | var prng; | ||
1815 | var charA; | ||
1816 | var i; | ||
1817 | |||
1818 | addEntropyTime(); | ||
1819 | |||
1820 | seed = keyFromEntropy(); | ||
1821 | prng = new AESprng(seed); | ||
1822 | |||
1823 | result = ""; | ||
1824 | charA = ("A").charCodeAt(0); | ||
1825 | |||
1826 | for (i = 0; i < 64; i++) { | ||
1827 | result += String.fromCharCode(charA + prng.nextInt(25)); | ||
1828 | } | ||
1829 | |||
1830 | delete prng; | ||
1831 | |||
1832 | result = Clipperz.Crypto.Base.computeHashValue(result); | ||
1833 | |||
1834 | //Clipperz.Profile.stop("Clipperz.Crypto.Base.generateRandomSeed"); | ||
1835 | return result; | ||
1836 | }, | ||
1837 | |||
1838 | //----------------------------------------------------------------------------- | ||
1839 | |||
1840 | 'exception': { | ||
1841 | 'CorruptedMessage': new MochiKit.Base.NamedError("Clipperz.Crypto.Base.exception.CorruptedMessage") | ||
1842 | }, | ||
1843 | |||
1844 | //......................................................................... | ||
1845 | __syntaxFix__: "syntax fix" | ||
1846 | }); | ||
1847 | |||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/BigInt.js b/frontend/gamma/js/ClipperzCryptoLibrary/BigInt.js new file mode 100644 index 0000000..197cd9a --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/BigInt.js | |||
@@ -0,0 +1,1755 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
25 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | ||
26 | |||
27 | //############################################################################# | ||
28 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js | ||
29 | //############################################################################# | ||
30 | |||
31 | |||
32 | //////////////////////////////////////////////////////////////////////////////////////// | ||
33 | // Big Integer Library v. 5.0 | ||
34 | // Created 2000, last modified 2006 | ||
35 | // Leemon Baird | ||
36 | // www.leemon.com | ||
37 | // | ||
38 | // This file is public domain. You can use it for any purpose without restriction. | ||
39 | // I do not guarantee that it is correct, so use it at your own risk. If you use | ||
40 | // it for something interesting, I'd appreciate hearing about it. If you find | ||
41 | // any bugs or make any improvements, I'd appreciate hearing about those too. | ||
42 | // It would also be nice if my name and address were left in the comments. | ||
43 | // But none of that is required. | ||
44 | // | ||
45 | // This code defines a bigInt library for arbitrary-precision integers. | ||
46 | // A bigInt is an array of integers storing the value in chunks of bpe bits, | ||
47 | // little endian (buff[0] is the least significant word). | ||
48 | // Negative bigInts are stored two's complement. | ||
49 | // Some functions assume their parameters have at least one leading zero element. | ||
50 | // Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, | ||
51 | // so the caller must make sure overflow won't happen. | ||
52 | // For each function where a parameter is modified, that same | ||
53 | // variable must not be used as another argument too. | ||
54 | // So, you cannot square x by doing multMod_(x,x,n). | ||
55 | // You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). | ||
56 | // | ||
57 | // These functions are designed to avoid frequent dynamic memory allocation in the inner loop. | ||
58 | // For most functions, if it needs a BigInt as a local variable it will actually use | ||
59 | // a global, and will only allocate to it when it's not the right size. This ensures | ||
60 | // that when a function is called repeatedly with same-sized parameters, it only allocates | ||
61 | // memory on the first call. | ||
62 | // | ||
63 | // Note that for cryptographic purposes, the calls to Math.random() must | ||
64 | // be replaced with calls to a better pseudorandom number generator. | ||
65 | // | ||
66 | // In the following, "bigInt" means a bigInt with at least one leading zero element, | ||
67 | // and "integer" means a nonnegative integer less than radix. In some cases, integer | ||
68 | // can be negative. Negative bigInts are 2s complement. | ||
69 | // | ||
70 | // The following functions do not modify their inputs, but dynamically allocate memory every time they are called: | ||
71 | // | ||
72 | // function bigInt2str(x,base) //convert a bigInt into a string in a given base, from base 2 up to base 95 | ||
73 | // function dup(x) //returns a copy of bigInt x | ||
74 | // function findPrimes(n) //return array of all primes less than integer n | ||
75 | // function int2bigInt(t,n,m) //convert integer t to a bigInt with at least n bits and m array elements | ||
76 | // function int2bigInt(s,b,n,m) //convert string s in base b to a bigInt with at least n bits and m array elements | ||
77 | // function trim(x,k) //return a copy of x with exactly k leading zero elements | ||
78 | // | ||
79 | // The following functions do not modify their inputs, so there is never a problem with the result being too big: | ||
80 | // | ||
81 | // function bitSize(x) //returns how many bits long the bigInt x is, not counting leading zeros | ||
82 | // function equals(x,y) //is the bigInt x equal to the bigint y? | ||
83 | // function equalsInt(x,y) //is bigint x equal to integer y? | ||
84 | // function greater(x,y) //is x>y? (x and y are nonnegative bigInts) | ||
85 | // function greaterShift(x,y,shift)//is (x <<(shift*bpe)) > y? | ||
86 | // function isZero(x) //is the bigInt x equal to zero? | ||
87 | // function millerRabin(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime (as opposed to definitely composite)? | ||
88 | // function modInt(x,n) //return x mod n for bigInt x and integer n. | ||
89 | // function negative(x) //is bigInt x negative? | ||
90 | // | ||
91 | // The following functions do not modify their inputs, but allocate memory and call functions with underscores | ||
92 | // | ||
93 | // function add(x,y) //return (x+y) for bigInts x and y. | ||
94 | // function addInt(x,n) //return (x+n) where x is a bigInt and n is an integer. | ||
95 | // function expand(x,n) //return a copy of x with at least n elements, adding leading zeros if needed | ||
96 | // function inverseMod(x,n) //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null | ||
97 | // function mod(x,n) //return a new bigInt equal to (x mod n) for bigInts x and n. | ||
98 | // function mult(x,y) //return x*y for bigInts x and y. This is faster when y<x. | ||
99 | // function multMod(x,y,n) //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x. | ||
100 | // function powMod(x,y,n) //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n. | ||
101 | // function randTruePrime(k) //return a new, random, k-bit, true prime using Maurer's algorithm. | ||
102 | // function sub(x,y) //return (x-y) for bigInts x and y. Negative answers will be 2s complement | ||
103 | // | ||
104 | // The following functions write a bigInt result to one of the parameters, but | ||
105 | // the result is never bigger than the original, so there can't be overflow problems: | ||
106 | // | ||
107 | // function divInt_(x,n) //do x=floor(x/n) for bigInt x and integer n, and return the remainder | ||
108 | // function GCD_(x,y) //set x to the greatest common divisor of bigInts x and y, (y is destroyed). | ||
109 | // function halve_(x) //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement | ||
110 | // function mod_(x,n) //do x=x mod n for bigInts x and n. | ||
111 | // function rightShift_(x,n) //right shift bigInt x by n bits. 0 <= n < bpe. | ||
112 | // | ||
113 | // The following functions write a bigInt result to one of the parameters. The caller is responsible for | ||
114 | // ensuring it is large enough to hold the result. | ||
115 | // | ||
116 | // function addInt_(x,n) //do x=x+n where x is a bigInt and n is an integer | ||
117 | // function add_(x,y) //do x=x+y for bigInts x and y | ||
118 | // function addShift_(x,y,ys) //do x=x+(y<<(ys*bpe)) | ||
119 | // function copy_(x,y) //do x=y on bigInts x and y | ||
120 | // function copyInt_(x,n) //do x=n on bigInt x and integer n | ||
121 | // function carry_(x) //do carries and borrows so each element of the bigInt x fits in bpe bits. | ||
122 | // function divide_(x,y,q,r) //divide_ x by y giving quotient q and remainder r | ||
123 | // function eGCD_(x,y,d,a,b) //sets a,b,d to positive big integers such that d = GCD_(x,y) = a*x-b*y | ||
124 | // function inverseMod_(x,n) //do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist | ||
125 | // function inverseModInt_(x,n) //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse | ||
126 | // function leftShift_(x,n) //left shift bigInt x by n bits. n<bpe. | ||
127 | // function linComb_(x,y,a,b) //do x=a*x+b*y for bigInts x and y and integers a and b | ||
128 | // function linCombShift_(x,y,b,ys) //do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys | ||
129 | // function mont_(x,y,n,np) //Montgomery multiplication (see comments where the function is defined) | ||
130 | // function mult_(x,y) //do x=x*y for bigInts x and y. | ||
131 | // function multInt_(x,n) //do x=x*n where x is a bigInt and n is an integer. | ||
132 | // function multMod_(x,y,n) //do x=x*y mod n for bigInts x,y,n. | ||
133 | // function powMod_(x,y,n) //do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1. | ||
134 | // function randBigInt_(b,n,s) //do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1. | ||
135 | // function randTruePrime_(ans,k) //do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb. | ||
136 | // function squareMod_(x,n) //do x=x*x mod n for bigInts x,n | ||
137 | // function sub_(x,y) //do x=x-y for bigInts x and y. Negative answers will be 2s complement. | ||
138 | // function subShift_(x,y,ys) //do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement. | ||
139 | // | ||
140 | // The following functions are based on algorithms from the _Handbook of Applied Cryptography_ | ||
141 | // powMod_() = algorithm 14.94, Montgomery exponentiation | ||
142 | // eGCD_,inverseMod_() = algorithm 14.61, Binary extended GCD_ | ||
143 | // GCD_() = algorothm 14.57, Lehmer's algorithm | ||
144 | // mont_() = algorithm 14.36, Montgomery multiplication | ||
145 | // divide_() = algorithm 14.20 Multiple-precision division | ||
146 | // squareMod_() = algorithm 14.16 Multiple-precision squaring | ||
147 | // randTruePrime_() = algorithm 4.62, Maurer's algorithm | ||
148 | // millerRabin() = algorithm 4.24, Miller-Rabin algorithm | ||
149 | // | ||
150 | // Profiling shows: | ||
151 | // randTruePrime_() spends: | ||
152 | // 10% of its time in calls to powMod_() | ||
153 | // 85% of its time in calls to millerRabin() | ||
154 | // millerRabin() spends: | ||
155 | // 99% of its time in calls to powMod_() (always with a base of 2) | ||
156 | // powMod_() spends: | ||
157 | // 94% of its time in calls to mont_() (almost always with x==y) | ||
158 | // | ||
159 | // This suggests there are several ways to speed up this library slightly: | ||
160 | // - convert powMod_ to use a Montgomery form of k-ary window (or maybe a Montgomery form of sliding window) | ||
161 | // -- this should especially focus on being fast when raising 2 to a power mod n | ||
162 | // - convert randTruePrime_() to use a minimum r of 1/3 instead of 1/2 with the appropriate change to the test | ||
163 | // - tune the parameters in randTruePrime_(), including c, m, and recLimit | ||
164 | // - speed up the single loop in mont_() that takes 95% of the runtime, perhaps by reducing checking | ||
165 | // within the loop when all the parameters are the same length. | ||
166 | // | ||
167 | // There are several ideas that look like they wouldn't help much at all: | ||
168 | // - replacing trial division in randTruePrime_() with a sieve (that speeds up something taking almost no time anyway) | ||
169 | // - increase bpe from 15 to 30 (that would help if we had a 32*32->64 multiplier, but not with JavaScript's 32*32->32) | ||
170 | // - speeding up mont_(x,y,n,np) when x==y by doing a non-modular, non-Montgomery square | ||
171 | // followed by a Montgomery reduction. The intermediate answer will be twice as long as x, so that | ||
172 | // method would be slower. This is unfortunate because the code currently spends almost all of its time | ||
173 | // doing mont_(x,x,...), both for randTruePrime_() and powMod_(). A faster method for Montgomery squaring | ||
174 | // would have a large impact on the speed of randTruePrime_() and powMod_(). HAC has a couple of poorly-worded | ||
175 | // sentences that seem to imply it's faster to do a non-modular square followed by a single | ||
176 | // Montgomery reduction, but that's obviously wrong. | ||
177 | //////////////////////////////////////////////////////////////////////////////////////// | ||
178 | |||
179 | //globals | ||
180 | bpe=0; //bits stored per array element | ||
181 | mask=0; //AND this with an array element to chop it down to bpe bits | ||
182 | radix=mask+1; //equals 2^bpe. A single 1 bit to the left of the last bit of mask. | ||
183 | |||
184 | //the digits for converting to different bases | ||
185 | digitsStr='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\\'\"+-'; | ||
186 | |||
187 | //initialize the global variables | ||
188 | for (bpe=0; (1<<(bpe+1)) > (1<<bpe); bpe++); //bpe=number of bits in the mantissa on this platform | ||
189 | bpe>>=1; //bpe=number of bits in one element of the array representing the bigInt | ||
190 | mask=(1<<bpe)-1; //AND the mask with an integer to get its bpe least significant bits | ||
191 | radix=mask+1; //2^bpe. a single 1 bit to the left of the first bit of mask | ||
192 | one=int2bigInt(1,1,1); //constant used in powMod_() | ||
193 | |||
194 | //the following global variables are scratchpad memory to | ||
195 | //reduce dynamic memory allocation in the inner loop | ||
196 | t=new Array(0); | ||
197 | ss=t; //used in mult_() | ||
198 | s0=t; //used in multMod_(), squareMod_() | ||
199 | s1=t; //used in powMod_(), multMod_(), squareMod_() | ||
200 | s2=t; //used in powMod_(), multMod_() | ||
201 | s3=t; //used in powMod_() | ||
202 | s4=t; s5=t; //used in mod_() | ||
203 | s6=t; //used in bigInt2str() | ||
204 | s7=t; //used in powMod_() | ||
205 | T=t; //used in GCD_() | ||
206 | sa=t; //used in mont_() | ||
207 | mr_x1=t; mr_r=t; mr_a=t; //used in millerRabin() | ||
208 | eg_v=t; eg_u=t; eg_A=t; eg_B=t; eg_C=t; eg_D=t; //used in eGCD_(), inverseMod_() | ||
209 | md_q1=t; md_q2=t; md_q3=t; md_r=t; md_r1=t; md_r2=t; md_tt=t; //used in mod_() | ||
210 | |||
211 | primes=t; pows=t; s_i=t; s_i2=t; s_R=t; s_rm=t; s_q=t; s_n1=t; | ||
212 | s_a=t; s_r2=t; s_n=t; s_b=t; s_d=t; s_x1=t; s_x2=t, s_aa=t; //used in randTruePrime_() | ||
213 | |||
214 | //////////////////////////////////////////////////////////////////////////////////////// | ||
215 | |||
216 | //return array of all primes less than integer n | ||
217 | function findPrimes(n) { | ||
218 | var i,s,p,ans; | ||
219 | s=new Array(n); | ||
220 | for (i=0;i<n;i++) | ||
221 | s[i]=0; | ||
222 | s[0]=2; | ||
223 | p=0; //first p elements of s are primes, the rest are a sieve | ||
224 | for(;s[p]<n;) { //s[p] is the pth prime | ||
225 | for(i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p] | ||
226 | s[i]=1; | ||
227 | p++; | ||
228 | s[p]=s[p-1]+1; | ||
229 | for(; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0) | ||
230 | } | ||
231 | ans=new Array(p); | ||
232 | for(i=0;i<p;i++) | ||
233 | ans[i]=s[i]; | ||
234 | return ans; | ||
235 | } | ||
236 | |||
237 | //does a single round of Miller-Rabin base b consider x to be a possible prime? | ||
238 | //x is a bigInt, and b is an integer | ||
239 | function millerRabin(x,b) { | ||
240 | var i,j,k,s; | ||
241 | |||
242 | if (mr_x1.length!=x.length) { | ||
243 | mr_x1=dup(x); | ||
244 | mr_r=dup(x); | ||
245 | mr_a=dup(x); | ||
246 | } | ||
247 | |||
248 | copyInt_(mr_a,b); | ||
249 | copy_(mr_r,x); | ||
250 | copy_(mr_x1,x); | ||
251 | |||
252 | addInt_(mr_r,-1); | ||
253 | addInt_(mr_x1,-1); | ||
254 | |||
255 | //s=the highest power of two that divides mr_r | ||
256 | k=0; | ||
257 | for (i=0;i<mr_r.length;i++) | ||
258 | for (j=1;j<mask;j<<=1) | ||
259 | if (x[i] & j) { | ||
260 | s=(k<mr_r.length+bpe ? k : 0); | ||
261 | i=mr_r.length; | ||
262 | j=mask; | ||
263 | } else | ||
264 | k++; | ||
265 | |||
266 | if (s) | ||
267 | rightShift_(mr_r,s); | ||
268 | |||
269 | powMod_(mr_a,mr_r,x); | ||
270 | |||
271 | if (!equalsInt(mr_a,1) && !equals(mr_a,mr_x1)) { | ||
272 | j=1; | ||
273 | while (j<=s-1 && !equals(mr_a,mr_x1)) { | ||
274 | squareMod_(mr_a,x); | ||
275 | if (equalsInt(mr_a,1)) { | ||
276 | return 0; | ||
277 | } | ||
278 | j++; | ||
279 | } | ||
280 | if (!equals(mr_a,mr_x1)) { | ||
281 | return 0; | ||
282 | } | ||
283 | } | ||
284 | return 1; | ||
285 | } | ||
286 | |||
287 | //returns how many bits long the bigInt is, not counting leading zeros. | ||
288 | function bitSize(x) { | ||
289 | var j,z,w; | ||
290 | for (j=x.length-1; (x[j]==0) && (j>0); j--); | ||
291 | for (z=0,w=x[j]; w; (w>>=1),z++); | ||
292 | z+=bpe*j; | ||
293 | return z; | ||
294 | } | ||
295 | |||
296 | //return a copy of x with at least n elements, adding leading zeros if needed | ||
297 | function expand(x,n) { | ||
298 | var ans=int2bigInt(0,(x.length>n ? x.length : n)*bpe,0); | ||
299 | copy_(ans,x); | ||
300 | return ans; | ||
301 | } | ||
302 | |||
303 | //return a k-bit true random prime using Maurer's algorithm. | ||
304 | function randTruePrime(k) { | ||
305 | var ans=int2bigInt(0,k,0); | ||
306 | randTruePrime_(ans,k); | ||
307 | return trim(ans,1); | ||
308 | } | ||
309 | |||
310 | //return a new bigInt equal to (x mod n) for bigInts x and n. | ||
311 | function mod(x,n) { | ||
312 | var ans=dup(x); | ||
313 | mod_(ans,n); | ||
314 | return trim(ans,1); | ||
315 | } | ||
316 | |||
317 | //return (x+n) where x is a bigInt and n is an integer. | ||
318 | function addInt(x,n) { | ||
319 | var ans=expand(x,x.length+1); | ||
320 | addInt_(ans,n); | ||
321 | return trim(ans,1); | ||
322 | } | ||
323 | |||
324 | //return x*y for bigInts x and y. This is faster when y<x. | ||
325 | function mult(x,y) { | ||
326 | var ans=expand(x,x.length+y.length); | ||
327 | mult_(ans,y); | ||
328 | return trim(ans,1); | ||
329 | } | ||
330 | |||
331 | //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n. | ||
332 | function powMod(x,y,n) { | ||
333 | var ans=expand(x,n.length); | ||
334 | powMod_(ans,trim(y,2),trim(n,2),0); //this should work without the trim, but doesn't | ||
335 | return trim(ans,1); | ||
336 | } | ||
337 | |||
338 | //return (x-y) for bigInts x and y. Negative answers will be 2s complement | ||
339 | function sub(x,y) { | ||
340 | var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1)); | ||
341 | sub_(ans,y); | ||
342 | return trim(ans,1); | ||
343 | } | ||
344 | |||
345 | //return (x+y) for bigInts x and y. | ||
346 | function add(x,y) { | ||
347 | var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1)); | ||
348 | add_(ans,y); | ||
349 | return trim(ans,1); | ||
350 | } | ||
351 | |||
352 | //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null | ||
353 | function inverseMod(x,n) { | ||
354 | var ans=expand(x,n.length); | ||
355 | var s; | ||
356 | s=inverseMod_(ans,n); | ||
357 | return s ? trim(ans,1) : null; | ||
358 | } | ||
359 | |||
360 | //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x. | ||
361 | function multMod(x,y,n) { | ||
362 | var ans=expand(x,n.length); | ||
363 | multMod_(ans,y,n); | ||
364 | return trim(ans,1); | ||
365 | } | ||
366 | |||
367 | //generate a k-bit true random prime using Maurer's algorithm, | ||
368 | //and put it into ans. The bigInt ans must be large enough to hold it. | ||
369 | function randTruePrime_(ans,k) { | ||
370 | var c,m,pm,dd,j,r,B,divisible,z,zz,recSize; | ||
371 | |||
372 | if (primes.length==0) | ||
373 | primes=findPrimes(30000); //check for divisibility by primes <=30000 | ||
374 | |||
375 | if (pows.length==0) { | ||
376 | pows=new Array(512); | ||
377 | for (j=0;j<512;j++) { | ||
378 | pows[j]=Math.pow(2,j/511.-1.); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | //c and m should be tuned for a particular machine and value of k, to maximize speed | ||
383 | //this was: c=primes[primes.length-1]/k/k; //check using all the small primes. (c=0.1 in HAC) | ||
384 | c=0.1; | ||
385 | m=20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits | ||
386 | recLimit=20; /*must be at least 2 (was 29)*/ //stop recursion when k <=recLimit | ||
387 | |||
388 | if (s_i2.length!=ans.length) { | ||
389 | s_i2=dup(ans); | ||
390 | s_R =dup(ans); | ||
391 | s_n1=dup(ans); | ||
392 | s_r2=dup(ans); | ||
393 | s_d =dup(ans); | ||
394 | s_x1=dup(ans); | ||
395 | s_x2=dup(ans); | ||
396 | s_b =dup(ans); | ||
397 | s_n =dup(ans); | ||
398 | s_i =dup(ans); | ||
399 | s_rm=dup(ans); | ||
400 | s_q =dup(ans); | ||
401 | s_a =dup(ans); | ||
402 | s_aa=dup(ans); | ||
403 | } | ||
404 | |||
405 | if (k <= recLimit) { //generate small random primes by trial division up to its square root | ||
406 | pm=(1<<((k+2)>>1))-1; //pm is binary number with all ones, just over sqrt(2^k) | ||
407 | copyInt_(ans,0); | ||
408 | for (dd=1;dd;) { | ||
409 | dd=0; | ||
410 | ans[0]= 1 | (1<<(k-1)) | Math.floor(Math.random()*(1<<k)); //random, k-bit, odd integer, with msb 1 | ||
411 | for (j=1;(j<primes.length) && ((primes[j]&pm)==primes[j]);j++) { //trial division by all primes 3...sqrt(2^k) | ||
412 | if (0==(ans[0]%primes[j])) { | ||
413 | dd=1; | ||
414 | break; | ||
415 | } | ||
416 | } | ||
417 | } | ||
418 | carry_(ans); | ||
419 | return; | ||
420 | } | ||
421 | |||
422 | B=c*k*k; //try small primes up to B (or all the primes[] array if the largest is less than B). | ||
423 | if (k>2*m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits | ||
424 | for (r=1; k-k*r<=m; ) | ||
425 | r=pows[Math.floor(Math.random()*512)]; //r=Math.pow(2,Math.random()-1); | ||
426 | else | ||
427 | r=.5; | ||
428 | |||
429 | //simulation suggests the more complex algorithm using r=.333 is only slightly faster. | ||
430 | |||
431 | recSize=Math.floor(r*k)+1; | ||
432 | |||
433 | randTruePrime_(s_q,recSize); | ||
434 | copyInt_(s_i2,0); | ||
435 | s_i2[Math.floor((k-2)/bpe)] |= (1<<((k-2)%bpe)); //s_i2=2^(k-2) | ||
436 | divide_(s_i2,s_q,s_i,s_rm); //s_i=floor((2^(k-1))/(2q)) | ||
437 | |||
438 | z=bitSize(s_i); | ||
439 | |||
440 | for (;;) { | ||
441 | for (;;) { //generate z-bit numbers until one falls in the range [0,s_i-1] | ||
442 | randBigInt_(s_R,z,0); | ||
443 | if (greater(s_i,s_R)) | ||
444 | break; | ||
445 | } //now s_R is in the range [0,s_i-1] | ||
446 | addInt_(s_R,1); //now s_R is in the range [1,s_i] | ||
447 | add_(s_R,s_i); //now s_R is in the range [s_i+1,2*s_i] | ||
448 | |||
449 | copy_(s_n,s_q); | ||
450 | mult_(s_n,s_R); | ||
451 | multInt_(s_n,2); | ||
452 | addInt_(s_n,1); //s_n=2*s_R*s_q+1 | ||
453 | |||
454 | copy_(s_r2,s_R); | ||
455 | multInt_(s_r2,2); //s_r2=2*s_R | ||
456 | |||
457 | //check s_n for divisibility by small primes up to B | ||
458 | for (divisible=0,j=0; (j<primes.length) && (primes[j]<B); j++) | ||
459 | if (modInt(s_n,primes[j])==0) { | ||
460 | divisible=1; | ||
461 | break; | ||
462 | } | ||
463 | |||
464 | if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2 | ||
465 | if (!millerRabin(s_n,2)) //this line represents 75% of the total runtime for randTruePrime_ | ||
466 | divisible=1; | ||
467 | |||
468 | if (!divisible) { //if it passes that test, continue checking s_n | ||
469 | addInt_(s_n,-3); | ||
470 | for (j=s_n.length-1;(s_n[j]==0) && (j>0); j--); //strip leading zeros | ||
471 | for (zz=0,w=s_n[j]; w; (w>>=1),zz++); | ||
472 | zz+=bpe*j; //zz=number of bits in s_n, ignoring leading zeros | ||
473 | for (;;) { //generate z-bit numbers until one falls in the range [0,s_n-1] | ||
474 | randBigInt_(s_a,zz,0); | ||
475 | if (greater(s_n,s_a)) | ||
476 | break; | ||
477 | } //now s_a is in the range [0,s_n-1] | ||
478 | addInt_(s_n,3); //now s_a is in the range [0,s_n-4] | ||
479 | addInt_(s_a,2); //now s_a is in the range [2,s_n-2] | ||
480 | copy_(s_b,s_a); | ||
481 | copy_(s_n1,s_n); | ||
482 | addInt_(s_n1,-1); | ||
483 | powMod_(s_b,s_n1,s_n); //s_b=s_a^(s_n-1) modulo s_n | ||
484 | addInt_(s_b,-1); | ||
485 | if (isZero(s_b)) { | ||
486 | copy_(s_b,s_a); | ||
487 | powMod_(s_b,s_r2,s_n); | ||
488 | addInt_(s_b,-1); | ||
489 | copy_(s_aa,s_n); | ||
490 | copy_(s_d,s_b); | ||
491 | GCD_(s_d,s_n); //if s_b and s_n are relatively prime, then s_n is a prime | ||
492 | if (equalsInt(s_d,1)) { | ||
493 | copy_(ans,s_aa); | ||
494 | return; //if we've made it this far, then s_n is absolutely guaranteed to be prime | ||
495 | } | ||
496 | } | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | |||
501 | //set b to an n-bit random BigInt. If s=1, then nth bit (most significant bit) is set to 1. | ||
502 | //array b must be big enough to hold the result. Must have n>=1 | ||
503 | function randBigInt_(b,n,s) { | ||
504 | var i,a; | ||
505 | for (i=0;i<b.length;i++) | ||
506 | b[i]=0; | ||
507 | a=Math.floor((n-1)/bpe)+1; //# array elements to hold the BigInt | ||
508 | for (i=0;i<a;i++) { | ||
509 | b[i]=Math.floor(Math.random()*(1<<(bpe-1))); | ||
510 | } | ||
511 | b[a-1] &= (2<<((n-1)%bpe))-1; | ||
512 | if (s) | ||
513 | b[a-1] |= (1<<((n-1)%bpe)); | ||
514 | } | ||
515 | |||
516 | //set x to the greatest common divisor of x and y. | ||
517 | //x,y are bigInts with the same number of elements. y is destroyed. | ||
518 | function GCD_(x,y) { | ||
519 | var i,xp,yp,A,B,C,D,q,sing; | ||
520 | if (T.length!=x.length) | ||
521 | T=dup(x); | ||
522 | |||
523 | sing=1; | ||
524 | while (sing) { //while y has nonzero elements other than y[0] | ||
525 | sing=0; | ||
526 | for (i=1;i<y.length;i++) //check if y has nonzero elements other than 0 | ||
527 | if (y[i]) { | ||
528 | sing=1; | ||
529 | break; | ||
530 | } | ||
531 | if (!sing) break; //quit when y all zero elements except possibly y[0] | ||
532 | |||
533 | for (i=x.length;!x[i] && i>=0;i--); //find most significant element of x | ||
534 | xp=x[i]; | ||
535 | yp=y[i]; | ||
536 | A=1; B=0; C=0; D=1; | ||
537 | while ((yp+C) && (yp+D)) { | ||
538 | q =Math.floor((xp+A)/(yp+C)); | ||
539 | qp=Math.floor((xp+B)/(yp+D)); | ||
540 | if (q!=qp) | ||
541 | break; | ||
542 | t= A-q*C; A=C; C=t; // do (A,B,xp, C,D,yp) = (C,D,yp, A,B,xp) - q*(0,0,0, C,D,yp) | ||
543 | t= B-q*D; B=D; D=t; | ||
544 | t=xp-q*yp; xp=yp; yp=t; | ||
545 | } | ||
546 | if (B) { | ||
547 | copy_(T,x); | ||
548 | linComb_(x,y,A,B); //x=A*x+B*y | ||
549 | linComb_(y,T,D,C); //y=D*y+C*T | ||
550 | } else { | ||
551 | mod_(x,y); | ||
552 | copy_(T,x); | ||
553 | copy_(x,y); | ||
554 | copy_(y,T); | ||
555 | } | ||
556 | } | ||
557 | if (y[0]==0) | ||
558 | return; | ||
559 | t=modInt(x,y[0]); | ||
560 | copyInt_(x,y[0]); | ||
561 | y[0]=t; | ||
562 | while (y[0]) { | ||
563 | x[0]%=y[0]; | ||
564 | t=x[0]; x[0]=y[0]; y[0]=t; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | //do x=x**(-1) mod n, for bigInts x and n. | ||
569 | //If no inverse exists, it sets x to zero and returns 0, else it returns 1. | ||
570 | //The x array must be at least as large as the n array. | ||
571 | function inverseMod_(x,n) { | ||
572 | var k=1+2*Math.max(x.length,n.length); | ||
573 | |||
574 | if(!(x[0]&1) && !(n[0]&1)) { //if both inputs are even, then inverse doesn't exist | ||
575 | copyInt_(x,0); | ||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | if (eg_u.length!=k) { | ||
580 | eg_u=new Array(k); | ||
581 | eg_v=new Array(k); | ||
582 | eg_A=new Array(k); | ||
583 | eg_B=new Array(k); | ||
584 | eg_C=new Array(k); | ||
585 | eg_D=new Array(k); | ||
586 | } | ||
587 | |||
588 | copy_(eg_u,x); | ||
589 | copy_(eg_v,n); | ||
590 | copyInt_(eg_A,1); | ||
591 | copyInt_(eg_B,0); | ||
592 | copyInt_(eg_C,0); | ||
593 | copyInt_(eg_D,1); | ||
594 | for (;;) { | ||
595 | while(!(eg_u[0]&1)) { //while eg_u is even | ||
596 | halve_(eg_u); | ||
597 | if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if eg_A==eg_B==0 mod 2 | ||
598 | halve_(eg_A); | ||
599 | halve_(eg_B); | ||
600 | } else { | ||
601 | add_(eg_A,n); halve_(eg_A); | ||
602 | sub_(eg_B,x); halve_(eg_B); | ||
603 | } | ||
604 | } | ||
605 | |||
606 | while (!(eg_v[0]&1)) { //while eg_v is even | ||
607 | halve_(eg_v); | ||
608 | if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if eg_C==eg_D==0 mod 2 | ||
609 | halve_(eg_C); | ||
610 | halve_(eg_D); | ||
611 | } else { | ||
612 | add_(eg_C,n); halve_(eg_C); | ||
613 | sub_(eg_D,x); halve_(eg_D); | ||
614 | } | ||
615 | } | ||
616 | |||
617 | if (!greater(eg_v,eg_u)) { //eg_v <= eg_u | ||
618 | sub_(eg_u,eg_v); | ||
619 | sub_(eg_A,eg_C); | ||
620 | sub_(eg_B,eg_D); | ||
621 | } else { //eg_v > eg_u | ||
622 | sub_(eg_v,eg_u); | ||
623 | sub_(eg_C,eg_A); | ||
624 | sub_(eg_D,eg_B); | ||
625 | } | ||
626 | |||
627 | if (equalsInt(eg_u,0)) { | ||
628 | if (negative(eg_C)) //make sure answer is nonnegative | ||
629 | add_(eg_C,n); | ||
630 | copy_(x,eg_C); | ||
631 | |||
632 | if (!equalsInt(eg_v,1)) { //if GCD_(x,n)!=1, then there is no inverse | ||
633 | copyInt_(x,0); | ||
634 | return 0; | ||
635 | } | ||
636 | return 1; | ||
637 | } | ||
638 | } | ||
639 | } | ||
640 | |||
641 | //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse | ||
642 | function inverseModInt_(x,n) { | ||
643 | var a=1,b=0,t; | ||
644 | for (;;) { | ||
645 | if (x==1) return a; | ||
646 | if (x==0) return 0; | ||
647 | b-=a*Math.floor(n/x); | ||
648 | n%=x; | ||
649 | |||
650 | if (n==1) return b; //to avoid negatives, change this b to n-b, and each -= to += | ||
651 | if (n==0) return 0; | ||
652 | a-=b*Math.floor(x/n); | ||
653 | x%=n; | ||
654 | } | ||
655 | } | ||
656 | |||
657 | //Given positive bigInts x and y, change the bigints v, a, and b to positive bigInts such that: | ||
658 | // v = GCD_(x,y) = a*x-b*y | ||
659 | //The bigInts v, a, b, must have exactly as many elements as the larger of x and y. | ||
660 | function eGCD_(x,y,v,a,b) { | ||
661 | var g=0; | ||
662 | var k=Math.max(x.length,y.length); | ||
663 | if (eg_u.length!=k) { | ||
664 | eg_u=new Array(k); | ||
665 | eg_A=new Array(k); | ||
666 | eg_B=new Array(k); | ||
667 | eg_C=new Array(k); | ||
668 | eg_D=new Array(k); | ||
669 | } | ||
670 | while(!(x[0]&1) && !(y[0]&1)) { //while x and y both even | ||
671 | halve_(x); | ||
672 | halve_(y); | ||
673 | g++; | ||
674 | } | ||
675 | copy_(eg_u,x); | ||
676 | copy_(v,y); | ||
677 | copyInt_(eg_A,1); | ||
678 | copyInt_(eg_B,0); | ||
679 | copyInt_(eg_C,0); | ||
680 | copyInt_(eg_D,1); | ||
681 | for (;;) { | ||
682 | while(!(eg_u[0]&1)) { //while u is even | ||
683 | halve_(eg_u); | ||
684 | if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if A==B==0 mod 2 | ||
685 | halve_(eg_A); | ||
686 | halve_(eg_B); | ||
687 | } else { | ||
688 | add_(eg_A,y); halve_(eg_A); | ||
689 | sub_(eg_B,x); halve_(eg_B); | ||
690 | } | ||
691 | } | ||
692 | |||
693 | while (!(v[0]&1)) { //while v is even | ||
694 | halve_(v); | ||
695 | if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if C==D==0 mod 2 | ||
696 | halve_(eg_C); | ||
697 | halve_(eg_D); | ||
698 | } else { | ||
699 | add_(eg_C,y); halve_(eg_C); | ||
700 | sub_(eg_D,x); halve_(eg_D); | ||
701 | } | ||
702 | } | ||
703 | |||
704 | if (!greater(v,eg_u)) { //v<=u | ||
705 | sub_(eg_u,v); | ||
706 | sub_(eg_A,eg_C); | ||
707 | sub_(eg_B,eg_D); | ||
708 | } else { //v>u | ||
709 | sub_(v,eg_u); | ||
710 | sub_(eg_C,eg_A); | ||
711 | sub_(eg_D,eg_B); | ||
712 | } | ||
713 | if (equalsInt(eg_u,0)) { | ||
714 | if (negative(eg_C)) { //make sure a (C)is nonnegative | ||
715 | add_(eg_C,y); | ||
716 | sub_(eg_D,x); | ||
717 | } | ||
718 | multInt_(eg_D,-1); ///make sure b (D) is nonnegative | ||
719 | copy_(a,eg_C); | ||
720 | copy_(b,eg_D); | ||
721 | leftShift_(v,g); | ||
722 | return; | ||
723 | } | ||
724 | } | ||
725 | } | ||
726 | |||
727 | |||
728 | //is bigInt x negative? | ||
729 | function negative(x) { | ||
730 | return ((x[x.length-1]>>(bpe-1))&1); | ||
731 | } | ||
732 | |||
733 | |||
734 | //is (x << (shift*bpe)) > y? | ||
735 | //x and y are nonnegative bigInts | ||
736 | //shift is a nonnegative integer | ||
737 | function greaterShift(x,y,shift) { | ||
738 | var kx=x.length, ky=y.length; | ||
739 | k=((kx+shift)<ky) ? (kx+shift) : ky; | ||
740 | for (i=ky-1-shift; i<kx && i>=0; i++) | ||
741 | if (x[i]>0) | ||
742 | return 1; //if there are nonzeros in x to the left of the first column of y, then x is bigger | ||
743 | for (i=kx-1+shift; i<ky; i++) | ||
744 | if (y[i]>0) | ||
745 | return 0; //if there are nonzeros in y to the left of the first column of x, then x is not bigger | ||
746 | for (i=k-1; i>=shift; i--) | ||
747 | if (x[i-shift]>y[i]) return 1; | ||
748 | else if (x[i-shift]<y[i]) return 0; | ||
749 | return 0; | ||
750 | } | ||
751 | |||
752 | //is x > y? (x and y both nonnegative) | ||
753 | function greater(x,y) { | ||
754 | var i; | ||
755 | var k=(x.length<y.length) ? x.length : y.length; | ||
756 | |||
757 | for (i=x.length;i<y.length;i++) | ||
758 | if (y[i]) | ||
759 | return 0; //y has more digits | ||
760 | |||
761 | for (i=y.length;i<x.length;i++) | ||
762 | if (x[i]) | ||
763 | return 1; //x has more digits | ||
764 | |||
765 | for (i=k-1;i>=0;i--) | ||
766 | if (x[i]>y[i]) | ||
767 | return 1; | ||
768 | else if (x[i]<y[i]) | ||
769 | return 0; | ||
770 | return 0; | ||
771 | } | ||
772 | |||
773 | //divide_ x by y giving quotient q and remainder r. (q=floor(x/y), r=x mod y). All 4 are bigints. | ||
774 | //x must have at least one leading zero element. | ||
775 | //y must be nonzero. | ||
776 | //q and r must be arrays that are exactly the same length as x. | ||
777 | //the x array must have at least as many elements as y. | ||
778 | function divide_(x,y,q,r) { | ||
779 | var kx, ky; | ||
780 | var i,j,y1,y2,c,a,b; | ||
781 | copy_(r,x); | ||
782 | for (ky=y.length;y[ky-1]==0;ky--); //kx,ky is number of elements in x,y, not including leading zeros | ||
783 | for (kx=r.length;r[kx-1]==0 && kx>ky;kx--); | ||
784 | |||
785 | //normalize: ensure the most significant element of y has its highest bit set | ||
786 | b=y[ky-1]; | ||
787 | for (a=0; b; a++) | ||
788 | b>>=1; | ||
789 | a=bpe-a; //a is how many bits to shift so that the high order bit of y is leftmost in its array element | ||
790 | leftShift_(y,a); //multiply both by 1<<a now, then divide_ both by that at the end | ||
791 | leftShift_(r,a); | ||
792 | |||
793 | copyInt_(q,0); // q=0 | ||
794 | while (!greaterShift(y,r,kx-ky)) { // while (leftShift_(y,kx-ky) <= r) { | ||
795 | subShift_(r,y,kx-ky); // r=r-leftShift_(y,kx-ky) | ||
796 | q[kx-ky]++; // q[kx-ky]++; | ||
797 | } // } | ||
798 | |||
799 | for (i=kx-1; i>=ky; i--) { | ||
800 | if (r[i]==y[ky-1]) | ||
801 | q[i-ky]=mask; | ||
802 | else | ||
803 | q[i-ky]=Math.floor((r[i]*radix+r[i-1])/y[ky-1]); | ||
804 | |||
805 | //The following for(;;) loop is equivalent to the commented while loop, | ||
806 | //except that the uncommented version avoids overflow. | ||
807 | //The commented loop comes from HAC, which assumes r[-1]==y[-1]==0 | ||
808 | // while (q[i-ky]*(y[ky-1]*radix+y[ky-2]) > r[i]*radix*radix+r[i-1]*radix+r[i-2]) | ||
809 | // q[i-ky]--; | ||
810 | for (;;) { | ||
811 | y2=(ky>1 ? y[ky-2] : 0)*q[i-ky]; | ||
812 | c=y2>>bpe; | ||
813 | y2=y2 & mask; | ||
814 | y1=c+q[i-ky]*y[ky-1]; | ||
815 | c=y1>>bpe; | ||
816 | y1=y1 & mask; | ||
817 | |||
818 | if (c==r[i] ? y1==r[i-1] ? y2>(i>1 ? r[i-2] : 0) : y1>r[i-1] : c>r[i]) | ||
819 | q[i-ky]--; | ||
820 | else | ||
821 | break; | ||
822 | } | ||
823 | |||
824 | linCombShift_(r,y,-q[i-ky],i-ky); //r=r-q[i-ky]*leftShift_(y,i-ky) | ||
825 | if (negative(r)) { | ||
826 | addShift_(r,y,i-ky); //r=r+leftShift_(y,i-ky) | ||
827 | q[i-ky]--; | ||
828 | } | ||
829 | } | ||
830 | |||
831 | rightShift_(y,a); //undo the normalization step | ||
832 | rightShift_(r,a); //undo the normalization step | ||
833 | } | ||
834 | |||
835 | //do carries and borrows so each element of the bigInt x fits in bpe bits. | ||
836 | function carry_(x) { | ||
837 | var i,k,c,b; | ||
838 | k=x.length; | ||
839 | c=0; | ||
840 | for (i=0;i<k;i++) { | ||
841 | c+=x[i]; | ||
842 | b=0; | ||
843 | if (c<0) { | ||
844 | b=-(c>>bpe); | ||
845 | c+=b*radix; | ||
846 | } | ||
847 | x[i]=c & mask; | ||
848 | c=(c>>bpe)-b; | ||
849 | } | ||
850 | } | ||
851 | |||
852 | //return x mod n for bigInt x and integer n. | ||
853 | function modInt(x,n) { | ||
854 | var i,c=0; | ||
855 | for (i=x.length-1; i>=0; i--) | ||
856 | c=(c*radix+x[i])%n; | ||
857 | return c; | ||
858 | } | ||
859 | |||
860 | //convert the integer t into a bigInt with at least the given number of bits. | ||
861 | //the returned array stores the bigInt in bpe-bit chunks, little endian (buff[0] is least significant word) | ||
862 | //Pad the array with leading zeros so that it has at least minSize elements. | ||
863 | //There will always be at least one leading 0 element. | ||
864 | function int2bigInt(t,bits,minSize) { | ||
865 | var i,k; | ||
866 | k=Math.ceil(bits/bpe)+1; | ||
867 | k=minSize>k ? minSize : k; | ||
868 | buff=new Array(k); | ||
869 | copyInt_(buff,t); | ||
870 | return buff; | ||
871 | } | ||
872 | |||
873 | //return the bigInt given a string representation in a given base. | ||
874 | //Pad the array with leading zeros so that it has at least minSize elements. | ||
875 | //If base=-1, then it reads in a space-separated list of array elements in decimal. | ||
876 | //The array will always have at least one leading zero, unless base=-1. | ||
877 | function str2bigInt(s,base,minSize) { | ||
878 | var d, i, j, x, y, kk; | ||
879 | var k=s.length; | ||
880 | if (base==-1) { //comma-separated list of array elements in decimal | ||
881 | x=new Array(0); | ||
882 | for (;;) { | ||
883 | y=new Array(x.length+1); | ||
884 | for (i=0;i<x.length;i++) | ||
885 | y[i+1]=x[i]; | ||
886 | y[0]=parseInt(s,10); | ||
887 | x=y; | ||
888 | d=s.indexOf(',',0); | ||
889 | if (d<1) | ||
890 | break; | ||
891 | s=s.substring(d+1); | ||
892 | if (s.length==0) | ||
893 | break; | ||
894 | } | ||
895 | if (x.length<minSize) { | ||
896 | y=new Array(minSize); | ||
897 | copy_(y,x); | ||
898 | return y; | ||
899 | } | ||
900 | return x; | ||
901 | } | ||
902 | |||
903 | x=int2bigInt(0,base*k,0); | ||
904 | for (i=0;i<k;i++) { | ||
905 | d=digitsStr.indexOf(s.substring(i,i+1),0); | ||
906 | if (base<=36 && d>=36) //convert lowercase to uppercase if base<=36 | ||
907 | d-=26; | ||
908 | if (d<base && d>=0) { //ignore illegal characters | ||
909 | multInt_(x,base); | ||
910 | addInt_(x,d); | ||
911 | } | ||
912 | } | ||
913 | |||
914 | for (k=x.length;k>0 && !x[k-1];k--); //strip off leading zeros | ||
915 | k=minSize>k+1 ? minSize : k+1; | ||
916 | y=new Array(k); | ||
917 | kk=k<x.length ? k : x.length; | ||
918 | for (i=0;i<kk;i++) | ||
919 | y[i]=x[i]; | ||
920 | for (;i<k;i++) | ||
921 | y[i]=0; | ||
922 | return y; | ||
923 | } | ||
924 | |||
925 | //is bigint x equal to integer y? | ||
926 | //y must have less than bpe bits | ||
927 | function equalsInt(x,y) { | ||
928 | var i; | ||
929 | if (x[0]!=y) | ||
930 | return 0; | ||
931 | for (i=1;i<x.length;i++) | ||
932 | if (x[i]) | ||
933 | return 0; | ||
934 | return 1; | ||
935 | } | ||
936 | |||
937 | //are bigints x and y equal? | ||
938 | //this works even if x and y are different lengths and have arbitrarily many leading zeros | ||
939 | function equals(x,y) { | ||
940 | var i; | ||
941 | var k=x.length<y.length ? x.length : y.length; | ||
942 | for (i=0;i<k;i++) | ||
943 | if (x[i]!=y[i]) | ||
944 | return 0; | ||
945 | if (x.length>y.length) { | ||
946 | for (;i<x.length;i++) | ||
947 | if (x[i]) | ||
948 | return 0; | ||
949 | } else { | ||
950 | for (;i<y.length;i++) | ||
951 | if (y[i]) | ||
952 | return 0; | ||
953 | } | ||
954 | return 1; | ||
955 | } | ||
956 | |||
957 | //is the bigInt x equal to zero? | ||
958 | function isZero(x) { | ||
959 | var i; | ||
960 | for (i=0;i<x.length;i++) | ||
961 | if (x[i]) | ||
962 | return 0; | ||
963 | return 1; | ||
964 | } | ||
965 | |||
966 | //convert a bigInt into a string in a given base, from base 2 up to base 95. | ||
967 | //Base -1 prints the contents of the array representing the number. | ||
968 | function bigInt2str(x,base) { | ||
969 | var i,t,s=""; | ||
970 | |||
971 | if (s6.length!=x.length) | ||
972 | s6=dup(x); | ||
973 | else | ||
974 | copy_(s6,x); | ||
975 | |||
976 | if (base==-1) { //return the list of array contents | ||
977 | for (i=x.length-1;i>0;i--) | ||
978 | s+=x[i]+','; | ||
979 | s+=x[0]; | ||
980 | } | ||
981 | else { //return it in the given base | ||
982 | while (!isZero(s6)) { | ||
983 | t=divInt_(s6,base); //t=s6 % base; s6=floor(s6/base); | ||
984 | s=digitsStr.substring(t,t+1)+s; | ||
985 | } | ||
986 | } | ||
987 | if (s.length==0) | ||
988 | s="0"; | ||
989 | return s; | ||
990 | } | ||
991 | |||
992 | //returns a duplicate of bigInt x | ||
993 | function dup(x) { | ||
994 | var i; | ||
995 | buff=new Array(x.length); | ||
996 | copy_(buff,x); | ||
997 | return buff; | ||
998 | } | ||
999 | |||
1000 | //do x=y on bigInts x and y. x must be an array at least as big as y (not counting the leading zeros in y). | ||
1001 | function copy_(x,y) { | ||
1002 | var i; | ||
1003 | var k=x.length<y.length ? x.length : y.length; | ||
1004 | for (i=0;i<k;i++) | ||
1005 | x[i]=y[i]; | ||
1006 | for (i=k;i<x.length;i++) | ||
1007 | x[i]=0; | ||
1008 | } | ||
1009 | |||
1010 | //do x=y on bigInt x and integer y. | ||
1011 | function copyInt_(x,n) { | ||
1012 | var i,c; | ||
1013 | for (c=n,i=0;i<x.length;i++) { | ||
1014 | x[i]=c & mask; | ||
1015 | c>>=bpe; | ||
1016 | } | ||
1017 | } | ||
1018 | |||
1019 | //do x=x+n where x is a bigInt and n is an integer. | ||
1020 | //x must be large enough to hold the result. | ||
1021 | function addInt_(x,n) { | ||
1022 | var i,k,c,b; | ||
1023 | x[0]+=n; | ||
1024 | k=x.length; | ||
1025 | c=0; | ||
1026 | for (i=0;i<k;i++) { | ||
1027 | c+=x[i]; | ||
1028 | b=0; | ||
1029 | if (c<0) { | ||
1030 | b=-(c>>bpe); | ||
1031 | c+=b*radix; | ||
1032 | } | ||
1033 | x[i]=c & mask; | ||
1034 | c=(c>>bpe)-b; | ||
1035 | if (!c) return; //stop carrying as soon as the carry_ is zero | ||
1036 | } | ||
1037 | } | ||
1038 | |||
1039 | //right shift bigInt x by n bits. 0 <= n < bpe. | ||
1040 | function rightShift_(x,n) { | ||
1041 | var i; | ||
1042 | var k=Math.floor(n/bpe); | ||
1043 | if (k) { | ||
1044 | for (i=0;i<x.length-k;i++) //right shift x by k elements | ||
1045 | x[i]=x[i+k]; | ||
1046 | for (;i<x.length;i++) | ||
1047 | x[i]=0; | ||
1048 | n%=bpe; | ||
1049 | } | ||
1050 | for (i=0;i<x.length-1;i++) { | ||
1051 | x[i]=mask & ((x[i+1]<<(bpe-n)) | (x[i]>>n)); | ||
1052 | } | ||
1053 | x[i]>>=n; | ||
1054 | } | ||
1055 | |||
1056 | //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement | ||
1057 | function halve_(x) { | ||
1058 | var i; | ||
1059 | for (i=0;i<x.length-1;i++) { | ||
1060 | x[i]=mask & ((x[i+1]<<(bpe-1)) | (x[i]>>1)); | ||
1061 | } | ||
1062 | x[i]=(x[i]>>1) | (x[i] & (radix>>1)); //most significant bit stays the same | ||
1063 | } | ||
1064 | |||
1065 | //left shift bigInt x by n bits. | ||
1066 | function leftShift_(x,n) { | ||
1067 | var i; | ||
1068 | var k=Math.floor(n/bpe); | ||
1069 | if (k) { | ||
1070 | for (i=x.length; i>=k; i--) //left shift x by k elements | ||
1071 | x[i]=x[i-k]; | ||
1072 | for (;i>=0;i--) | ||
1073 | x[i]=0; | ||
1074 | n%=bpe; | ||
1075 | } | ||
1076 | if (!n) | ||
1077 | return; | ||
1078 | for (i=x.length-1;i>0;i--) { | ||
1079 | x[i]=mask & ((x[i]<<n) | (x[i-1]>>(bpe-n))); | ||
1080 | } | ||
1081 | x[i]=mask & (x[i]<<n); | ||
1082 | } | ||
1083 | |||
1084 | //do x=x*n where x is a bigInt and n is an integer. | ||
1085 | //x must be large enough to hold the result. | ||
1086 | function multInt_(x,n) { | ||
1087 | var i,k,c,b; | ||
1088 | if (!n) | ||
1089 | return; | ||
1090 | k=x.length; | ||
1091 | c=0; | ||
1092 | for (i=0;i<k;i++) { | ||
1093 | c+=x[i]*n; | ||
1094 | b=0; | ||
1095 | if (c<0) { | ||
1096 | b=-(c>>bpe); | ||
1097 | c+=b*radix; | ||
1098 | } | ||
1099 | x[i]=c & mask; | ||
1100 | c=(c>>bpe)-b; | ||
1101 | } | ||
1102 | } | ||
1103 | |||
1104 | //do x=floor(x/n) for bigInt x and integer n, and return the remainder | ||
1105 | function divInt_(x,n) { | ||
1106 | var i,r=0,s; | ||
1107 | for (i=x.length-1;i>=0;i--) { | ||
1108 | s=r*radix+x[i]; | ||
1109 | x[i]=Math.floor(s/n); | ||
1110 | r=s%n; | ||
1111 | } | ||
1112 | return r; | ||
1113 | } | ||
1114 | |||
1115 | //do the linear combination x=a*x+b*y for bigInts x and y, and integers a and b. | ||
1116 | //x must be large enough to hold the answer. | ||
1117 | function linComb_(x,y,a,b) { | ||
1118 | var i,c,k,kk; | ||
1119 | k=x.length<y.length ? x.length : y.length; | ||
1120 | kk=x.length; | ||
1121 | for (c=0,i=0;i<k;i++) { | ||
1122 | c+=a*x[i]+b*y[i]; | ||
1123 | x[i]=c & mask; | ||
1124 | c>>=bpe; | ||
1125 | } | ||
1126 | for (i=k;i<kk;i++) { | ||
1127 | c+=a*x[i]; | ||
1128 | x[i]=c & mask; | ||
1129 | c>>=bpe; | ||
1130 | } | ||
1131 | } | ||
1132 | |||
1133 | //do the linear combination x=a*x+b*(y<<(ys*bpe)) for bigInts x and y, and integers a, b and ys. | ||
1134 | //x must be large enough to hold the answer. | ||
1135 | function linCombShift_(x,y,b,ys) { | ||
1136 | var i,c,k,kk; | ||
1137 | k=x.length<ys+y.length ? x.length : ys+y.length; | ||
1138 | kk=x.length; | ||
1139 | for (c=0,i=ys;i<k;i++) { | ||
1140 | c+=x[i]+b*y[i-ys]; | ||
1141 | x[i]=c & mask; | ||
1142 | c>>=bpe; | ||
1143 | } | ||
1144 | for (i=k;c && i<kk;i++) { | ||
1145 | c+=x[i]; | ||
1146 | x[i]=c & mask; | ||
1147 | c>>=bpe; | ||
1148 | } | ||
1149 | } | ||
1150 | |||
1151 | //do x=x+(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys. | ||
1152 | //x must be large enough to hold the answer. | ||
1153 | function addShift_(x,y,ys) { | ||
1154 | var i,c,k,kk; | ||
1155 | k=x.length<ys+y.length ? x.length : ys+y.length; | ||
1156 | kk=x.length; | ||
1157 | for (c=0,i=ys;i<k;i++) { | ||
1158 | c+=x[i]+y[i-ys]; | ||
1159 | x[i]=c & mask; | ||
1160 | c>>=bpe; | ||
1161 | } | ||
1162 | for (i=k;c && i<kk;i++) { | ||
1163 | c+=x[i]; | ||
1164 | x[i]=c & mask; | ||
1165 | c>>=bpe; | ||
1166 | } | ||
1167 | } | ||
1168 | |||
1169 | //do x=x-(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys. | ||
1170 | //x must be large enough to hold the answer. | ||
1171 | function subShift_(x,y,ys) { | ||
1172 | var i,c,k,kk; | ||
1173 | k=x.length<ys+y.length ? x.length : ys+y.length; | ||
1174 | kk=x.length; | ||
1175 | for (c=0,i=ys;i<k;i++) { | ||
1176 | c+=x[i]-y[i-ys]; | ||
1177 | x[i]=c & mask; | ||
1178 | c>>=bpe; | ||
1179 | } | ||
1180 | for (i=k;c && i<kk;i++) { | ||
1181 | c+=x[i]; | ||
1182 | x[i]=c & mask; | ||
1183 | c>>=bpe; | ||
1184 | } | ||
1185 | } | ||
1186 | |||
1187 | //do x=x-y for bigInts x and y. | ||
1188 | //x must be large enough to hold the answer. | ||
1189 | //negative answers will be 2s complement | ||
1190 | function sub_(x,y) { | ||
1191 | var i,c,k,kk; | ||
1192 | k=x.length<y.length ? x.length : y.length; | ||
1193 | for (c=0,i=0;i<k;i++) { | ||
1194 | c+=x[i]-y[i]; | ||
1195 | x[i]=c & mask; | ||
1196 | c>>=bpe; | ||
1197 | } | ||
1198 | for (i=k;c && i<x.length;i++) { | ||
1199 | c+=x[i]; | ||
1200 | x[i]=c & mask; | ||
1201 | c>>=bpe; | ||
1202 | } | ||
1203 | } | ||
1204 | |||
1205 | //do x=x+y for bigInts x and y. | ||
1206 | //x must be large enough to hold the answer. | ||
1207 | function add_(x,y) { | ||
1208 | var i,c,k,kk; | ||
1209 | k=x.length<y.length ? x.length : y.length; | ||
1210 | for (c=0,i=0;i<k;i++) { | ||
1211 | c+=x[i]+y[i]; | ||
1212 | x[i]=c & mask; | ||
1213 | c>>=bpe; | ||
1214 | } | ||
1215 | for (i=k;c && i<x.length;i++) { | ||
1216 | c+=x[i]; | ||
1217 | x[i]=c & mask; | ||
1218 | c>>=bpe; | ||
1219 | } | ||
1220 | } | ||
1221 | |||
1222 | //do x=x*y for bigInts x and y. This is faster when y<x. | ||
1223 | function mult_(x,y) { | ||
1224 | var i; | ||
1225 | if (ss.length!=2*x.length) | ||
1226 | ss=new Array(2*x.length); | ||
1227 | copyInt_(ss,0); | ||
1228 | for (i=0;i<y.length;i++) | ||
1229 | if (y[i]) | ||
1230 | linCombShift_(ss,x,y[i],i); //ss=1*ss+y[i]*(x<<(i*bpe)) | ||
1231 | copy_(x,ss); | ||
1232 | } | ||
1233 | |||
1234 | //do x=x mod n for bigInts x and n. | ||
1235 | function mod_(x,n) { | ||
1236 | if (s4.length!=x.length) | ||
1237 | s4=dup(x); | ||
1238 | else | ||
1239 | copy_(s4,x); | ||
1240 | if (s5.length!=x.length) | ||
1241 | s5=dup(x); | ||
1242 | divide_(s4,n,s5,x); //x = remainder of s4 / n | ||
1243 | } | ||
1244 | |||
1245 | //do x=x*y mod n for bigInts x,y,n. | ||
1246 | //for greater speed, let y<x. | ||
1247 | function multMod_(x,y,n) { | ||
1248 | var i; | ||
1249 | if (s0.length!=2*x.length) | ||
1250 | s0=new Array(2*x.length); | ||
1251 | copyInt_(s0,0); | ||
1252 | for (i=0;i<y.length;i++) | ||
1253 | if (y[i]) | ||
1254 | linCombShift_(s0,x,y[i],i); //s0=1*s0+y[i]*(x<<(i*bpe)) | ||
1255 | mod_(s0,n); | ||
1256 | copy_(x,s0); | ||
1257 | } | ||
1258 | |||
1259 | //do x=x*x mod n for bigInts x,n. | ||
1260 | function squareMod_(x,n) { | ||
1261 | var i,j,d,c,kx,kn,k; | ||
1262 | for (kx=x.length; kx>0 && !x[kx-1]; kx--); //ignore leading zeros in x | ||
1263 | k=kx>n.length ? 2*kx : 2*n.length; //k=# elements in the product, which is twice the elements in the larger of x and n | ||
1264 | if (s0.length!=k) | ||
1265 | s0=new Array(k); | ||
1266 | copyInt_(s0,0); | ||
1267 | for (i=0;i<kx;i++) { | ||
1268 | c=s0[2*i]+x[i]*x[i]; | ||
1269 | s0[2*i]=c & mask; | ||
1270 | c>>=bpe; | ||
1271 | for (j=i+1;j<kx;j++) { | ||
1272 | c=s0[i+j]+2*x[i]*x[j]+c; | ||
1273 | s0[i+j]=(c & mask); | ||
1274 | c>>=bpe; | ||
1275 | } | ||
1276 | s0[i+kx]=c; | ||
1277 | } | ||
1278 | mod_(s0,n); | ||
1279 | copy_(x,s0); | ||
1280 | } | ||
1281 | |||
1282 | //return x with exactly k leading zero elements | ||
1283 | function trim(x,k) { | ||
1284 | var i,y; | ||
1285 | for (i=x.length; i>0 && !x[i-1]; i--); | ||
1286 | y=new Array(i+k); | ||
1287 | copy_(y,x); | ||
1288 | return y; | ||
1289 | } | ||
1290 | |||
1291 | //do x=x**y mod n, where x,y,n are bigInts and ** is exponentiation. 0**0=1. | ||
1292 | //this is faster when n is odd. x usually needs to have as many elements as n. | ||
1293 | function powMod_(x,y,n) { | ||
1294 | var k1,k2,kn,np; | ||
1295 | if(s7.length!=n.length) | ||
1296 | s7=dup(n); | ||
1297 | |||
1298 | //for even modulus, use a simple square-and-multiply algorithm, | ||
1299 | //rather than using the more complex Montgomery algorithm. | ||
1300 | if ((n[0]&1)==0) { | ||
1301 | copy_(s7,x); | ||
1302 | copyInt_(x,1); | ||
1303 | while(!equalsInt(y,0)) { | ||
1304 | if (y[0]&1) | ||
1305 | multMod_(x,s7,n); | ||
1306 | divInt_(y,2); | ||
1307 | squareMod_(s7,n); | ||
1308 | } | ||
1309 | return; | ||
1310 | } | ||
1311 | |||
1312 | //calculate np from n for the Montgomery multiplications | ||
1313 | copyInt_(s7,0); | ||
1314 | for (kn=n.length;kn>0 && !n[kn-1];kn--); | ||
1315 | np=radix-inverseModInt_(modInt(n,radix),radix); | ||
1316 | s7[kn]=1; | ||
1317 | multMod_(x ,s7,n); // x = x * 2**(kn*bp) mod n | ||
1318 | |||
1319 | if (s3.length!=x.length) | ||
1320 | s3=dup(x); | ||
1321 | else | ||
1322 | copy_(s3,x); | ||
1323 | |||
1324 | for (k1=y.length-1;k1>0 & !y[k1]; k1--); //k1=first nonzero element of y | ||
1325 | if (y[k1]==0) { //anything to the 0th power is 1 | ||
1326 | copyInt_(x,1); | ||
1327 | return; | ||
1328 | } | ||
1329 | for (k2=1<<(bpe-1);k2 && !(y[k1] & k2); k2>>=1); //k2=position of first 1 bit in y[k1] | ||
1330 | for (;;) { | ||
1331 | if (!(k2>>=1)) { //look at next bit of y | ||
1332 | k1--; | ||
1333 | if (k1<0) { | ||
1334 | mont_(x,one,n,np); | ||
1335 | return; | ||
1336 | } | ||
1337 | k2=1<<(bpe-1); | ||
1338 | } | ||
1339 | mont_(x,x,n,np); | ||
1340 | |||
1341 | if (k2 & y[k1]) //if next bit is a 1 | ||
1342 | mont_(x,s3,n,np); | ||
1343 | } | ||
1344 | } | ||
1345 | |||
1346 | //do x=x*y*Ri mod n for bigInts x,y,n, | ||
1347 | // where Ri = 2**(-kn*bpe) mod n, and kn is the | ||
1348 | // number of elements in the n array, not | ||
1349 | // counting leading zeros. | ||
1350 | //x must be large enough to hold the answer. | ||
1351 | //It's OK if x and y are the same variable. | ||
1352 | //must have: | ||
1353 | // x,y < n | ||
1354 | // n is odd | ||
1355 | // np = -(n^(-1)) mod radix | ||
1356 | function mont_(x,y,n,np) { | ||
1357 | var i,j,c,ui,t; | ||
1358 | var kn=n.length; | ||
1359 | var ky=y.length; | ||
1360 | |||
1361 | if (sa.length!=kn) | ||
1362 | sa=new Array(kn); | ||
1363 | |||
1364 | for (;kn>0 && n[kn-1]==0;kn--); //ignore leading zeros of n | ||
1365 | //this function sometimes gives wrong answers when the next line is uncommented | ||
1366 | //for (;ky>0 && y[ky-1]==0;ky--); //ignore leading zeros of y | ||
1367 | |||
1368 | copyInt_(sa,0); | ||
1369 | |||
1370 | //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large keys | ||
1371 | for (i=0; i<kn; i++) { | ||
1372 | t=sa[0]+x[i]*y[0]; | ||
1373 | ui=((t & mask) * np) & mask; //the inner "& mask" is needed on Macintosh MSIE, but not windows MSIE | ||
1374 | c=(t+ui*n[0]) >> bpe; | ||
1375 | t=x[i]; | ||
1376 | |||
1377 | //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe | ||
1378 | for (j=1;j<ky;j++) { | ||
1379 | c+=sa[j]+t*y[j]+ui*n[j]; | ||
1380 | sa[j-1]=c & mask; | ||
1381 | c>>=bpe; | ||
1382 | } | ||
1383 | for (;j<kn;j++) { | ||
1384 | c+=sa[j]+ui*n[j]; | ||
1385 | sa[j-1]=c & mask; | ||
1386 | c>>=bpe; | ||
1387 | } | ||
1388 | sa[j-1]=c & mask; | ||
1389 | } | ||
1390 | |||
1391 | if (!greater(n,sa)) | ||
1392 | sub_(sa,n); | ||
1393 | copy_(x,sa); | ||
1394 | } | ||
1395 | |||
1396 | |||
1397 | |||
1398 | |||
1399 | //############################################################################# | ||
1400 | //############################################################################# | ||
1401 | //############################################################################# | ||
1402 | //############################################################################# | ||
1403 | //############################################################################# | ||
1404 | //############################################################################# | ||
1405 | //############################################################################# | ||
1406 | |||
1407 | |||
1408 | |||
1409 | |||
1410 | |||
1411 | //############################################################################# | ||
1412 | |||
1413 | Clipperz.Crypto.BigInt = function (aValue, aBase) { | ||
1414 | varbase; | ||
1415 | varvalue; | ||
1416 | |||
1417 | if (typeof(aValue) == 'object') { | ||
1418 | this._internalValue = aValue; | ||
1419 | } else { | ||
1420 | if (typeof(aValue) == 'undefined') { | ||
1421 | value = "0"; | ||
1422 | } else { | ||
1423 | value = aValue + ""; | ||
1424 | } | ||
1425 | |||
1426 | if (typeof(aBase) == 'undefined') { | ||
1427 | base = 10; | ||
1428 | } else { | ||
1429 | base = aBase; | ||
1430 | } | ||
1431 | |||
1432 | this._internalValue = str2bigInt(value, base, 1, 1); | ||
1433 | } | ||
1434 | |||
1435 | return this; | ||
1436 | } | ||
1437 | |||
1438 | //============================================================================= | ||
1439 | |||
1440 | MochiKit.Base.update(Clipperz.Crypto.BigInt.prototype, { | ||
1441 | |||
1442 | 'clone': function() { | ||
1443 | return new Clipperz.Crypto.BigInt(this.internalValue()); | ||
1444 | }, | ||
1445 | |||
1446 | //------------------------------------------------------------------------- | ||
1447 | |||
1448 | 'internalValue': function () { | ||
1449 | return this._internalValue; | ||
1450 | }, | ||
1451 | |||
1452 | //------------------------------------------------------------------------- | ||
1453 | |||
1454 | 'isBigInt': true, | ||
1455 | |||
1456 | //------------------------------------------------------------------------- | ||
1457 | |||
1458 | 'toString': function(aBase) { | ||
1459 | return this.asString(aBase); | ||
1460 | }, | ||
1461 | |||
1462 | //------------------------------------------------------------------------- | ||
1463 | |||
1464 | 'asString': function (aBase, minimumLength) { | ||
1465 | varresult; | ||
1466 | varbase; | ||
1467 | |||
1468 | if (typeof(aBase) == 'undefined') { | ||
1469 | base = 10; | ||
1470 | } else { | ||
1471 | base = aBase; | ||
1472 | } | ||
1473 | |||
1474 | result = bigInt2str(this.internalValue(), base).toLowerCase(); | ||
1475 | |||
1476 | if ((typeof(minimumLength) != 'undefined') && (result.length < minimumLength)) { | ||
1477 | var i, c; | ||
1478 | //MochiKit.Logging.logDebug(">>> FIXING BigInt.asString length issue") | ||
1479 | c = (minimumLength - result.length); | ||
1480 | for (i=0; i<c; i++) { | ||
1481 | result = '0' + result; | ||
1482 | } | ||
1483 | } | ||
1484 | |||
1485 | return result; | ||
1486 | }, | ||
1487 | |||
1488 | //------------------------------------------------------------------------- | ||
1489 | |||
1490 | 'asByteArray': function() { | ||
1491 | return new Clipperz.ByteArray("0x" + this.asString(16), 16); | ||
1492 | }, | ||
1493 | |||
1494 | //------------------------------------------------------------------------- | ||
1495 | |||
1496 | 'equals': function (aValue) { | ||
1497 | var result; | ||
1498 | |||
1499 | if (aValue.isBigInt) { | ||
1500 | result = equals(this.internalValue(), aValue.internalValue()); | ||
1501 | } else if (typeof(aValue) == "number") { | ||
1502 | result = equalsInt(this.internalValue(), aValue); | ||
1503 | } else { | ||
1504 | throw Clipperz.Crypt.BigInt.exception.UnknownType; | ||
1505 | } | ||
1506 | |||
1507 | return result; | ||
1508 | }, | ||
1509 | |||
1510 | //------------------------------------------------------------------------- | ||
1511 | |||
1512 | 'compare': function(aValue) { | ||
1513 | /* | ||
1514 | var result; | ||
1515 | var thisAsString; | ||
1516 | var aValueAsString; | ||
1517 | |||
1518 | thisAsString = this.asString(10); | ||
1519 | aValueAsString = aValue.asString(10); | ||
1520 | |||
1521 | result = MochiKit.Base.compare(thisAsString.length, aValueAsString.length); | ||
1522 | if (result == 0) { | ||
1523 | result = MochiKit.Base.compare(thisAsString, aValueAsString); | ||
1524 | } | ||
1525 | |||
1526 | return result; | ||
1527 | */ | ||
1528 | var result; | ||
1529 | |||
1530 | if (equals(this.internalValue(), aValue.internalValue())) { | ||
1531 | result = 0; | ||
1532 | } else if (greater(this.internalValue(), aValue.internalValue())) { | ||
1533 | result = 1; | ||
1534 | } else { | ||
1535 | result = -1; | ||
1536 | } | ||
1537 | |||
1538 | return result; | ||
1539 | }, | ||
1540 | |||
1541 | //------------------------------------------------------------------------- | ||
1542 | |||
1543 | 'add': function (aValue) { | ||
1544 | var result; | ||
1545 | |||
1546 | if (aValue.isBigInt) { | ||
1547 | result = add(this.internalValue(), aValue.internalValue()); | ||
1548 | } else { | ||
1549 | result = addInt(this.internalValue(), aValue); | ||
1550 | } | ||
1551 | |||
1552 | return new Clipperz.Crypto.BigInt(result); | ||
1553 | }, | ||
1554 | |||
1555 | //------------------------------------------------------------------------- | ||
1556 | |||
1557 | 'subtract': function (aValue) { | ||
1558 | var result; | ||
1559 | var value; | ||
1560 | |||
1561 | if (aValue.isBigInt) { | ||
1562 | value = aValue; | ||
1563 | } else { | ||
1564 | value = new Clipperz.Crypto.BigInt(aValue); | ||
1565 | } | ||
1566 | |||
1567 | result = sub(this.internalValue(), value.internalValue()); | ||
1568 | |||
1569 | return new Clipperz.Crypto.BigInt(result); | ||
1570 | }, | ||
1571 | |||
1572 | //------------------------------------------------------------------------- | ||
1573 | |||
1574 | 'multiply': function (aValue, aModule) { | ||
1575 | var result; | ||
1576 | var value; | ||
1577 | |||
1578 | if (aValue.isBigInt) { | ||
1579 | value = aValue; | ||
1580 | } else { | ||
1581 | value = new Clipperz.Crypto.BigInt(aValue); | ||
1582 | } | ||
1583 | |||
1584 | if (typeof(aModule) == 'undefined') { | ||
1585 | result = mult(this.internalValue(), value.internalValue()); | ||
1586 | } else { | ||
1587 | if (greater(this.internalValue(), value.internalValue())) { | ||
1588 | result = multMod(this.internalValue(), value.internalValue(), aModule); | ||
1589 | } else { | ||
1590 | result = multMod(value.internalValue(), this.internalValue(), aModule); | ||
1591 | } | ||
1592 | } | ||
1593 | |||
1594 | return new Clipperz.Crypto.BigInt(result); | ||
1595 | }, | ||
1596 | |||
1597 | //------------------------------------------------------------------------- | ||
1598 | |||
1599 | 'module': function (aModule) { | ||
1600 | varresult; | ||
1601 | var module; | ||
1602 | |||
1603 | if (aModule.isBigInt) { | ||
1604 | module = aModule; | ||
1605 | } else { | ||
1606 | module = new Clipperz.Crypto.BigInt(aModule); | ||
1607 | } | ||
1608 | |||
1609 | result = mod(this.internalValue(), module.internalValue()); | ||
1610 | |||
1611 | return new Clipperz.Crypto.BigInt(result); | ||
1612 | }, | ||
1613 | |||
1614 | //------------------------------------------------------------------------- | ||
1615 | |||
1616 | 'powerModule': function(aValue, aModule) { | ||
1617 | varresult; | ||
1618 | varvalue; | ||
1619 | var module; | ||
1620 | |||
1621 | if (aValue.isBigInt) { | ||
1622 | value = aValue; | ||
1623 | } else { | ||
1624 | value = new Clipperz.Crypto.BigInt(aValue); | ||
1625 | } | ||
1626 | |||
1627 | if (aModule.isBigInt) { | ||
1628 | module = aModule; | ||
1629 | } else { | ||
1630 | module = new Clipperz.Crypto.BigInt(aModule); | ||
1631 | } | ||
1632 | |||
1633 | if (aValue == -1) { | ||
1634 | result = inverseMod(this.internalValue(), module.internalValue()); | ||
1635 | } else { | ||
1636 | result = powMod(this.internalValue(), value.internalValue(), module.internalValue()); | ||
1637 | } | ||
1638 | |||
1639 | return new Clipperz.Crypto.BigInt(result); | ||
1640 | }, | ||
1641 | |||
1642 | //------------------------------------------------------------------------- | ||
1643 | |||
1644 | 'xor': function(aValue) { | ||
1645 | var result; | ||
1646 | varthisByteArray; | ||
1647 | var aValueByteArray; | ||
1648 | var xorArray; | ||
1649 | |||
1650 | thisByteArray = new Clipperz.ByteArray("0x" + this.asString(16), 16); | ||
1651 | aValueByteArray = new Clipperz.ByteArray("0x" + aValue.asString(16), 16); | ||
1652 | xorArray = thisByteArray.xorMergeWithBlock(aValueByteArray, 'right'); | ||
1653 | result = new Clipperz.Crypto.BigInt(xorArray.toHexString(), 16); | ||
1654 | |||
1655 | return result; | ||
1656 | }, | ||
1657 | |||
1658 | //------------------------------------------------------------------------- | ||
1659 | |||
1660 | 'shiftLeft': function(aNumberOfBitsToShift) { | ||
1661 | var result; | ||
1662 | var internalResult; | ||
1663 | var wholeByteToShift; | ||
1664 | var bitsLeftToShift; | ||
1665 | |||
1666 | wholeByteToShift = Math.floor(aNumberOfBitsToShift / 8); | ||
1667 | bitsLeftToShift = aNumberOfBitsToShift % 8; | ||
1668 | |||
1669 | if (wholeByteToShift == 0) { | ||
1670 | internalResult = this.internalValue(); | ||
1671 | } else { | ||
1672 | var hexValue; | ||
1673 | var i,c; | ||
1674 | |||
1675 | hexValue = this.asString(16); | ||
1676 | c = wholeByteToShift; | ||
1677 | for (i=0; i<c; i++) { | ||
1678 | hexValue += "00"; | ||
1679 | } | ||
1680 | internalResult = str2bigInt(hexValue, 16, 1, 1); | ||
1681 | } | ||
1682 | |||
1683 | if (bitsLeftToShift > 0) { | ||
1684 | leftShift_(internalResult, bitsLeftToShift); | ||
1685 | } | ||
1686 | result = new Clipperz.Crypto.BigInt(internalResult); | ||
1687 | |||
1688 | return result; | ||
1689 | }, | ||
1690 | |||
1691 | //------------------------------------------------------------------------- | ||
1692 | |||
1693 | 'bitSize': function() { | ||
1694 | return bitSize(this.internalValue()); | ||
1695 | }, | ||
1696 | |||
1697 | //------------------------------------------------------------------------- | ||
1698 | |||
1699 | 'isBitSet': function(aBitPosition) { | ||
1700 | var result; | ||
1701 | |||
1702 | if (this.asByteArray().bitAtIndex(aBitPosition) == 0) { | ||
1703 | result = false; | ||
1704 | } else { | ||
1705 | result = true; | ||
1706 | }; | ||
1707 | |||
1708 | return result; | ||
1709 | }, | ||
1710 | |||
1711 | //------------------------------------------------------------------------- | ||
1712 | __syntaxFix__: "syntax fix" | ||
1713 | |||
1714 | }); | ||
1715 | |||
1716 | //############################################################################# | ||
1717 | |||
1718 | Clipperz.Crypto.BigInt.randomPrime = function(aBitSize) { | ||
1719 | return new Clipperz.Crypto.BigInt(randTruePrime(aBitSize)); | ||
1720 | } | ||
1721 | |||
1722 | //############################################################################# | ||
1723 | //############################################################################# | ||
1724 | |||
1725 | Clipperz.Crypto.BigInt.ZERO = new Clipperz.Crypto.BigInt(0); | ||
1726 | |||
1727 | //############################################################################# | ||
1728 | |||
1729 | Clipperz.Crypto.BigInt.equals = function(a, b) { | ||
1730 | return a.equals(b); | ||
1731 | } | ||
1732 | |||
1733 | Clipperz.Crypto.BigInt.add = function(a, b) { | ||
1734 | return a.add(b); | ||
1735 | } | ||
1736 | |||
1737 | Clipperz.Crypto.BigInt.subtract = function(a, b) { | ||
1738 | return a.subtract(b); | ||
1739 | } | ||
1740 | |||
1741 | Clipperz.Crypto.BigInt.multiply = function(a, b, module) { | ||
1742 | return a.multiply(b, module); | ||
1743 | } | ||
1744 | |||
1745 | Clipperz.Crypto.BigInt.module = function(a, module) { | ||
1746 | return a.module(module); | ||
1747 | } | ||
1748 | |||
1749 | Clipperz.Crypto.BigInt.powerModule = function(a, b, module) { | ||
1750 | return a.powerModule(b, module); | ||
1751 | } | ||
1752 | |||
1753 | Clipperz.Crypto.BigInt.exception = { | ||
1754 | UnknownType: new MochiKit.Base.NamedError("Clipperz.Crypto.BigInt.exception.UnknownType") | ||
1755 | } | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/BigInt_scoped.js b/frontend/gamma/js/ClipperzCryptoLibrary/BigInt_scoped.js new file mode 100644 index 0000000..bc60330 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/BigInt_scoped.js | |||
@@ -0,0 +1,1644 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
25 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | ||
26 | |||
27 | if (typeof(Leemon) == 'undefined') { Leemon = {}; } | ||
28 | if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; } | ||
29 | if (typeof(Baird.Crypto.BigInt) == 'undefined') { Baird.Crypto.BigInt = {}; } | ||
30 | |||
31 | |||
32 | //############################################################################# | ||
33 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js | ||
34 | //############################################################################# | ||
35 | |||
36 | //////////////////////////////////////////////////////////////////////////////////////// | ||
37 | // Big Integer Library v. 5.0 | ||
38 | // Created 2000, last modified 2006 | ||
39 | // Leemon Baird | ||
40 | // www.leemon.com | ||
41 | // | ||
42 | // This file is public domain. You can use it for any purpose without restriction. | ||
43 | // I do not guarantee that it is correct, so use it at your own risk. If you use | ||
44 | // it for something interesting, I'd appreciate hearing about it. If you find | ||
45 | // any bugs or make any improvements, I'd appreciate hearing about those too. | ||
46 | // It would also be nice if my name and address were left in the comments. | ||
47 | // But none of that is required. | ||
48 | // | ||
49 | // This code defines a bigInt library for arbitrary-precision integers. | ||
50 | // A bigInt is an array of integers storing the value in chunks of bpe bits, | ||
51 | // little endian (buff[0] is the least significant word). | ||
52 | // Negative bigInts are stored two's complement. | ||
53 | // Some functions assume their parameters have at least one leading zero element. | ||
54 | // Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, | ||
55 | // so the caller must make sure overflow won't happen. | ||
56 | // For each function where a parameter is modified, that same | ||
57 | // variable must not be used as another argument too. | ||
58 | // So, you cannot square x by doing multMod_(x,x,n). | ||
59 | // You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). | ||
60 | // | ||
61 | // These functions are designed to avoid frequent dynamic memory allocation in the inner loop. | ||
62 | // For most functions, if it needs a BigInt as a local variable it will actually use | ||
63 | // a global, and will only allocate to it when it's not the right size. This ensures | ||
64 | // that when a function is called repeatedly with same-sized parameters, it only allocates | ||
65 | // memory on the first call. | ||
66 | // | ||
67 | // Note that for cryptographic purposes, the calls to Math.random() must | ||
68 | // be replaced with calls to a better pseudorandom number generator. | ||
69 | // | ||
70 | // In the following, "bigInt" means a bigInt with at least one leading zero element, | ||
71 | // and "integer" means a nonnegative integer less than radix. In some cases, integer | ||
72 | // can be negative. Negative bigInts are 2s complement. | ||
73 | // | ||
74 | // The following functions do not modify their inputs, but dynamically allocate memory every time they are called: | ||
75 | // | ||
76 | // function bigInt2str(x,base) //convert a bigInt into a string in a given base, from base 2 up to base 95 | ||
77 | // function dup(x) //returns a copy of bigInt x | ||
78 | // function findPrimes(n) //return array of all primes less than integer n | ||
79 | // function int2bigInt(t,n,m) //convert integer t to a bigInt with at least n bits and m array elements | ||
80 | // function str2bigInt(s,b,n,m) //convert string s in base b to a bigInt with at least n bits and m array elements | ||
81 | // function trim(x,k) //return a copy of x with exactly k leading zero elements | ||
82 | // | ||
83 | // The following functions do not modify their inputs, so there is never a problem with the result being too big: | ||
84 | // | ||
85 | // function bitSize(x) //returns how many bits long the bigInt x is, not counting leading zeros | ||
86 | // function equals(x,y) //is the bigInt x equal to the bigint y? | ||
87 | // function equalsInt(x,y) //is bigint x equal to integer y? | ||
88 | // function greater(x,y) //is x>y? (x and y are nonnegative bigInts) | ||
89 | // function greaterShift(x,y,shift)//is (x <<(shift*bpe)) > y? | ||
90 | // function isZero(x) //is the bigInt x equal to zero? | ||
91 | // function millerRabin(x,b) //does one round of Miller-Rabin base integer b say that bigInt x is possibly prime (as opposed to definitely composite)? | ||
92 | // function modInt(x,n) //return x mod n for bigInt x and integer n. | ||
93 | // function negative(x) //is bigInt x negative? | ||
94 | // | ||
95 | // The following functions do not modify their inputs, but allocate memory and call functions with underscores | ||
96 | // | ||
97 | // function add(x,y) //return (x+y) for bigInts x and y. | ||
98 | // function addInt(x,n) //return (x+n) where x is a bigInt and n is an integer. | ||
99 | // function expand(x,n) //return a copy of x with at least n elements, adding leading zeros if needed | ||
100 | // function inverseMod(x,n) //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null | ||
101 | // function mod(x,n) //return a new bigInt equal to (x mod n) for bigInts x and n. | ||
102 | // function mult(x,y) //return x*y for bigInts x and y. This is faster when y<x. | ||
103 | // function multMod(x,y,n) //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x. | ||
104 | // function powMod(x,y,n) //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n. | ||
105 | // function randTruePrime(k) //return a new, random, k-bit, true prime using Maurer's algorithm. | ||
106 | // function sub(x,y) //return (x-y) for bigInts x and y. Negative answers will be 2s complement | ||
107 | // | ||
108 | // The following functions write a bigInt result to one of the parameters, but | ||
109 | // the result is never bigger than the original, so there can't be overflow problems: | ||
110 | // | ||
111 | // function divInt_(x,n) //do x=floor(x/n) for bigInt x and integer n, and return the remainder | ||
112 | // function GCD_(x,y) //set x to the greatest common divisor of bigInts x and y, (y is destroyed). | ||
113 | // function halve_(x) //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement | ||
114 | // function mod_(x,n) //do x=x mod n for bigInts x and n. | ||
115 | // function rightShift_(x,n) //right shift bigInt x by n bits. 0 <= n < bpe. | ||
116 | // | ||
117 | // The following functions write a bigInt result to one of the parameters. The caller is responsible for | ||
118 | // ensuring it is large enough to hold the result. | ||
119 | // | ||
120 | // function addInt_(x,n) //do x=x+n where x is a bigInt and n is an integer | ||
121 | // function add_(x,y) //do x=x+y for bigInts x and y | ||
122 | // function addShift_(x,y,ys) //do x=x+(y<<(ys*bpe)) | ||
123 | // function copy_(x,y) //do x=y on bigInts x and y | ||
124 | // function copyInt_(x,n) //do x=n on bigInt x and integer n | ||
125 | // function carry_(x) //do carries and borrows so each element of the bigInt x fits in bpe bits. | ||
126 | // function divide_(x,y,q,r) //divide_ x by y giving quotient q and remainder r | ||
127 | // function eGCD_(x,y,d,a,b) //sets a,b,d to positive big integers such that d = GCD_(x,y) = a*x-b*y | ||
128 | // function inverseMod_(x,n) //do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist | ||
129 | // function inverseModInt_(x,n) //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse | ||
130 | // function leftShift_(x,n) //left shift bigInt x by n bits. n<bpe. | ||
131 | // function linComb_(x,y,a,b) //do x=a*x+b*y for bigInts x and y and integers a and b | ||
132 | // function linCombShift_(x,y,b,ys) //do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys | ||
133 | // function mont_(x,y,n,np) //Montgomery multiplication (see comments where the function is defined) | ||
134 | // function mult_(x,y) //do x=x*y for bigInts x and y. | ||
135 | // function multInt_(x,n) //do x=x*n where x is a bigInt and n is an integer. | ||
136 | // function multMod_(x,y,n) //do x=x*y mod n for bigInts x,y,n. | ||
137 | // function powMod_(x,y,n) //do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1. | ||
138 | // function randBigInt_(b,n,s) //do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1. | ||
139 | // function randTruePrime_(ans,k) //do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb. | ||
140 | // function squareMod_(x,n) //do x=x*x mod n for bigInts x,n | ||
141 | // function sub_(x,y) //do x=x-y for bigInts x and y. Negative answers will be 2s complement. | ||
142 | // function subShift_(x,y,ys) //do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement. | ||
143 | // | ||
144 | // The following functions are based on algorithms from the _Handbook of Applied Cryptography_ | ||
145 | // powMod_() = algorithm 14.94, Montgomery exponentiation | ||
146 | // eGCD_,inverseMod_() = algorithm 14.61, Binary extended GCD_ | ||
147 | // GCD_() = algorothm 14.57, Lehmer's algorithm | ||
148 | // mont_() = algorithm 14.36, Montgomery multiplication | ||
149 | // divide_() = algorithm 14.20 Multiple-precision division | ||
150 | // squareMod_() = algorithm 14.16 Multiple-precision squaring | ||
151 | // randTruePrime_() = algorithm 4.62, Maurer's algorithm | ||
152 | // millerRabin() = algorithm 4.24, Miller-Rabin algorithm | ||
153 | // | ||
154 | // Profiling shows: | ||
155 | // randTruePrime_() spends: | ||
156 | // 10% of its time in calls to powMod_() | ||
157 | // 85% of its time in calls to millerRabin() | ||
158 | // millerRabin() spends: | ||
159 | // 99% of its time in calls to powMod_() (always with a base of 2) | ||
160 | // powMod_() spends: | ||
161 | // 94% of its time in calls to mont_() (almost always with x==y) | ||
162 | // | ||
163 | // This suggests there are several ways to speed up this library slightly: | ||
164 | // - convert powMod_ to use a Montgomery form of k-ary window (or maybe a Montgomery form of sliding window) | ||
165 | // -- this should especially focus on being fast when raising 2 to a power mod n | ||
166 | // - convert randTruePrime_() to use a minimum r of 1/3 instead of 1/2 with the appropriate change to the test | ||
167 | // - tune the parameters in randTruePrime_(), including c, m, and recLimit | ||
168 | // - speed up the single loop in mont_() that takes 95% of the runtime, perhaps by reducing checking | ||
169 | // within the loop when all the parameters are the same length. | ||
170 | // | ||
171 | // There are several ideas that look like they wouldn't help much at all: | ||
172 | // - replacing trial division in randTruePrime_() with a sieve (that speeds up something taking almost no time anyway) | ||
173 | // - increase bpe from 15 to 30 (that would help if we had a 32*32->64 multiplier, but not with JavaScript's 32*32->32) | ||
174 | // - speeding up mont_(x,y,n,np) when x==y by doing a non-modular, non-Montgomery square | ||
175 | // followed by a Montgomery reduction. The intermediate answer will be twice as long as x, so that | ||
176 | // method would be slower. This is unfortunate because the code currently spends almost all of its time | ||
177 | // doing mont_(x,x,...), both for randTruePrime_() and powMod_(). A faster method for Montgomery squaring | ||
178 | // would have a large impact on the speed of randTruePrime_() and powMod_(). HAC has a couple of poorly-worded | ||
179 | // sentences that seem to imply it's faster to do a non-modular square followed by a single | ||
180 | // Montgomery reduction, but that's obviously wrong. | ||
181 | //////////////////////////////////////////////////////////////////////////////////////// | ||
182 | |||
183 | // | ||
184 | //The whole library has been moved into the Baird.Crypto.BigInt scope by Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | ||
185 | // | ||
186 | Baird.Crypto.BigInt.VERSION = "5.0"; | ||
187 | Baird.Crypto.BigInt.NAME = "Baird.Crypto.BigInt"; | ||
188 | |||
189 | MochiKit.Base.update(Baird.Crypto.BigInt, { | ||
190 | //globals | ||
191 | 'bpe': 0, //bits stored per array element | ||
192 | 'mask': 0, //AND this with an array element to chop it down to bpe bits | ||
193 | 'radix': Baird.Crypto.BigInt.mask + 1,//equals 2^bpe. A single 1 bit to the left of the last bit of mask. | ||
194 | |||
195 | //the digits for converting to different bases | ||
196 | 'digitsStr': '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_=!@#$%^&*()[]{}|;:,.<>/?`~ \\\'\"+-', | ||
197 | |||
198 | //initialize the global variables | ||
199 | for (bpe=0; (1<<(bpe+1)) > (1<<bpe); bpe++); //bpe=number of bits in the mantissa on this platform | ||
200 | bpe>>=1; //bpe=number of bits in one element of the array representing the bigInt | ||
201 | mask=(1<<bpe)-1; //AND the mask with an integer to get its bpe least significant bits | ||
202 | radix=mask+1; //2^bpe. a single 1 bit to the left of the first bit of mask | ||
203 | one=int2bigInt(1,1,1); //constant used in powMod_() | ||
204 | |||
205 | //the following global variables are scratchpad memory to | ||
206 | //reduce dynamic memory allocation in the inner loop | ||
207 | t=new Array(0); | ||
208 | ss=t; //used in mult_() | ||
209 | s0=t; //used in multMod_(), squareMod_() | ||
210 | s1=t; //used in powMod_(), multMod_(), squareMod_() | ||
211 | s2=t; //used in powMod_(), multMod_() | ||
212 | s3=t; //used in powMod_() | ||
213 | s4=t; s5=t; //used in mod_() | ||
214 | s6=t; //used in bigInt2str() | ||
215 | s7=t; //used in powMod_() | ||
216 | T=t; //used in GCD_() | ||
217 | sa=t; //used in mont_() | ||
218 | mr_x1=t; mr_r=t; mr_a=t; //used in millerRabin() | ||
219 | eg_v=t; eg_u=t; eg_A=t; eg_B=t; eg_C=t; eg_D=t; //used in eGCD_(), inverseMod_() | ||
220 | md_q1=t; md_q2=t; md_q3=t; md_r=t; md_r1=t; md_r2=t; md_tt=t; //used in mod_() | ||
221 | |||
222 | primes=t; pows=t; s_i=t; s_i2=t; s_R=t; s_rm=t; s_q=t; s_n1=t; | ||
223 | s_a=t; s_r2=t; s_n=t; s_b=t; s_d=t; s_x1=t; s_x2=t, s_aa=t; //used in randTruePrime_() | ||
224 | |||
225 | //////////////////////////////////////////////////////////////////////////////////////// | ||
226 | |||
227 | //return array of all primes less than integer n | ||
228 | 'findPrimes': function(n) { | ||
229 | var i,s,p,ans; | ||
230 | s=new Array(n); | ||
231 | for (i=0;i<n;i++) | ||
232 | s[i]=0; | ||
233 | s[0]=2; | ||
234 | p=0; //first p elements of s are primes, the rest are a sieve | ||
235 | for(;s[p]<n;) { //s[p] is the pth prime | ||
236 | for(i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p] | ||
237 | s[i]=1; | ||
238 | p++; | ||
239 | s[p]=s[p-1]+1; | ||
240 | for(; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0) | ||
241 | } | ||
242 | ans=new Array(p); | ||
243 | for(i=0;i<p;i++) | ||
244 | ans[i]=s[i]; | ||
245 | return ans; | ||
246 | }, | ||
247 | |||
248 | //does a single round of Miller-Rabin base b consider x to be a possible prime? | ||
249 | //x is a bigInt, and b is an integer | ||
250 | 'millerRabin': function(x,b) { | ||
251 | var i,j,k,s; | ||
252 | |||
253 | if (mr_x1.length!=x.length) { | ||
254 | mr_x1=dup(x); | ||
255 | mr_r=dup(x); | ||
256 | mr_a=dup(x); | ||
257 | } | ||
258 | |||
259 | copyInt_(mr_a,b); | ||
260 | copy_(mr_r,x); | ||
261 | copy_(mr_x1,x); | ||
262 | |||
263 | addInt_(mr_r,-1); | ||
264 | addInt_(mr_x1,-1); | ||
265 | |||
266 | //s=the highest power of two that divides mr_r | ||
267 | k=0; | ||
268 | for (i=0;i<mr_r.length;i++) | ||
269 | for (j=1;j<mask;j<<=1) | ||
270 | if (x[i] & j) { | ||
271 | s=(k<mr_r.length+bpe ? k : 0); | ||
272 | i=mr_r.length; | ||
273 | j=mask; | ||
274 | } else | ||
275 | k++; | ||
276 | |||
277 | if (s) | ||
278 | rightShift_(mr_r,s); | ||
279 | |||
280 | powMod_(mr_a,mr_r,x); | ||
281 | |||
282 | if (!equalsInt(mr_a,1) && !equals(mr_a,mr_x1)) { | ||
283 | j=1; | ||
284 | while (j<=s-1 && !equals(mr_a,mr_x1)) { | ||
285 | squareMod_(mr_a,x); | ||
286 | if (equalsInt(mr_a,1)) { | ||
287 | return 0; | ||
288 | } | ||
289 | j++; | ||
290 | } | ||
291 | if (!equals(mr_a,mr_x1)) { | ||
292 | return 0; | ||
293 | } | ||
294 | } | ||
295 | |||
296 | return 1; | ||
297 | }, | ||
298 | |||
299 | //returns how many bits long the bigInt is, not counting leading zeros. | ||
300 | 'bitSize': function(x) { | ||
301 | var j,z,w; | ||
302 | for (j=x.length-1; (x[j]==0) && (j>0); j--); | ||
303 | for (z=0,w=x[j]; w; (w>>=1),z++); | ||
304 | z+=bpe*j; | ||
305 | return z; | ||
306 | }, | ||
307 | |||
308 | //return a copy of x with at least n elements, adding leading zeros if needed | ||
309 | 'expand': function(x,n) { | ||
310 | var ans=int2bigInt(0,(x.length>n ? x.length : n)*bpe,0); | ||
311 | copy_(ans,x); | ||
312 | return ans; | ||
313 | }, | ||
314 | |||
315 | //return a k-bit true random prime using Maurer's algorithm. | ||
316 | 'randTruePrime': function(k) { | ||
317 | var ans=int2bigInt(0,k,0); | ||
318 | randTruePrime_(ans,k); | ||
319 | return trim(ans,1); | ||
320 | }, | ||
321 | |||
322 | //return a new bigInt equal to (x mod n) for bigInts x and n. | ||
323 | 'mod': function(x,n) { | ||
324 | var ans=dup(x); | ||
325 | mod_(ans,n); | ||
326 | return trim(ans,1); | ||
327 | }, | ||
328 | |||
329 | //return (x+n) where x is a bigInt and n is an integer. | ||
330 | 'addInt': function(x,n) { | ||
331 | var ans=expand(x,x.length+1); | ||
332 | addInt_(ans,n); | ||
333 | return trim(ans,1); | ||
334 | }, | ||
335 | |||
336 | //return x*y for bigInts x and y. This is faster when y<x. | ||
337 | 'mult': function(x,y) { | ||
338 | var ans=expand(x,x.length+y.length); | ||
339 | mult_(ans,y); | ||
340 | return trim(ans,1); | ||
341 | }, | ||
342 | |||
343 | //return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n. | ||
344 | 'powMod': function(x,y,n) { | ||
345 | var ans=expand(x,n.length); | ||
346 | powMod_(ans,trim(y,2),trim(n,2),0); //this should work without the trim, but doesn't | ||
347 | return trim(ans,1); | ||
348 | }, | ||
349 | |||
350 | //return (x-y) for bigInts x and y. Negative answers will be 2s complement | ||
351 | 'sub': function(x,y) { | ||
352 | var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1)); | ||
353 | sub_(ans,y); | ||
354 | return trim(ans,1); | ||
355 | }, | ||
356 | |||
357 | //return (x+y) for bigInts x and y. | ||
358 | 'add': function(x,y) { | ||
359 | var ans=expand(x,(x.length>y.length ? x.length+1 : y.length+1)); | ||
360 | add_(ans,y); | ||
361 | return trim(ans,1); | ||
362 | }, | ||
363 | |||
364 | //return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null | ||
365 | 'inverseMod': function(x,n) { | ||
366 | var ans=expand(x,n.length); | ||
367 | var s; | ||
368 | s=inverseMod_(ans,n); | ||
369 | return s ? trim(ans,1) : null; | ||
370 | }, | ||
371 | |||
372 | //return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x. | ||
373 | 'multMod': function(x,y,n) { | ||
374 | var ans=expand(x,n.length); | ||
375 | multMod_(ans,y,n); | ||
376 | return trim(ans,1); | ||
377 | }, | ||
378 | |||
379 | //generate a k-bit true random prime using Maurer's algorithm, | ||
380 | //and put it into ans. The bigInt ans must be large enough to hold it. | ||
381 | 'randTruePrime_': function(ans,k) { | ||
382 | var c,m,pm,dd,j,r,B,divisible,z,zz,recSize; | ||
383 | |||
384 | if (primes.length==0) | ||
385 | primes=findPrimes(30000); //check for divisibility by primes <=30000 | ||
386 | |||
387 | if (pows.length==0) { | ||
388 | pows=new Array(512); | ||
389 | for (j=0;j<512;j++) { | ||
390 | pows[j]=Math.pow(2,j/511.-1.); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | //c and m should be tuned for a particular machine and value of k, to maximize speed | ||
395 | //this was: c=primes[primes.length-1]/k/k; //check using all the small primes. (c=0.1 in HAC) | ||
396 | c=0.1; | ||
397 | m=20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits | ||
398 | recLimit=20; /*must be at least 2 (was 29)*/ //stop recursion when k <=recLimit | ||
399 | |||
400 | if (s_i2.length!=ans.length) { | ||
401 | s_i2=dup(ans); | ||
402 | s_R =dup(ans); | ||
403 | s_n1=dup(ans); | ||
404 | s_r2=dup(ans); | ||
405 | s_d =dup(ans); | ||
406 | s_x1=dup(ans); | ||
407 | s_x2=dup(ans); | ||
408 | s_b =dup(ans); | ||
409 | s_n =dup(ans); | ||
410 | s_i =dup(ans); | ||
411 | s_rm=dup(ans); | ||
412 | s_q =dup(ans); | ||
413 | s_a =dup(ans); | ||
414 | s_aa=dup(ans); | ||
415 | } | ||
416 | |||
417 | if (k <= recLimit) { //generate small random primes by trial division up to its square root | ||
418 | pm=(1<<((k+2)>>1))-1; //pm is binary number with all ones, just over sqrt(2^k) | ||
419 | copyInt_(ans,0); | ||
420 | for (dd=1;dd;) { | ||
421 | dd=0; | ||
422 | ans[0]= 1 | (1<<(k-1)) | Math.floor(Math.random()*(1<<k)); //random, k-bit, odd integer, with msb 1 | ||
423 | for (j=1;(j<primes.length) && ((primes[j]&pm)==primes[j]);j++) { //trial division by all primes 3...sqrt(2^k) | ||
424 | if (0==(ans[0]%primes[j])) { | ||
425 | dd=1; | ||
426 | break; | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | carry_(ans); | ||
431 | return; | ||
432 | } | ||
433 | |||
434 | B=c*k*k; //try small primes up to B (or all the primes[] array if the largest is less than B). | ||
435 | if (k>2*m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits | ||
436 | for (r=1; k-k*r<=m; ) | ||
437 | r=pows[Math.floor(Math.random()*512)]; //r=Math.pow(2,Math.random()-1); | ||
438 | else | ||
439 | r=.5; | ||
440 | |||
441 | //simulation suggests the more complex algorithm using r=.333 is only slightly faster. | ||
442 | |||
443 | recSize=Math.floor(r*k)+1; | ||
444 | |||
445 | randTruePrime_(s_q,recSize); | ||
446 | copyInt_(s_i2,0); | ||
447 | s_i2[Math.floor((k-2)/bpe)] |= (1<<((k-2)%bpe)); //s_i2=2^(k-2) | ||
448 | divide_(s_i2,s_q,s_i,s_rm); //s_i=floor((2^(k-1))/(2q)) | ||
449 | |||
450 | z=bitSize(s_i); | ||
451 | |||
452 | for (;;) { | ||
453 | for (;;) { //generate z-bit numbers until one falls in the range [0,s_i-1] | ||
454 | randBigInt_(s_R,z,0); | ||
455 | if (greater(s_i,s_R)) | ||
456 | break; | ||
457 | } //now s_R is in the range [0,s_i-1] | ||
458 | addInt_(s_R,1); //now s_R is in the range [1,s_i] | ||
459 | add_(s_R,s_i); //now s_R is in the range [s_i+1,2*s_i] | ||
460 | |||
461 | copy_(s_n,s_q); | ||
462 | mult_(s_n,s_R); | ||
463 | multInt_(s_n,2); | ||
464 | addInt_(s_n,1); //s_n=2*s_R*s_q+1 | ||
465 | |||
466 | copy_(s_r2,s_R); | ||
467 | multInt_(s_r2,2); //s_r2=2*s_R | ||
468 | |||
469 | //check s_n for divisibility by small primes up to B | ||
470 | for (divisible=0,j=0; (j<primes.length) && (primes[j]<B); j++) | ||
471 | if (modInt(s_n,primes[j])==0) { | ||
472 | divisible=1; | ||
473 | break; | ||
474 | } | ||
475 | |||
476 | if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2 | ||
477 | if (!millerRabin(s_n,2)) //this line represents 75% of the total runtime for randTruePrime_ | ||
478 | divisible=1; | ||
479 | |||
480 | if (!divisible) { //if it passes that test, continue checking s_n | ||
481 | addInt_(s_n,-3); | ||
482 | for (j=s_n.length-1;(s_n[j]==0) && (j>0); j--); //strip leading zeros | ||
483 | for (zz=0,w=s_n[j]; w; (w>>=1),zz++); | ||
484 | zz+=bpe*j; //zz=number of bits in s_n, ignoring leading zeros | ||
485 | for (;;) { //generate z-bit numbers until one falls in the range [0,s_n-1] | ||
486 | randBigInt_(s_a,zz,0); | ||
487 | if (greater(s_n,s_a)) | ||
488 | break; | ||
489 | } //now s_a is in the range [0,s_n-1] | ||
490 | addInt_(s_n,3); //now s_a is in the range [0,s_n-4] | ||
491 | addInt_(s_a,2); //now s_a is in the range [2,s_n-2] | ||
492 | copy_(s_b,s_a); | ||
493 | copy_(s_n1,s_n); | ||
494 | addInt_(s_n1,-1); | ||
495 | powMod_(s_b,s_n1,s_n); //s_b=s_a^(s_n-1) modulo s_n | ||
496 | addInt_(s_b,-1); | ||
497 | if (isZero(s_b)) { | ||
498 | copy_(s_b,s_a); | ||
499 | powMod_(s_b,s_r2,s_n); | ||
500 | addInt_(s_b,-1); | ||
501 | copy_(s_aa,s_n); | ||
502 | copy_(s_d,s_b); | ||
503 | GCD_(s_d,s_n); //if s_b and s_n are relatively prime, then s_n is a prime | ||
504 | if (equalsInt(s_d,1)) { | ||
505 | copy_(ans,s_aa); | ||
506 | return; //if we've made it this far, then s_n is absolutely guaranteed to be prime | ||
507 | } | ||
508 | } | ||
509 | } | ||
510 | } | ||
511 | }, | ||
512 | |||
513 | //set b to an n-bit random BigInt. If s=1, then nth bit (most significant bit) is set to 1. | ||
514 | //array b must be big enough to hold the result. Must have n>=1 | ||
515 | 'randBigInt_': function(b,n,s) { | ||
516 | var i,a; | ||
517 | for (i=0;i<b.length;i++) | ||
518 | b[i]=0; | ||
519 | a=Math.floor((n-1)/bpe)+1; //# array elements to hold the BigInt | ||
520 | for (i=0;i<a;i++) { | ||
521 | b[i]=Math.floor(Math.random()*(1<<(bpe-1))); | ||
522 | } | ||
523 | b[a-1] &= (2<<((n-1)%bpe))-1; | ||
524 | if (s) | ||
525 | b[a-1] |= (1<<((n-1)%bpe)); | ||
526 | }, | ||
527 | |||
528 | //set x to the greatest common divisor of x and y. | ||
529 | //x,y are bigInts with the same number of elements. y is destroyed. | ||
530 | 'GCD_': function(x,y) { | ||
531 | var i,xp,yp,A,B,C,D,q,sing; | ||
532 | if (T.length!=x.length) | ||
533 | T=dup(x); | ||
534 | |||
535 | sing=1; | ||
536 | while (sing) { //while y has nonzero elements other than y[0] | ||
537 | sing=0; | ||
538 | for (i=1;i<y.length;i++) //check if y has nonzero elements other than 0 | ||
539 | if (y[i]) { | ||
540 | sing=1; | ||
541 | break; | ||
542 | } | ||
543 | if (!sing) break; //quit when y all zero elements except possibly y[0] | ||
544 | |||
545 | for (i=x.length;!x[i] && i>=0;i--); //find most significant element of x | ||
546 | xp=x[i]; | ||
547 | yp=y[i]; | ||
548 | A=1; B=0; C=0; D=1; | ||
549 | while ((yp+C) && (yp+D)) { | ||
550 | q =Math.floor((xp+A)/(yp+C)); | ||
551 | qp=Math.floor((xp+B)/(yp+D)); | ||
552 | if (q!=qp) | ||
553 | break; | ||
554 | t= A-q*C; A=C; C=t; // do (A,B,xp, C,D,yp) = (C,D,yp, A,B,xp) - q*(0,0,0, C,D,yp) | ||
555 | t= B-q*D; B=D; D=t; | ||
556 | t=xp-q*yp; xp=yp; yp=t; | ||
557 | } | ||
558 | if (B) { | ||
559 | copy_(T,x); | ||
560 | linComb_(x,y,A,B); //x=A*x+B*y | ||
561 | linComb_(y,T,D,C); //y=D*y+C*T | ||
562 | } else { | ||
563 | mod_(x,y); | ||
564 | copy_(T,x); | ||
565 | copy_(x,y); | ||
566 | copy_(y,T); | ||
567 | } | ||
568 | } | ||
569 | if (y[0]==0) | ||
570 | return; | ||
571 | t=modInt(x,y[0]); | ||
572 | copyInt_(x,y[0]); | ||
573 | y[0]=t; | ||
574 | while (y[0]) { | ||
575 | x[0]%=y[0]; | ||
576 | t=x[0]; x[0]=y[0]; y[0]=t; | ||
577 | } | ||
578 | }, | ||
579 | |||
580 | //do x=x**(-1) mod n, for bigInts x and n. | ||
581 | //If no inverse exists, it sets x to zero and returns 0, else it returns 1. | ||
582 | //The x array must be at least as large as the n array. | ||
583 | function inverseMod_(x,n) { | ||
584 | var k=1+2*Math.max(x.length,n.length); | ||
585 | |||
586 | if(!(x[0]&1) && !(n[0]&1)) { //if both inputs are even, then inverse doesn't exist | ||
587 | copyInt_(x,0); | ||
588 | return 0; | ||
589 | } | ||
590 | |||
591 | if (eg_u.length!=k) { | ||
592 | eg_u=new Array(k); | ||
593 | eg_v=new Array(k); | ||
594 | eg_A=new Array(k); | ||
595 | eg_B=new Array(k); | ||
596 | eg_C=new Array(k); | ||
597 | eg_D=new Array(k); | ||
598 | } | ||
599 | |||
600 | copy_(eg_u,x); | ||
601 | copy_(eg_v,n); | ||
602 | copyInt_(eg_A,1); | ||
603 | copyInt_(eg_B,0); | ||
604 | copyInt_(eg_C,0); | ||
605 | copyInt_(eg_D,1); | ||
606 | for (;;) { | ||
607 | while(!(eg_u[0]&1)) { //while eg_u is even | ||
608 | halve_(eg_u); | ||
609 | if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if eg_A==eg_B==0 mod 2 | ||
610 | halve_(eg_A); | ||
611 | halve_(eg_B); | ||
612 | } else { | ||
613 | add_(eg_A,n); halve_(eg_A); | ||
614 | sub_(eg_B,x); halve_(eg_B); | ||
615 | } | ||
616 | } | ||
617 | |||
618 | while (!(eg_v[0]&1)) { //while eg_v is even | ||
619 | halve_(eg_v); | ||
620 | if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if eg_C==eg_D==0 mod 2 | ||
621 | halve_(eg_C); | ||
622 | halve_(eg_D); | ||
623 | } else { | ||
624 | add_(eg_C,n); halve_(eg_C); | ||
625 | sub_(eg_D,x); halve_(eg_D); | ||
626 | } | ||
627 | } | ||
628 | |||
629 | if (!greater(eg_v,eg_u)) { //eg_v <= eg_u | ||
630 | sub_(eg_u,eg_v); | ||
631 | sub_(eg_A,eg_C); | ||
632 | sub_(eg_B,eg_D); | ||
633 | } else { //eg_v > eg_u | ||
634 | sub_(eg_v,eg_u); | ||
635 | sub_(eg_C,eg_A); | ||
636 | sub_(eg_D,eg_B); | ||
637 | } | ||
638 | |||
639 | if (equalsInt(eg_u,0)) { | ||
640 | if (negative(eg_C)) //make sure answer is nonnegative | ||
641 | add_(eg_C,n); | ||
642 | copy_(x,eg_C); | ||
643 | |||
644 | if (!equalsInt(eg_v,1)) { //if GCD_(x,n)!=1, then there is no inverse | ||
645 | copyInt_(x,0); | ||
646 | return 0; | ||
647 | } | ||
648 | return 1; | ||
649 | } | ||
650 | } | ||
651 | } | ||
652 | |||
653 | //return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse | ||
654 | function inverseModInt_(x,n) { | ||
655 | var a=1,b=0,t; | ||
656 | for (;;) { | ||
657 | if (x==1) return a; | ||
658 | if (x==0) return 0; | ||
659 | b-=a*Math.floor(n/x); | ||
660 | n%=x; | ||
661 | |||
662 | if (n==1) return b; //to avoid negatives, change this b to n-b, and each -= to += | ||
663 | if (n==0) return 0; | ||
664 | a-=b*Math.floor(x/n); | ||
665 | x%=n; | ||
666 | } | ||
667 | } | ||
668 | |||
669 | //Given positive bigInts x and y, change the bigints v, a, and b to positive bigInts such that: | ||
670 | // v = GCD_(x,y) = a*x-b*y | ||
671 | //The bigInts v, a, b, must have exactly as many elements as the larger of x and y. | ||
672 | function eGCD_(x,y,v,a,b) { | ||
673 | var g=0; | ||
674 | var k=Math.max(x.length,y.length); | ||
675 | if (eg_u.length!=k) { | ||
676 | eg_u=new Array(k); | ||
677 | eg_A=new Array(k); | ||
678 | eg_B=new Array(k); | ||
679 | eg_C=new Array(k); | ||
680 | eg_D=new Array(k); | ||
681 | } | ||
682 | while(!(x[0]&1) && !(y[0]&1)) { //while x and y both even | ||
683 | halve_(x); | ||
684 | halve_(y); | ||
685 | g++; | ||
686 | } | ||
687 | copy_(eg_u,x); | ||
688 | copy_(v,y); | ||
689 | copyInt_(eg_A,1); | ||
690 | copyInt_(eg_B,0); | ||
691 | copyInt_(eg_C,0); | ||
692 | copyInt_(eg_D,1); | ||
693 | for (;;) { | ||
694 | while(!(eg_u[0]&1)) { //while u is even | ||
695 | halve_(eg_u); | ||
696 | if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if A==B==0 mod 2 | ||
697 | halve_(eg_A); | ||
698 | halve_(eg_B); | ||
699 | } else { | ||
700 | add_(eg_A,y); halve_(eg_A); | ||
701 | sub_(eg_B,x); halve_(eg_B); | ||
702 | } | ||
703 | } | ||
704 | |||
705 | while (!(v[0]&1)) { //while v is even | ||
706 | halve_(v); | ||
707 | if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if C==D==0 mod 2 | ||
708 | halve_(eg_C); | ||
709 | halve_(eg_D); | ||
710 | } else { | ||
711 | add_(eg_C,y); halve_(eg_C); | ||
712 | sub_(eg_D,x); halve_(eg_D); | ||
713 | } | ||
714 | } | ||
715 | |||
716 | if (!greater(v,eg_u)) { //v<=u | ||
717 | sub_(eg_u,v); | ||
718 | sub_(eg_A,eg_C); | ||
719 | sub_(eg_B,eg_D); | ||
720 | } else { //v>u | ||
721 | sub_(v,eg_u); | ||
722 | sub_(eg_C,eg_A); | ||
723 | sub_(eg_D,eg_B); | ||
724 | } | ||
725 | if (equalsInt(eg_u,0)) { | ||
726 | if (negative(eg_C)) { //make sure a (C)is nonnegative | ||
727 | add_(eg_C,y); | ||
728 | sub_(eg_D,x); | ||
729 | } | ||
730 | multInt_(eg_D,-1); ///make sure b (D) is nonnegative | ||
731 | copy_(a,eg_C); | ||
732 | copy_(b,eg_D); | ||
733 | leftShift_(v,g); | ||
734 | return; | ||
735 | } | ||
736 | } | ||
737 | } | ||
738 | |||
739 | |||
740 | //is bigInt x negative? | ||
741 | function negative(x) { | ||
742 | return ((x[x.length-1]>>(bpe-1))&1); | ||
743 | } | ||
744 | |||
745 | |||
746 | //is (x << (shift*bpe)) > y? | ||
747 | //x and y are nonnegative bigInts | ||
748 | //shift is a nonnegative integer | ||
749 | function greaterShift(x,y,shift) { | ||
750 | var kx=x.length, ky=y.length; | ||
751 | k=((kx+shift)<ky) ? (kx+shift) : ky; | ||
752 | for (i=ky-1-shift; i<kx && i>=0; i++) | ||
753 | if (x[i]>0) | ||
754 | return 1; //if there are nonzeros in x to the left of the first column of y, then x is bigger | ||
755 | for (i=kx-1+shift; i<ky; i++) | ||
756 | if (y[i]>0) | ||
757 | return 0; //if there are nonzeros in y to the left of the first column of x, then x is not bigger | ||
758 | for (i=k-1; i>=shift; i--) | ||
759 | if (x[i-shift]>y[i]) return 1; | ||
760 | else if (x[i-shift]<y[i]) return 0; | ||
761 | return 0; | ||
762 | } | ||
763 | |||
764 | //is x > y? (x and y both nonnegative) | ||
765 | function greater(x,y) { | ||
766 | var i; | ||
767 | var k=(x.length<y.length) ? x.length : y.length; | ||
768 | |||
769 | for (i=x.length;i<y.length;i++) | ||
770 | if (y[i]) | ||
771 | return 0; //y has more digits | ||
772 | |||
773 | for (i=y.length;i<x.length;i++) | ||
774 | if (x[i]) | ||
775 | return 1; //x has more digits | ||
776 | |||
777 | for (i=k-1;i>=0;i--) | ||
778 | if (x[i]>y[i]) | ||
779 | return 1; | ||
780 | else if (x[i]<y[i]) | ||
781 | return 0; | ||
782 | return 0; | ||
783 | } | ||
784 | |||
785 | //divide_ x by y giving quotient q and remainder r. (q=floor(x/y), r=x mod y). All 4 are bigints. | ||
786 | //x must have at least one leading zero element. | ||
787 | //y must be nonzero. | ||
788 | //q and r must be arrays that are exactly the same length as x. | ||
789 | //the x array must have at least as many elements as y. | ||
790 | function divide_(x,y,q,r) { | ||
791 | var kx, ky; | ||
792 | var i,j,y1,y2,c,a,b; | ||
793 | copy_(r,x); | ||
794 | for (ky=y.length;y[ky-1]==0;ky--); //kx,ky is number of elements in x,y, not including leading zeros | ||
795 | for (kx=r.length;r[kx-1]==0 && kx>ky;kx--); | ||
796 | |||
797 | //normalize: ensure the most significant element of y has its highest bit set | ||
798 | b=y[ky-1]; | ||
799 | for (a=0; b; a++) | ||
800 | b>>=1; | ||
801 | a=bpe-a; //a is how many bits to shift so that the high order bit of y is leftmost in its array element | ||
802 | leftShift_(y,a); //multiply both by 1<<a now, then divide_ both by that at the end | ||
803 | leftShift_(r,a); | ||
804 | |||
805 | copyInt_(q,0); // q=0 | ||
806 | while (!greaterShift(y,r,kx-ky)) { // while (leftShift_(y,kx-ky) <= r) { | ||
807 | subShift_(r,y,kx-ky); // r=r-leftShift_(y,kx-ky) | ||
808 | q[kx-ky]++; // q[kx-ky]++; | ||
809 | } // } | ||
810 | |||
811 | for (i=kx-1; i>=ky; i--) { | ||
812 | if (r[i]==y[ky-1]) | ||
813 | q[i-ky]=mask; | ||
814 | else | ||
815 | q[i-ky]=Math.floor((r[i]*radix+r[i-1])/y[ky-1]); | ||
816 | |||
817 | //The following for(;;) loop is equivalent to the commented while loop, | ||
818 | //except that the uncommented version avoids overflow. | ||
819 | //The commented loop comes from HAC, which assumes r[-1]==y[-1]==0 | ||
820 | // while (q[i-ky]*(y[ky-1]*radix+y[ky-2]) > r[i]*radix*radix+r[i-1]*radix+r[i-2]) | ||
821 | // q[i-ky]--; | ||
822 | for (;;) { | ||
823 | y2=(ky>1 ? y[ky-2] : 0)*q[i-ky]; | ||
824 | c=y2>>bpe; | ||
825 | y2=y2 & mask; | ||
826 | y1=c+q[i-ky]*y[ky-1]; | ||
827 | c=y1>>bpe; | ||
828 | y1=y1 & mask; | ||
829 | |||
830 | if (c==r[i] ? y1==r[i-1] ? y2>(i>1 ? r[i-2] : 0) : y1>r[i-1] : c>r[i]) | ||
831 | q[i-ky]--; | ||
832 | else | ||
833 | break; | ||
834 | } | ||
835 | |||
836 | linCombShift_(r,y,-q[i-ky],i-ky); //r=r-q[i-ky]*leftShift_(y,i-ky) | ||
837 | if (negative(r)) { | ||
838 | addShift_(r,y,i-ky); //r=r+leftShift_(y,i-ky) | ||
839 | q[i-ky]--; | ||
840 | } | ||
841 | } | ||
842 | |||
843 | rightShift_(y,a); //undo the normalization step | ||
844 | rightShift_(r,a); //undo the normalization step | ||
845 | } | ||
846 | |||
847 | //do carries and borrows so each element of the bigInt x fits in bpe bits. | ||
848 | function carry_(x) { | ||
849 | var i,k,c,b; | ||
850 | k=x.length; | ||
851 | c=0; | ||
852 | for (i=0;i<k;i++) { | ||
853 | c+=x[i]; | ||
854 | b=0; | ||
855 | if (c<0) { | ||
856 | b=-(c>>bpe); | ||
857 | c+=b*radix; | ||
858 | } | ||
859 | x[i]=c & mask; | ||
860 | c=(c>>bpe)-b; | ||
861 | } | ||
862 | } | ||
863 | |||
864 | //return x mod n for bigInt x and integer n. | ||
865 | function modInt(x,n) { | ||
866 | var i,c=0; | ||
867 | for (i=x.length-1; i>=0; i--) | ||
868 | c=(c*radix+x[i])%n; | ||
869 | return c; | ||
870 | } | ||
871 | |||
872 | //convert the integer t into a bigInt with at least the given number of bits. | ||
873 | //the returned array stores the bigInt in bpe-bit chunks, little endian (buff[0] is least significant word) | ||
874 | //Pad the array with leading zeros so that it has at least minSize elements. | ||
875 | //There will always be at least one leading 0 element. | ||
876 | function int2bigInt(t,bits,minSize) { | ||
877 | var i,k; | ||
878 | k=Math.ceil(bits/bpe)+1; | ||
879 | k=minSize>k ? minSize : k; | ||
880 | buff=new Array(k); | ||
881 | copyInt_(buff,t); | ||
882 | return buff; | ||
883 | } | ||
884 | |||
885 | //return the bigInt given a string representation in a given base. | ||
886 | //Pad the array with leading zeros so that it has at least minSize elements. | ||
887 | //If base=-1, then it reads in a space-separated list of array elements in decimal. | ||
888 | //The array will always have at least one leading zero, unless base=-1. | ||
889 | function str2bigInt(s,base,minSize) { | ||
890 | var d, i, j, x, y, kk; | ||
891 | var k=s.length; | ||
892 | if (base==-1) { //comma-separated list of array elements in decimal | ||
893 | x=new Array(0); | ||
894 | for (;;) { | ||
895 | y=new Array(x.length+1); | ||
896 | for (i=0;i<x.length;i++) | ||
897 | y[i+1]=x[i]; | ||
898 | y[0]=parseInt(s,10); | ||
899 | x=y; | ||
900 | d=s.indexOf(',',0); | ||
901 | if (d<1) | ||
902 | break; | ||
903 | s=s.substring(d+1); | ||
904 | if (s.length==0) | ||
905 | break; | ||
906 | } | ||
907 | if (x.length<minSize) { | ||
908 | y=new Array(minSize); | ||
909 | copy_(y,x); | ||
910 | return y; | ||
911 | } | ||
912 | return x; | ||
913 | } | ||
914 | |||
915 | x=int2bigInt(0,base*k,0); | ||
916 | for (i=0;i<k;i++) { | ||
917 | d=digitsStr.indexOf(s.substring(i,i+1),0); | ||
918 | if (base<=36 && d>=36) //convert lowercase to uppercase if base<=36 | ||
919 | d-=26; | ||
920 | if (d<base && d>=0) { //ignore illegal characters | ||
921 | multInt_(x,base); | ||
922 | addInt_(x,d); | ||
923 | } | ||
924 | } | ||
925 | |||
926 | for (k=x.length;k>0 && !x[k-1];k--); //strip off leading zeros | ||
927 | k=minSize>k+1 ? minSize : k+1; | ||
928 | y=new Array(k); | ||
929 | kk=k<x.length ? k : x.length; | ||
930 | for (i=0;i<kk;i++) | ||
931 | y[i]=x[i]; | ||
932 | for (;i<k;i++) | ||
933 | y[i]=0; | ||
934 | return y; | ||
935 | } | ||
936 | |||
937 | //is bigint x equal to integer y? | ||
938 | //y must have less than bpe bits | ||
939 | function equalsInt(x,y) { | ||
940 | var i; | ||
941 | if (x[0]!=y) | ||
942 | return 0; | ||
943 | for (i=1;i<x.length;i++) | ||
944 | if (x[i]) | ||
945 | return 0; | ||
946 | return 1; | ||
947 | } | ||
948 | |||
949 | //are bigints x and y equal? | ||
950 | //this works even if x and y are different lengths and have arbitrarily many leading zeros | ||
951 | function equals(x,y) { | ||
952 | var i; | ||
953 | var k=x.length<y.length ? x.length : y.length; | ||
954 | for (i=0;i<k;i++) | ||
955 | if (x[i]!=y[i]) | ||
956 | return 0; | ||
957 | if (x.length>y.length) { | ||
958 | for (;i<x.length;i++) | ||
959 | if (x[i]) | ||
960 | return 0; | ||
961 | } else { | ||
962 | for (;i<y.length;i++) | ||
963 | if (y[i]) | ||
964 | return 0; | ||
965 | } | ||
966 | return 1; | ||
967 | } | ||
968 | |||
969 | //is the bigInt x equal to zero? | ||
970 | function isZero(x) { | ||
971 | var i; | ||
972 | for (i=0;i<x.length;i++) | ||
973 | if (x[i]) | ||
974 | return 0; | ||
975 | return 1; | ||
976 | } | ||
977 | |||
978 | //convert a bigInt into a string in a given base, from base 2 up to base 95. | ||
979 | //Base -1 prints the contents of the array representing the number. | ||
980 | function bigInt2str(x,base) { | ||
981 | var i,t,s=""; | ||
982 | |||
983 | if (s6.length!=x.length) | ||
984 | s6=dup(x); | ||
985 | else | ||
986 | copy_(s6,x); | ||
987 | |||
988 | if (base==-1) { //return the list of array contents | ||
989 | for (i=x.length-1;i>0;i--) | ||
990 | s+=x[i]+','; | ||
991 | s+=x[0]; | ||
992 | } | ||
993 | else { //return it in the given base | ||
994 | while (!isZero(s6)) { | ||
995 | t=divInt_(s6,base); //t=s6 % base; s6=floor(s6/base); | ||
996 | s=digitsStr.substring(t,t+1)+s; | ||
997 | } | ||
998 | } | ||
999 | if (s.length==0) | ||
1000 | s="0"; | ||
1001 | return s; | ||
1002 | } | ||
1003 | |||
1004 | //returns a duplicate of bigInt x | ||
1005 | function dup(x) { | ||
1006 | var i; | ||
1007 | buff=new Array(x.length); | ||
1008 | copy_(buff,x); | ||
1009 | return buff; | ||
1010 | } | ||
1011 | |||
1012 | //do x=y on bigInts x and y. x must be an array at least as big as y (not counting the leading zeros in y). | ||
1013 | function copy_(x,y) { | ||
1014 | var i; | ||
1015 | var k=x.length<y.length ? x.length : y.length; | ||
1016 | for (i=0;i<k;i++) | ||
1017 | x[i]=y[i]; | ||
1018 | for (i=k;i<x.length;i++) | ||
1019 | x[i]=0; | ||
1020 | } | ||
1021 | |||
1022 | //do x=y on bigInt x and integer y. | ||
1023 | function copyInt_(x,n) { | ||
1024 | var i,c; | ||
1025 | for (c=n,i=0;i<x.length;i++) { | ||
1026 | x[i]=c & mask; | ||
1027 | c>>=bpe; | ||
1028 | } | ||
1029 | } | ||
1030 | |||
1031 | //do x=x+n where x is a bigInt and n is an integer. | ||
1032 | //x must be large enough to hold the result. | ||
1033 | function addInt_(x,n) { | ||
1034 | var i,k,c,b; | ||
1035 | x[0]+=n; | ||
1036 | k=x.length; | ||
1037 | c=0; | ||
1038 | for (i=0;i<k;i++) { | ||
1039 | c+=x[i]; | ||
1040 | b=0; | ||
1041 | if (c<0) { | ||
1042 | b=-(c>>bpe); | ||
1043 | c+=b*radix; | ||
1044 | } | ||
1045 | x[i]=c & mask; | ||
1046 | c=(c>>bpe)-b; | ||
1047 | if (!c) return; //stop carrying as soon as the carry_ is zero | ||
1048 | } | ||
1049 | } | ||
1050 | |||
1051 | //right shift bigInt x by n bits. 0 <= n < bpe. | ||
1052 | function rightShift_(x,n) { | ||
1053 | var i; | ||
1054 | var k=Math.floor(n/bpe); | ||
1055 | if (k) { | ||
1056 | for (i=0;i<x.length-k;i++) //right shift x by k elements | ||
1057 | x[i]=x[i+k]; | ||
1058 | for (;i<x.length;i++) | ||
1059 | x[i]=0; | ||
1060 | n%=bpe; | ||
1061 | } | ||
1062 | for (i=0;i<x.length-1;i++) { | ||
1063 | x[i]=mask & ((x[i+1]<<(bpe-n)) | (x[i]>>n)); | ||
1064 | } | ||
1065 | x[i]>>=n; | ||
1066 | } | ||
1067 | |||
1068 | //do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement | ||
1069 | function halve_(x) { | ||
1070 | var i; | ||
1071 | for (i=0;i<x.length-1;i++) { | ||
1072 | x[i]=mask & ((x[i+1]<<(bpe-1)) | (x[i]>>1)); | ||
1073 | } | ||
1074 | x[i]=(x[i]>>1) | (x[i] & (radix>>1)); //most significant bit stays the same | ||
1075 | } | ||
1076 | |||
1077 | //left shift bigInt x by n bits. | ||
1078 | function leftShift_(x,n) { | ||
1079 | var i; | ||
1080 | var k=Math.floor(n/bpe); | ||
1081 | if (k) { | ||
1082 | for (i=x.length; i>=k; i--) //left shift x by k elements | ||
1083 | x[i]=x[i-k]; | ||
1084 | for (;i>=0;i--) | ||
1085 | x[i]=0; | ||
1086 | n%=bpe; | ||
1087 | } | ||
1088 | if (!n) | ||
1089 | return; | ||
1090 | for (i=x.length-1;i>0;i--) { | ||
1091 | x[i]=mask & ((x[i]<<n) | (x[i-1]>>(bpe-n))); | ||
1092 | } | ||
1093 | x[i]=mask & (x[i]<<n); | ||
1094 | } | ||
1095 | |||
1096 | //do x=x*n where x is a bigInt and n is an integer. | ||
1097 | //x must be large enough to hold the result. | ||
1098 | function multInt_(x,n) { | ||
1099 | var i,k,c,b; | ||
1100 | if (!n) | ||
1101 | return; | ||
1102 | k=x.length; | ||
1103 | c=0; | ||
1104 | for (i=0;i<k;i++) { | ||
1105 | c+=x[i]*n; | ||
1106 | b=0; | ||
1107 | if (c<0) { | ||
1108 | b=-(c>>bpe); | ||
1109 | c+=b*radix; | ||
1110 | } | ||
1111 | x[i]=c & mask; | ||
1112 | c=(c>>bpe)-b; | ||
1113 | } | ||
1114 | } | ||
1115 | |||
1116 | //do x=floor(x/n) for bigInt x and integer n, and return the remainder | ||
1117 | function divInt_(x,n) { | ||
1118 | var i,r=0,s; | ||
1119 | for (i=x.length-1;i>=0;i--) { | ||
1120 | s=r*radix+x[i]; | ||
1121 | x[i]=Math.floor(s/n); | ||
1122 | r=s%n; | ||
1123 | } | ||
1124 | return r; | ||
1125 | } | ||
1126 | |||
1127 | //do the linear combination x=a*x+b*y for bigInts x and y, and integers a and b. | ||
1128 | //x must be large enough to hold the answer. | ||
1129 | function linComb_(x,y,a,b) { | ||
1130 | var i,c,k,kk; | ||
1131 | k=x.length<y.length ? x.length : y.length; | ||
1132 | kk=x.length; | ||
1133 | for (c=0,i=0;i<k;i++) { | ||
1134 | c+=a*x[i]+b*y[i]; | ||
1135 | x[i]=c & mask; | ||
1136 | c>>=bpe; | ||
1137 | } | ||
1138 | for (i=k;i<kk;i++) { | ||
1139 | c+=a*x[i]; | ||
1140 | x[i]=c & mask; | ||
1141 | c>>=bpe; | ||
1142 | } | ||
1143 | } | ||
1144 | |||
1145 | //do the linear combination x=a*x+b*(y<<(ys*bpe)) for bigInts x and y, and integers a, b and ys. | ||
1146 | //x must be large enough to hold the answer. | ||
1147 | function linCombShift_(x,y,b,ys) { | ||
1148 | var i,c,k,kk; | ||
1149 | k=x.length<ys+y.length ? x.length : ys+y.length; | ||
1150 | kk=x.length; | ||
1151 | for (c=0,i=ys;i<k;i++) { | ||
1152 | c+=x[i]+b*y[i-ys]; | ||
1153 | x[i]=c & mask; | ||
1154 | c>>=bpe; | ||
1155 | } | ||
1156 | for (i=k;c && i<kk;i++) { | ||
1157 | c+=x[i]; | ||
1158 | x[i]=c & mask; | ||
1159 | c>>=bpe; | ||
1160 | } | ||
1161 | } | ||
1162 | |||
1163 | //do x=x+(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys. | ||
1164 | //x must be large enough to hold the answer. | ||
1165 | function addShift_(x,y,ys) { | ||
1166 | var i,c,k,kk; | ||
1167 | k=x.length<ys+y.length ? x.length : ys+y.length; | ||
1168 | kk=x.length; | ||
1169 | for (c=0,i=ys;i<k;i++) { | ||
1170 | c+=x[i]+y[i-ys]; | ||
1171 | x[i]=c & mask; | ||
1172 | c>>=bpe; | ||
1173 | } | ||
1174 | for (i=k;c && i<kk;i++) { | ||
1175 | c+=x[i]; | ||
1176 | x[i]=c & mask; | ||
1177 | c>>=bpe; | ||
1178 | } | ||
1179 | } | ||
1180 | |||
1181 | //do x=x-(y<<(ys*bpe)) for bigInts x and y, and integers a,b and ys. | ||
1182 | //x must be large enough to hold the answer. | ||
1183 | function subShift_(x,y,ys) { | ||
1184 | var i,c,k,kk; | ||
1185 | k=x.length<ys+y.length ? x.length : ys+y.length; | ||
1186 | kk=x.length; | ||
1187 | for (c=0,i=ys;i<k;i++) { | ||
1188 | c+=x[i]-y[i-ys]; | ||
1189 | x[i]=c & mask; | ||
1190 | c>>=bpe; | ||
1191 | } | ||
1192 | for (i=k;c && i<kk;i++) { | ||
1193 | c+=x[i]; | ||
1194 | x[i]=c & mask; | ||
1195 | c>>=bpe; | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1199 | //do x=x-y for bigInts x and y. | ||
1200 | //x must be large enough to hold the answer. | ||
1201 | //negative answers will be 2s complement | ||
1202 | function sub_(x,y) { | ||
1203 | var i,c,k,kk; | ||
1204 | k=x.length<y.length ? x.length : y.length; | ||
1205 | for (c=0,i=0;i<k;i++) { | ||
1206 | c+=x[i]-y[i]; | ||
1207 | x[i]=c & mask; | ||
1208 | c>>=bpe; | ||
1209 | } | ||
1210 | for (i=k;c && i<x.length;i++) { | ||
1211 | c+=x[i]; | ||
1212 | x[i]=c & mask; | ||
1213 | c>>=bpe; | ||
1214 | } | ||
1215 | } | ||
1216 | |||
1217 | //do x=x+y for bigInts x and y. | ||
1218 | //x must be large enough to hold the answer. | ||
1219 | function add_(x,y) { | ||
1220 | var i,c,k,kk; | ||
1221 | k=x.length<y.length ? x.length : y.length; | ||
1222 | for (c=0,i=0;i<k;i++) { | ||
1223 | c+=x[i]+y[i]; | ||
1224 | x[i]=c & mask; | ||
1225 | c>>=bpe; | ||
1226 | } | ||
1227 | for (i=k;c && i<x.length;i++) { | ||
1228 | c+=x[i]; | ||
1229 | x[i]=c & mask; | ||
1230 | c>>=bpe; | ||
1231 | } | ||
1232 | } | ||
1233 | |||
1234 | //do x=x*y for bigInts x and y. This is faster when y<x. | ||
1235 | function mult_(x,y) { | ||
1236 | var i; | ||
1237 | if (ss.length!=2*x.length) | ||
1238 | ss=new Array(2*x.length); | ||
1239 | copyInt_(ss,0); | ||
1240 | for (i=0;i<y.length;i++) | ||
1241 | if (y[i]) | ||
1242 | linCombShift_(ss,x,y[i],i); //ss=1*ss+y[i]*(x<<(i*bpe)) | ||
1243 | copy_(x,ss); | ||
1244 | } | ||
1245 | |||
1246 | //do x=x mod n for bigInts x and n. | ||
1247 | function mod_(x,n) { | ||
1248 | if (s4.length!=x.length) | ||
1249 | s4=dup(x); | ||
1250 | else | ||
1251 | copy_(s4,x); | ||
1252 | if (s5.length!=x.length) | ||
1253 | s5=dup(x); | ||
1254 | divide_(s4,n,s5,x); //x = remainder of s4 / n | ||
1255 | } | ||
1256 | |||
1257 | //do x=x*y mod n for bigInts x,y,n. | ||
1258 | //for greater speed, let y<x. | ||
1259 | function multMod_(x,y,n) { | ||
1260 | var i; | ||
1261 | if (s0.length!=2*x.length) | ||
1262 | s0=new Array(2*x.length); | ||
1263 | copyInt_(s0,0); | ||
1264 | for (i=0;i<y.length;i++) | ||
1265 | if (y[i]) | ||
1266 | linCombShift_(s0,x,y[i],i); //s0=1*s0+y[i]*(x<<(i*bpe)) | ||
1267 | mod_(s0,n); | ||
1268 | copy_(x,s0); | ||
1269 | } | ||
1270 | |||
1271 | //do x=x*x mod n for bigInts x,n. | ||
1272 | function squareMod_(x,n) { | ||
1273 | var i,j,d,c,kx,kn,k; | ||
1274 | for (kx=x.length; kx>0 && !x[kx-1]; kx--); //ignore leading zeros in x | ||
1275 | k=kx>n.length ? 2*kx : 2*n.length; //k=# elements in the product, which is twice the elements in the larger of x and n | ||
1276 | if (s0.length!=k) | ||
1277 | s0=new Array(k); | ||
1278 | copyInt_(s0,0); | ||
1279 | for (i=0;i<kx;i++) { | ||
1280 | c=s0[2*i]+x[i]*x[i]; | ||
1281 | s0[2*i]=c & mask; | ||
1282 | c>>=bpe; | ||
1283 | for (j=i+1;j<kx;j++) { | ||
1284 | c=s0[i+j]+2*x[i]*x[j]+c; | ||
1285 | s0[i+j]=(c & mask); | ||
1286 | c>>=bpe; | ||
1287 | } | ||
1288 | s0[i+kx]=c; | ||
1289 | } | ||
1290 | mod_(s0,n); | ||
1291 | copy_(x,s0); | ||
1292 | } | ||
1293 | |||
1294 | //return x with exactly k leading zero elements | ||
1295 | function trim(x,k) { | ||
1296 | var i,y; | ||
1297 | for (i=x.length; i>0 && !x[i-1]; i--); | ||
1298 | y=new Array(i+k); | ||
1299 | copy_(y,x); | ||
1300 | return y; | ||
1301 | } | ||
1302 | |||
1303 | //do x=x**y mod n, where x,y,n are bigInts and ** is exponentiation. 0**0=1. | ||
1304 | //this is faster when n is odd. x usually needs to have as many elements as n. | ||
1305 | function powMod_(x,y,n) { | ||
1306 | var k1,k2,kn,np; | ||
1307 | if(s7.length!=n.length) | ||
1308 | s7=dup(n); | ||
1309 | |||
1310 | //for even modulus, use a simple square-and-multiply algorithm, | ||
1311 | //rather than using the more complex Montgomery algorithm. | ||
1312 | if ((n[0]&1)==0) { | ||
1313 | copy_(s7,x); | ||
1314 | copyInt_(x,1); | ||
1315 | while(!equalsInt(y,0)) { | ||
1316 | if (y[0]&1) | ||
1317 | multMod_(x,s7,n); | ||
1318 | divInt_(y,2); | ||
1319 | squareMod_(s7,n); | ||
1320 | } | ||
1321 | return; | ||
1322 | } | ||
1323 | |||
1324 | //calculate np from n for the Montgomery multiplications | ||
1325 | copyInt_(s7,0); | ||
1326 | for (kn=n.length;kn>0 && !n[kn-1];kn--); | ||
1327 | np=radix-inverseModInt_(modInt(n,radix),radix); | ||
1328 | s7[kn]=1; | ||
1329 | multMod_(x ,s7,n); // x = x * 2**(kn*bp) mod n | ||
1330 | |||
1331 | if (s3.length!=x.length) | ||
1332 | s3=dup(x); | ||
1333 | else | ||
1334 | copy_(s3,x); | ||
1335 | |||
1336 | for (k1=y.length-1;k1>0 & !y[k1]; k1--); //k1=first nonzero element of y | ||
1337 | if (y[k1]==0) { //anything to the 0th power is 1 | ||
1338 | copyInt_(x,1); | ||
1339 | return; | ||
1340 | } | ||
1341 | for (k2=1<<(bpe-1);k2 && !(y[k1] & k2); k2>>=1); //k2=position of first 1 bit in y[k1] | ||
1342 | for (;;) { | ||
1343 | if (!(k2>>=1)) { //look at next bit of y | ||
1344 | k1--; | ||
1345 | if (k1<0) { | ||
1346 | mont_(x,one,n,np); | ||
1347 | return; | ||
1348 | } | ||
1349 | k2=1<<(bpe-1); | ||
1350 | } | ||
1351 | mont_(x,x,n,np); | ||
1352 | |||
1353 | if (k2 & y[k1]) //if next bit is a 1 | ||
1354 | mont_(x,s3,n,np); | ||
1355 | } | ||
1356 | } | ||
1357 | |||
1358 | //do x=x*y*Ri mod n for bigInts x,y,n, | ||
1359 | // where Ri = 2**(-kn*bpe) mod n, and kn is the | ||
1360 | // number of elements in the n array, not | ||
1361 | // counting leading zeros. | ||
1362 | //x must be large enough to hold the answer. | ||
1363 | //It's OK if x and y are the same variable. | ||
1364 | //must have: | ||
1365 | // x,y < n | ||
1366 | // n is odd | ||
1367 | // np = -(n^(-1)) mod radix | ||
1368 | function mont_(x,y,n,np) { | ||
1369 | var i,j,c,ui,t; | ||
1370 | var kn=n.length; | ||
1371 | var ky=y.length; | ||
1372 | |||
1373 | if (sa.length!=kn) | ||
1374 | sa=new Array(kn); | ||
1375 | |||
1376 | for (;kn>0 && n[kn-1]==0;kn--); //ignore leading zeros of n | ||
1377 | //this function sometimes gives wrong answers when the next line is uncommented | ||
1378 | //for (;ky>0 && y[ky-1]==0;ky--); //ignore leading zeros of y | ||
1379 | |||
1380 | copyInt_(sa,0); | ||
1381 | |||
1382 | //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large keys | ||
1383 | for (i=0; i<kn; i++) { | ||
1384 | t=sa[0]+x[i]*y[0]; | ||
1385 | ui=((t & mask) * np) & mask; //the inner "& mask" is needed on Macintosh MSIE, but not windows MSIE | ||
1386 | c=(t+ui*n[0]) >> bpe; | ||
1387 | t=x[i]; | ||
1388 | |||
1389 | //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe | ||
1390 | for (j=1;j<ky;j++) { | ||
1391 | c+=sa[j]+t*y[j]+ui*n[j]; | ||
1392 | sa[j-1]=c & mask; | ||
1393 | c>>=bpe; | ||
1394 | } | ||
1395 | for (;j<kn;j++) { | ||
1396 | c+=sa[j]+ui*n[j]; | ||
1397 | sa[j-1]=c & mask; | ||
1398 | c>>=bpe; | ||
1399 | } | ||
1400 | sa[j-1]=c & mask; | ||
1401 | } | ||
1402 | |||
1403 | if (!greater(n,sa)) | ||
1404 | sub_(sa,n); | ||
1405 | copy_(x,sa); | ||
1406 | } | ||
1407 | |||
1408 | |||
1409 | |||
1410 | |||
1411 | //############################################################################# | ||
1412 | //############################################################################# | ||
1413 | //############################################################################# | ||
1414 | //############################################################################# | ||
1415 | //############################################################################# | ||
1416 | //############################################################################# | ||
1417 | //############################################################################# | ||
1418 | |||
1419 | |||
1420 | |||
1421 | |||
1422 | |||
1423 | //############################################################################# | ||
1424 | |||
1425 | Clipperz.Crypto.BigInt = function (aValue, aBase) { | ||
1426 | varbase; | ||
1427 | varvalue; | ||
1428 | |||
1429 | if (typeof(aValue) == 'object') { | ||
1430 | this._internalValue = aValue; | ||
1431 | } else { | ||
1432 | if (typeof(aValue) == 'undefined') { | ||
1433 | value = "0"; | ||
1434 | } else { | ||
1435 | value = aValue + ""; | ||
1436 | } | ||
1437 | |||
1438 | if (typeof(aBase) == 'undefined') { | ||
1439 | base = 10; | ||
1440 | } else { | ||
1441 | base = aBase; | ||
1442 | } | ||
1443 | |||
1444 | this._internalValue = str2bigInt(value, base, 1, 1); | ||
1445 | } | ||
1446 | |||
1447 | return this; | ||
1448 | } | ||
1449 | |||
1450 | //============================================================================= | ||
1451 | |||
1452 | MochiKit.Base.update(Clipperz.Crypto.BigInt.prototype, { | ||
1453 | |||
1454 | //------------------------------------------------------------------------- | ||
1455 | |||
1456 | 'internalValue': function () { | ||
1457 | return this._internalValue; | ||
1458 | }, | ||
1459 | |||
1460 | //------------------------------------------------------------------------- | ||
1461 | |||
1462 | 'isBigInt': true, | ||
1463 | |||
1464 | //------------------------------------------------------------------------- | ||
1465 | |||
1466 | 'toString': function(aBase) { | ||
1467 | return this.asString(aBase); | ||
1468 | }, | ||
1469 | |||
1470 | //------------------------------------------------------------------------- | ||
1471 | |||
1472 | 'asString': function (aBase) { | ||
1473 | varbase; | ||
1474 | |||
1475 | if (typeof(aBase) == 'undefined') { | ||
1476 | base = 10; | ||
1477 | } else { | ||
1478 | base = aBase; | ||
1479 | } | ||
1480 | |||
1481 | return bigInt2str(this.internalValue(), base).toLowerCase(); | ||
1482 | }, | ||
1483 | |||
1484 | //------------------------------------------------------------------------- | ||
1485 | |||
1486 | 'equals': function (aValue) { | ||
1487 | var result; | ||
1488 | |||
1489 | if (aValue.isBigInt) { | ||
1490 | result = equals(this.internalValue(), aValue.internalValue()); | ||
1491 | } else if (typeof(aValue) == "number") { | ||
1492 | result = equalsInt(this.internalValue(), aValue); | ||
1493 | } else { | ||
1494 | throw Clipperz.Crypt.BigInt.exception.UnknownType; | ||
1495 | } | ||
1496 | |||
1497 | return result; | ||
1498 | }, | ||
1499 | |||
1500 | //------------------------------------------------------------------------- | ||
1501 | |||
1502 | 'add': function (aValue) { | ||
1503 | var result; | ||
1504 | |||
1505 | if (aValue.isBigInt) { | ||
1506 | result = add(this.internalValue(), aValue.internalValue()); | ||
1507 | } else { | ||
1508 | result = addInt(this.internalValue(), aValue); | ||
1509 | } | ||
1510 | |||
1511 | return new Clipperz.Crypto.BigInt(result); | ||
1512 | }, | ||
1513 | |||
1514 | //------------------------------------------------------------------------- | ||
1515 | |||
1516 | 'subtract': function (aValue) { | ||
1517 | var result; | ||
1518 | var value; | ||
1519 | |||
1520 | if (aValue.isBigInt) { | ||
1521 | value = aValue; | ||
1522 | } else { | ||
1523 | value = new Clipperz.Crypto.BigInt(aValue); | ||
1524 | } | ||
1525 | |||
1526 | result = sub(this.internalValue(), value.internalValue()); | ||
1527 | |||
1528 | return new Clipperz.Crypto.BigInt(result); | ||
1529 | }, | ||
1530 | |||
1531 | //------------------------------------------------------------------------- | ||
1532 | |||
1533 | 'multiply': function (aValue, aModule) { | ||
1534 | var result; | ||
1535 | var value; | ||
1536 | |||
1537 | if (aValue.isBigInt) { | ||
1538 | value = aValue; | ||
1539 | } else { | ||
1540 | value = new Clipperz.Crypto.BigInt(aValue); | ||
1541 | } | ||
1542 | |||
1543 | if (typeof(aModule) == 'undefined') { | ||
1544 | result = mult(this.internalValue(), value.internalValue()); | ||
1545 | } else { | ||
1546 | result = multMod(this.internalValue(), value.internalValue(), aModule); | ||
1547 | } | ||
1548 | |||
1549 | return new Clipperz.Crypto.BigInt(result); | ||
1550 | }, | ||
1551 | |||
1552 | //------------------------------------------------------------------------- | ||
1553 | |||
1554 | 'module': function (aModule) { | ||
1555 | varresult; | ||
1556 | var module; | ||
1557 | |||
1558 | if (aModule.isBigInt) { | ||
1559 | module = aModule; | ||
1560 | } else { | ||
1561 | module = new Clipperz.Crypto.BigInt(aModule); | ||
1562 | } | ||
1563 | |||
1564 | result = mod(this.internalValue(), module.internalValue()); | ||
1565 | |||
1566 | return new Clipperz.Crypto.BigInt(result); | ||
1567 | }, | ||
1568 | |||
1569 | //------------------------------------------------------------------------- | ||
1570 | |||
1571 | 'powerModule': function(aValue, aModule) { | ||
1572 | varresult; | ||
1573 | varvalue; | ||
1574 | var module; | ||
1575 | |||
1576 | if (aValue.isBigInt) { | ||
1577 | value = aValue; | ||
1578 | } else { | ||
1579 | value = new Clipperz.Crypto.BigInt(aValue); | ||
1580 | } | ||
1581 | |||
1582 | if (aModule.isBigInt) { | ||
1583 | module = aModule; | ||
1584 | } else { | ||
1585 | module = new Clipperz.Crypto.BigInt(aModule); | ||
1586 | } | ||
1587 | |||
1588 | if (aValue == -1) { | ||
1589 | result = inverseMod(this.internalValue(), module.internalValue()); | ||
1590 | } else { | ||
1591 | result = powMod(this.internalValue(), value.internalValue(), module.internalValue()); | ||
1592 | } | ||
1593 | |||
1594 | return new Clipperz.Crypto.BigInt(result); | ||
1595 | }, | ||
1596 | |||
1597 | //------------------------------------------------------------------------- | ||
1598 | |||
1599 | 'bitSize': function() { | ||
1600 | return bitSize(this.internalValue()); | ||
1601 | }, | ||
1602 | |||
1603 | //------------------------------------------------------------------------- | ||
1604 | __syntaxFix__: "syntax fix" | ||
1605 | |||
1606 | }); | ||
1607 | |||
1608 | //############################################################################# | ||
1609 | |||
1610 | Clipperz.Crypto.BigInt.randomPrime = function(aBitSize) { | ||
1611 | return new Clipperz.Crypto.BigInt(randTruePrime(aBitSize)); | ||
1612 | } | ||
1613 | |||
1614 | //############################################################################# | ||
1615 | //############################################################################# | ||
1616 | //############################################################################# | ||
1617 | |||
1618 | Clipperz.Crypto.BigInt.equals = function(a, b) { | ||
1619 | return a.equals(b); | ||
1620 | } | ||
1621 | |||
1622 | Clipperz.Crypto.BigInt.add = function(a, b) { | ||
1623 | return a.add(b); | ||
1624 | } | ||
1625 | |||
1626 | Clipperz.Crypto.BigInt.subtract = function(a, b) { | ||
1627 | return a.subtract(b); | ||
1628 | } | ||
1629 | |||
1630 | Clipperz.Crypto.BigInt.multiply = function(a, b, module) { | ||
1631 | return a.multiply(b, module); | ||
1632 | } | ||
1633 | |||
1634 | Clipperz.Crypto.BigInt.module = function(a, module) { | ||
1635 | return a.module(module); | ||
1636 | } | ||
1637 | |||
1638 | Clipperz.Crypto.BigInt.powerModule = function(a, b, module) { | ||
1639 | return a.powerModule(b, module); | ||
1640 | } | ||
1641 | |||
1642 | Clipperz.Crypto.BigInt.exception = { | ||
1643 | UnknownType: new MochiKit.Base.NamedError("Clipperz.Crypto.BigInt.exception.UnknownType") | ||
1644 | } | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/ByteArray.js b/frontend/gamma/js/ClipperzCryptoLibrary/ByteArray.js new file mode 100644 index 0000000..aca1c00 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/ByteArray.js | |||
@@ -0,0 +1,1496 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
25 | |||
26 | //============================================================================= | ||
27 | |||
28 | Clipperz.ByteArray_abstract = function(args) { | ||
29 | return this; | ||
30 | } | ||
31 | |||
32 | Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | ||
33 | |||
34 | //------------------------------------------------------------------------- | ||
35 | |||
36 | 'toString': function() { | ||
37 | return "Clipperz.ByteArray_abstract"; | ||
38 | }, | ||
39 | |||
40 | //------------------------------------------------------------------------- | ||
41 | |||
42 | 'equals': function(aValue) { | ||
43 | return (this.compare(aValue) == 0); | ||
44 | }, | ||
45 | |||
46 | //------------------------------------------------------------------------- | ||
47 | |||
48 | 'compare': function(aValue) { | ||
49 | var result; | ||
50 | var i; | ||
51 | |||
52 | result = MochiKit.Base.compare(this.length(), aValue.length()); | ||
53 | i = this.length(); | ||
54 | |||
55 | while ((result == 0) && (i>0)) { | ||
56 | i--; | ||
57 | result = MochiKit.Base.compare(this.byteAtIndex(i), aValue.byteAtIndex(i)); | ||
58 | } | ||
59 | |||
60 | return result; | ||
61 | }, | ||
62 | |||
63 | //------------------------------------------------------------------------- | ||
64 | |||
65 | 'clone': function() { | ||
66 | throw Clipperz.Base.exception.AbstractMethod; | ||
67 | }, | ||
68 | |||
69 | //------------------------------------------------------------------------- | ||
70 | |||
71 | 'newInstance': function() { | ||
72 | throw Clipperz.Base.exception.AbstractMethod; | ||
73 | }, | ||
74 | |||
75 | //------------------------------------------------------------------------- | ||
76 | |||
77 | 'reset': function() { | ||
78 | throw Clipperz.Base.exception.AbstractMethod; | ||
79 | }, | ||
80 | |||
81 | //------------------------------------------------------------------------- | ||
82 | |||
83 | 'length': function() { | ||
84 | throw Clipperz.Base.exception.AbstractMethod; | ||
85 | }, | ||
86 | |||
87 | //------------------------------------------------------------------------- | ||
88 | |||
89 | 'checkByteValue': function(aValue) { | ||
90 | //Clipperz.log("aValue", aValue.toString(16)); | ||
91 | //Clipperz.log("(aValue & 0xff)", (aValue & 0xff).toString(16)); | ||
92 | |||
93 | if ((aValue & 0xff) != aValue) { | ||
94 | MochiKit.Logging.logError("Clipperz.ByteArray.appendByte: the provided value (0x" + aValue.toString(16) + ") is not a byte value."); | ||
95 | throw Clipperz.ByteArray.exception.InvalidValue; | ||
96 | } | ||
97 | }, | ||
98 | |||
99 | //------------------------------------------------------------------------- | ||
100 | |||
101 | 'xorMergeWithBlock': function(aBlock, anAllignment, paddingMode) { | ||
102 | var result; | ||
103 | var a, b; | ||
104 | var aLength; | ||
105 | var bLength; | ||
106 | var i, c; | ||
107 | |||
108 | if (this.length() > aBlock.length()) { | ||
109 | a = this; | ||
110 | b = aBlock; | ||
111 | } else { | ||
112 | a = aBlock; | ||
113 | b = this; | ||
114 | } | ||
115 | |||
116 | aLength = a.length(); | ||
117 | bLength = b.length(); | ||
118 | |||
119 | if (aLength != bLength) { | ||
120 | if (paddingMode == 'truncate') { | ||
121 | if (anAllignment == 'left') { | ||
122 | a = a.split(0, bLength); | ||
123 | } else { | ||
124 | a = a.split(aLength - bLength); | ||
125 | } | ||
126 | } else { | ||
127 | var ii, cc; | ||
128 | var padding; | ||
129 | |||
130 | // padding = new Clipperz.ByteArray(); | ||
131 | padding = this.newInstance(); | ||
132 | cc = aLength - bLength; | ||
133 | for (ii=0; ii<cc; ii++) { | ||
134 | padding.appendByte(0); | ||
135 | } | ||
136 | |||
137 | if (anAllignment == 'left') { | ||
138 | b = b.appendBlock(padding); | ||
139 | } else { | ||
140 | b = padding.appendBlock(b); | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | |||
145 | |||
146 | // result = new Clipperz.ByteArray(); | ||
147 | result = this.newInstance(); | ||
148 | c = a.length(); | ||
149 | for (i=0; i<c; i++) { | ||
150 | result.appendByte(a.byteAtIndex(i) ^ b.byteAtIndex(i)); | ||
151 | } | ||
152 | |||
153 | return result; | ||
154 | }, | ||
155 | |||
156 | //------------------------------------------------------------------------- | ||
157 | /* | ||
158 | 'shiftLeft': function(aNumberOfBitsToShift) { | ||
159 | var result; | ||
160 | |||
161 | result = this.clone(); //??????????? | ||
162 | |||
163 | return result; | ||
164 | }, | ||
165 | */ | ||
166 | //------------------------------------------------------------------------- | ||
167 | |||
168 | 'appendBlock': function(aBlock) { | ||
169 | throw Clipperz.Base.exception.AbstractMethod; | ||
170 | }, | ||
171 | |||
172 | //------------------------------------------------------------------------- | ||
173 | |||
174 | 'appendByte': function(aValue) { | ||
175 | throw Clipperz.Base.exception.AbstractMethod; | ||
176 | }, | ||
177 | |||
178 | 'appendBytes': function(args) { | ||
179 | varvalues; | ||
180 | vari,c; | ||
181 | |||
182 | if (args.constructor == Array) { | ||
183 | values = args; | ||
184 | } else { | ||
185 | values = arguments; | ||
186 | } | ||
187 | |||
188 | c = values.length; | ||
189 | for (i=0; i<c; i++) { | ||
190 | this.appendByte(values[i]); | ||
191 | } | ||
192 | |||
193 | return this; | ||
194 | }, | ||
195 | |||
196 | //------------------------------------------------------------------------- | ||
197 | |||
198 | 'appendWord': function(aValue, isLittleEndian) { | ||
199 | var result; | ||
200 | var processAsLittleEndian; | ||
201 | |||
202 | processAsLittleEndian = isLittleEndian === true ? true : false; | ||
203 | |||
204 | if (processAsLittleEndian) { | ||
205 | result = this.appendBytes( (aValue) & 0xff, (aValue >> 8) & 0xff, (aValue >> 16) & 0xff, (aValue >> 24) & 0xff ); //little endian | ||
206 | } else { | ||
207 | result = this.appendBytes( (aValue >> 24) & 0xff, (aValue >> 16) & 0xff, (aValue >> 8) & 0xff, (aValue) & 0xff ); //big endian - DEFAULT | ||
208 | } | ||
209 | |||
210 | return result; | ||
211 | }, | ||
212 | |||
213 | 'appendWords': function(args) { | ||
214 | varvalues; | ||
215 | vari,c; | ||
216 | |||
217 | if (args.constructor == Array) { | ||
218 | values = args; | ||
219 | } else { | ||
220 | values = arguments; | ||
221 | } | ||
222 | |||
223 | c = values.length; | ||
224 | for (i=0; i<c; i++) { | ||
225 | this.appendWord(values[i], false); | ||
226 | } | ||
227 | |||
228 | return this; | ||
229 | }, | ||
230 | |||
231 | //------------------------------------------------------------------------- | ||
232 | |||
233 | 'appendBigEndianWords': function(args) { | ||
234 | varvalues; | ||
235 | vari,c; | ||
236 | |||
237 | if (args.constructor == Array) { | ||
238 | values = args; | ||
239 | } else { | ||
240 | values = arguments; | ||
241 | } | ||
242 | |||
243 | c = values.length; | ||
244 | for (i=0; i<c; i++) { | ||
245 | this.appendWord(values[i], true); | ||
246 | } | ||
247 | |||
248 | return this; | ||
249 | }, | ||
250 | |||
251 | //------------------------------------------------------------------------- | ||
252 | |||
253 | 'appendBinaryString': function (aBinaryString) { | ||
254 | var i,c; | ||
255 | |||
256 | c = aBinaryString.length; | ||
257 | for (i=0; i<c; i++) { | ||
258 | this.appendByte(aBinaryString.charCodeAt(i)); | ||
259 | }; | ||
260 | |||
261 | return this; | ||
262 | }, | ||
263 | |||
264 | //------------------------------------------------------------------------- | ||
265 | |||
266 | 'byteAtIndex': function(anIndex) { | ||
267 | throw Clipperz.Base.exception.AbstractMethod; | ||
268 | }, | ||
269 | |||
270 | 'setByteAtIndex': function(aValue, anIndex) { | ||
271 | throw Clipperz.Base.exception.AbstractMethod; | ||
272 | }, | ||
273 | |||
274 | //------------------------------------------------------------------------- | ||
275 | |||
276 | 'bitAtIndex': function(aBitPosition) { | ||
277 | var result; | ||
278 | varbytePosition; | ||
279 | var bitPositionInSelectedByte; | ||
280 | var selectedByte; | ||
281 | var selectedByteMask; | ||
282 | |||
283 | bytePosition = this.length() - Math.ceil((aBitPosition + 1)/ 8); | ||
284 | bitPositionInSelectedByte = aBitPosition % 8; | ||
285 | selectedByte = this.byteAtIndex(bytePosition); | ||
286 | |||
287 | if (bitPositionInSelectedByte > 0) { | ||
288 | selectedByteMask = (1 << bitPositionInSelectedByte); | ||
289 | } else { | ||
290 | selectedByteMask = 1; | ||
291 | } | ||
292 | result = selectedByte & selectedByteMask ? 1 : 0; | ||
293 | //console.log("aBitPosition: " + aBitPosition + ", length: " + this.length() + ", bytePosition: " + bytePosition + ", bitPositionInSelectedByte: " + bitPositionInSelectedByte + ", selectedByteMask: " + selectedByteMask); | ||
294 | |||
295 | return result; | ||
296 | }, | ||
297 | |||
298 | //------------------------------------------------------------------------- | ||
299 | |||
300 | 'bitBlockAtIndexWithSize': function(aBitPosition, aSize) { | ||
301 | var result; | ||
302 | var bitValue; | ||
303 | var i,c; | ||
304 | |||
305 | result = 0; | ||
306 | c = aSize; | ||
307 | for (i=0; i<c; i++) { | ||
308 | bitValue = this.bitAtIndex(aBitPosition + i); | ||
309 | result = result | bitValue << i; | ||
310 | } | ||
311 | |||
312 | return result; | ||
313 | }, | ||
314 | |||
315 | //------------------------------------------------------------------------- | ||
316 | |||
317 | 'asString': function() { | ||
318 | varresult; | ||
319 | varlength; | ||
320 | vari; | ||
321 | |||
322 | //var startTime = new Date(); | ||
323 | |||
324 | //# result = ""; | ||
325 | result = []; | ||
326 | |||
327 | i = 0; | ||
328 | length = this.length(); | ||
329 | |||
330 | while (i < length) { | ||
331 | varcurrentCharacter; | ||
332 | varcurrentByte; | ||
333 | varunicode; | ||
334 | |||
335 | currentByte = this.byteAtIndex(i); | ||
336 | |||
337 | if ((currentByte & 0x80) == 0x00 ) { //0xxxxxxx | ||
338 | unicode = currentByte; | ||
339 | currentCharacter = String.fromCharCode(unicode); | ||
340 | } else if ((currentByte & 0xe0) == 0xc0 ) { //110xxxxx 10xxxxxx | ||
341 | unicode = (currentByte & 0x1f) << 6; | ||
342 | i++; currentByte = this.byteAtIndex(i); | ||
343 | unicode = unicode | (currentByte & 0x3f); | ||
344 | |||
345 | currentCharacter = String.fromCharCode(unicode); | ||
346 | } else if ((currentByte & 0xf0) == 0xe0 ) { //1110xxxx 10xxxxxx 10xxxxxx | ||
347 | unicode = (currentByte & 0x0f) << (6+6); | ||
348 | i++; currentByte = this.byteAtIndex(i); | ||
349 | unicode = unicode | ((currentByte & 0x3f) << 6); | ||
350 | i++; currentByte = this.byteAtIndex(i); | ||
351 | unicode = unicode | (currentByte & 0x3f); | ||
352 | |||
353 | currentCharacter = String.fromCharCode(unicode); | ||
354 | } else { //11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | ||
355 | unicode = (currentByte & 0x07) << (6+6+6); | ||
356 | i++; currentByte = this.byteAtIndex(i); | ||
357 | unicode = unicode | ((currentByte & 0x3f) << (6+6)); | ||
358 | i++; currentByte = this.byteAtIndex(i); | ||
359 | unicode = unicode | ((currentByte & 0x3f) << 6); | ||
360 | i++; currentByte = this.byteAtIndex(i); | ||
361 | unicode = unicode | (currentByte & 0x3f); | ||
362 | |||
363 | currentCharacter = String.fromCharCode(unicode); | ||
364 | } | ||
365 | |||
366 | // result += currentCharacter; | ||
367 | result.push(currentCharacter); | ||
368 | i++; | ||
369 | } | ||
370 | |||
371 | //MochiKit.Logging.logDebug("[" + (new Date() - startTime) + "] ByteArray.asString"); | ||
372 | |||
373 | // return result; | ||
374 | return result.join(""); | ||
375 | }, | ||
376 | |||
377 | //------------------------------------------------------------------------- | ||
378 | |||
379 | 'toHexString': function() { | ||
380 | throw Clipperz.Base.exception.AbstractMethod; | ||
381 | }, | ||
382 | |||
383 | //------------------------------------------------------------------------- | ||
384 | |||
385 | 'base64map': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", | ||
386 | 'base64mapIndex': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(''), | ||
387 | //'base64mapInvertedIndex': { | ||
388 | // 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9, | ||
389 | // 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19, | ||
390 | // 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29, | ||
391 | // 'e': 30, 'f': 31, 'g': 32, 'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39, | ||
392 | // 'o': 40, 'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47, 'w': 48, 'x': 49, | ||
393 | // 'y': 50, 'z': 51, '0': 52, '1': 53, '2': 54, '3': 55, '4': 56, '5': 57, '6': 58, '7': 59, | ||
394 | // '8': 60, '9': 61, '+': 62, '/': 63, | ||
395 | // "=": -1}, | ||
396 | |||
397 | //------------------------------------------------------------------------- | ||
398 | |||
399 | 'appendBase64String': function(aValue) { | ||
400 | var i; | ||
401 | var length; | ||
402 | |||
403 | length = aValue.length; | ||
404 | |||
405 | if ((length % 4) != 0) { | ||
406 | MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase64Value' is not correct"); | ||
407 | throw Clipperz.ByteArray.exception.InvalidValue; | ||
408 | } | ||
409 | |||
410 | i = 0; | ||
411 | while (i<length) { | ||
412 | var value1, value2, value3, value4; | ||
413 | var byte1, byte2, byte3; | ||
414 | |||
415 | value1 = this.base64map.indexOf(aValue.charAt(i)); | ||
416 | value2 = this.base64map.indexOf(aValue.charAt(i+1)); | ||
417 | value3 = this.base64map.indexOf(aValue.charAt(i+2)); | ||
418 | value4 = this.base64map.indexOf(aValue.charAt(i+3)); | ||
419 | |||
420 | // value1 = this.base64mapInvertedIndex[aValue.charAt(i)]; | ||
421 | // value2 = this.base64mapInvertedIndex[aValue.charAt(i+1)]; | ||
422 | // value3 = this.base64mapInvertedIndex[aValue.charAt(i+2)]; | ||
423 | // value4 = this.base64mapInvertedIndex[aValue.charAt(i+3)]; | ||
424 | |||
425 | byte1 = (value1 << 2) | ((value2 & 0x30) >> 4); | ||
426 | if (value3 != -1) { | ||
427 | byte2 = ((value2 & 0x0f) << 4) | ((value3 & 0x3c) >> 2); | ||
428 | |||
429 | if (value4 != -1) { | ||
430 | byte3 = ((value3 & 0x03) << 6) | (value4); | ||
431 | } else { | ||
432 | byte3 = null; | ||
433 | } | ||
434 | } else { | ||
435 | byte2 = null; | ||
436 | byte3 = null; | ||
437 | } | ||
438 | |||
439 | this.appendByte(byte1); | ||
440 | this.appendByte(byte2); | ||
441 | this.appendByte(byte3); | ||
442 | |||
443 | i += 4; | ||
444 | } | ||
445 | |||
446 | return this; | ||
447 | }, | ||
448 | |||
449 | //------------------------------------------------------------------------- | ||
450 | |||
451 | 'toBase64String': function() { | ||
452 | var result; | ||
453 | var length; | ||
454 | var i; | ||
455 | var byte1, byte2, byte3; | ||
456 | var char1, char2, char3, char4; | ||
457 | |||
458 | i = 0; | ||
459 | length = this.length(); | ||
460 | result = new Array(Math.ceil(length/3)); | ||
461 | |||
462 | while (i < length) { | ||
463 | byte1 = this.byteAtIndex(i); | ||
464 | if ((i+2) < length) { | ||
465 | byte2 = this.byteAtIndex(i+1); | ||
466 | byte3 = this.byteAtIndex(i+2); | ||
467 | } else if ((i+2) == length) { | ||
468 | byte2 = this.byteAtIndex(i+1); | ||
469 | byte3 = null; | ||
470 | } else { | ||
471 | byte2 = null; | ||
472 | byte3 = null; | ||
473 | } | ||
474 | |||
475 | char1 = this.base64mapIndex[byte1 >> 2]; | ||
476 | if (byte2 != null) { | ||
477 | char2 = this.base64mapIndex[((byte1 & 0x03) << 4) | ((byte2 & 0xf0) >> 4)]; | ||
478 | if (byte3 != null) { | ||
479 | char3 = this.base64mapIndex[((byte2 & 0x0f) << 2) | ((byte3 & 0xc0) >> 6)]; | ||
480 | char4 = this.base64mapIndex[(byte3 & 0x3f)]; | ||
481 | } else { | ||
482 | char3 = this.base64mapIndex[(byte2 & 0x0f) << 2]; | ||
483 | char4 = "="; | ||
484 | } | ||
485 | } else { | ||
486 | char2 = this.base64mapIndex[(byte1 & 0x03) << 4]; | ||
487 | char3 = "="; | ||
488 | char4 = "="; | ||
489 | } | ||
490 | |||
491 | result.push(char1 + char2 + char3 + char4); | ||
492 | |||
493 | i += 3; | ||
494 | } | ||
495 | |||
496 | return result.join(""); | ||
497 | }, | ||
498 | |||
499 | //------------------------------------------------------------------------- | ||
500 | |||
501 | 'base32map': "0123456789abcdefghjkmnpqrstvwxyz", | ||
502 | 'base32mapIndex': "0123456789abcdefghjkmnpqrstvwxyz".split(''), | ||
503 | |||
504 | //------------------------------------------------------------------------- | ||
505 | |||
506 | 'appendBase32String': function(aValue) { | ||
507 | var value; | ||
508 | var i; | ||
509 | var length; | ||
510 | var value1, value2, value3, value4, value5, value6, value7, value8; | ||
511 | var byte1, byte2, byte3, byte4, byte5; | ||
512 | |||
513 | value = aValue.toLowerCase(); | ||
514 | value = value.replace(/[\s\-]/g, ''); | ||
515 | value = value.replace(/[0o]/g, '0'); | ||
516 | value = value.replace(/[1il]/g, '1'); | ||
517 | |||
518 | length = value.length; | ||
519 | |||
520 | if ((length % 8) != 0) { | ||
521 | MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase32Value' is not correct"); | ||
522 | throw Clipperz.ByteArray.exception.InvalidValue; | ||
523 | } | ||
524 | |||
525 | i = 0; | ||
526 | while (i<length) { | ||
527 | value1 = this.base32map.indexOf(value.charAt(i)); | ||
528 | value2 = this.base32map.indexOf(value.charAt(i+1)); | ||
529 | value3 = this.base32map.indexOf(value.charAt(i+2)); | ||
530 | value4 = this.base32map.indexOf(value.charAt(i+3)); | ||
531 | value5 = this.base32map.indexOf(value.charAt(i+4)); | ||
532 | value6 = this.base32map.indexOf(value.charAt(i+5)); | ||
533 | value7 = this.base32map.indexOf(value.charAt(i+6)); | ||
534 | value8 = this.base32map.indexOf(value.charAt(i+7)); | ||
535 | |||
536 | byte1 = byte2 = byte3 = byte4 = byte5 = null; | ||
537 | |||
538 | byte1 = (value1 << 3) | ((value2 & 0x1c) >> 2); | ||
539 | if (value3 != -1) { | ||
540 | byte2 = ((value2 & 0x03) << 6) | (value3 << 1) | ((value4 & 0x10) >> 4); | ||
541 | if (value5 != -1) { | ||
542 | byte3 = ((value4 & 0x0f) << 4) | ((value5 & 0x1e) >> 1); | ||
543 | if (value6 != -1) { | ||
544 | byte4 = ((value5 & 0x01) << 7) | (value6 << 2) | ((value7 & 0x18) >> 3); | ||
545 | if (value8 != -1) { | ||
546 | byte5 = ((value7 & 0x07) << 5) | (value8); | ||
547 | } | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | |||
552 | this.appendByte(byte1); | ||
553 | this.appendByte(byte2); | ||
554 | this.appendByte(byte3); | ||
555 | this.appendByte(byte4); | ||
556 | this.appendByte(byte5); | ||
557 | |||
558 | i += 8; | ||
559 | } | ||
560 | |||
561 | return this; | ||
562 | }, | ||
563 | |||
564 | //------------------------------------------------------------------------- | ||
565 | |||
566 | 'toBase32String': function() { | ||
567 | var result; | ||
568 | var length; | ||
569 | var i; | ||
570 | var byte1, byte2, byte3, byte4, byte5; | ||
571 | var char1, char2, char3, char4, char5, char6, char7, char8; | ||
572 | |||
573 | i = 0; | ||
574 | length = this.length(); | ||
575 | result = new Array(Math.ceil(length/5)); | ||
576 | |||
577 | while (i < length) { | ||
578 | byte1 = this.byteAtIndex(i); | ||
579 | |||
580 | if ((i+4) < length) { | ||
581 | byte2 = this.byteAtIndex(i+1); | ||
582 | byte3 = this.byteAtIndex(i+2); | ||
583 | byte4 = this.byteAtIndex(i+3); | ||
584 | byte5 = this.byteAtIndex(i+4); | ||
585 | } else if ((i+4) == length) { | ||
586 | byte2 = this.byteAtIndex(i+1); | ||
587 | byte3 = this.byteAtIndex(i+2); | ||
588 | byte4 = this.byteAtIndex(i+3); | ||
589 | byte5 = null; | ||
590 | } else if ((i+3) == length) { | ||
591 | byte2 = this.byteAtIndex(i+1); | ||
592 | byte3 = this.byteAtIndex(i+2); | ||
593 | byte4 = null; | ||
594 | byte5 = null; | ||
595 | } else if ((i+2) == length) { | ||
596 | byte2 = this.byteAtIndex(i+1); | ||
597 | byte3 = null; | ||
598 | byte4 = null; | ||
599 | byte5 = null; | ||
600 | } else { | ||
601 | byte2 = null; | ||
602 | byte3 = null; | ||
603 | byte4 = null; | ||
604 | byte5 = null; | ||
605 | } | ||
606 | |||
607 | |||
608 | char1 = this.base32mapIndex[byte1 >> 3]; | ||
609 | char2 = char3 = char4 = char5 = char6 = char7 = char8 = "="; | ||
610 | |||
611 | if (byte2 != null) { | ||
612 | char2 = this.base32mapIndex[((byte1 & 0x07) << 2) | ((byte2 & 0xc0) >> 6)]; | ||
613 | char3 = this.base32mapIndex[((byte2 & 0x3e) >> 1)]; | ||
614 | if (byte3 != null) { | ||
615 | char4 = this.base32mapIndex[((byte2 & 0x01) << 4) | ((byte3 & 0xf0) >> 4)]; | ||
616 | if (byte4 != null) { | ||
617 | char5 = this.base32mapIndex[((byte3 & 0x0f) << 1) | ((byte4 & 0x80) >> 7)]; | ||
618 | char6 = this.base32mapIndex[(byte4 & 0x7c) >> 2]; | ||
619 | if (byte5 != null) { | ||
620 | char7 = this.base32mapIndex[((byte4 & 0x03) << 3) | ((byte5 & 0xe0) >> 5)]; | ||
621 | char8 = this.base32mapIndex[(byte5 & 0x1f)]; | ||
622 | } else { | ||
623 | char7 = this.base32mapIndex[(byte4 & 0x03) << 3]; | ||
624 | } | ||
625 | } else { | ||
626 | char5 = this.base32mapIndex[(byte3 & 0x0f) << 1]; | ||
627 | } | ||
628 | |||
629 | } else { | ||
630 | char4 = this.base32mapIndex[(byte2 & 0x01) << 4]; | ||
631 | } | ||
632 | } else { | ||
633 | char2 = this.base32mapIndex[(byte1 & 0x07) << 2]; | ||
634 | } | ||
635 | |||
636 | result.push(char1 + char2 + char3 + char4 + char5 + char6 + char7 + char8); | ||
637 | i += 5; | ||
638 | } | ||
639 | |||
640 | return result.join(""); | ||
641 | }, | ||
642 | |||
643 | //------------------------------------------------------------------------- | ||
644 | |||
645 | 'toBinaryString': function () { | ||
646 | vari, c; | ||
647 | var result; | ||
648 | |||
649 | result = ''; | ||
650 | |||
651 | c = this.length(); | ||
652 | for (i=0; i<c; i++) { | ||
653 | result += String.fromCharCode(this.byteAtIndex(i)); | ||
654 | } | ||
655 | |||
656 | return result; | ||
657 | }, | ||
658 | |||
659 | |||
660 | //------------------------------------------------------------------------- | ||
661 | |||
662 | 'split': function(aStartingIndex, anEndingIndex) { | ||
663 | throw Clipperz.Base.exception.AbstractMethod; | ||
664 | }, | ||
665 | |||
666 | //------------------------------------------------------------------------- | ||
667 | |||
668 | 'increment': function() { | ||
669 | var i; | ||
670 | var done; | ||
671 | |||
672 | done = false; | ||
673 | i = this.length() - 1; | ||
674 | |||
675 | while ((i>=0) && (done == false)) { | ||
676 | var currentByteValue; | ||
677 | |||
678 | currentByteValue = this.byteAtIndex(i); | ||
679 | |||
680 | if (currentByteValue == 0xff) { | ||
681 | this.setByteAtIndex(0, i); | ||
682 | if (i>= 0) { | ||
683 | i --; | ||
684 | } else { | ||
685 | done = true; | ||
686 | } | ||
687 | } else { | ||
688 | this.setByteAtIndex(currentByteValue + 1, i); | ||
689 | done = true; | ||
690 | } | ||
691 | } | ||
692 | }, | ||
693 | |||
694 | //------------------------------------------------------------------------- | ||
695 | |||
696 | 'arrayValues': function() { | ||
697 | throw Clipperz.Base.exception.AbstractMethod; | ||
698 | }, | ||
699 | |||
700 | //------------------------------------------------------------------------- | ||
701 | __syntaxFix__: "syntax fix" | ||
702 | |||
703 | }); | ||
704 | |||
705 | //============================================================================= | ||
706 | // | ||
707 | //Clipperz.ByteArray_hex | ||
708 | // | ||
709 | //============================================================================= | ||
710 | /* | ||
711 | Clipperz.ByteArray_hex = function (args) { | ||
712 | this._value = ""; | ||
713 | |||
714 | if (typeof(args) != 'undefined') { | ||
715 | if (args.constructor == Array) { | ||
716 | this.appendBytes(args); | ||
717 | } else if (args.constructor == String) { | ||
718 | if (args.indexOf("0x") == 0) { | ||
719 | varvalue; | ||
720 | |||
721 | value = args.substring(2).toLowerCase(); | ||
722 | if (/[0123456789abcdef]* /.test(value)) { the space in the regexp shoud be removed if the code is activate | ||
723 | if ((value.length % 2) == 0) { | ||
724 | this._value = value; | ||
725 | } else { | ||
726 | this._value = "0" + value; | ||
727 | } | ||
728 | } else { | ||
729 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | ||
730 | throw Clipperz.ByteArray.exception.InvalidValue; | ||
731 | } | ||
732 | } else { | ||
733 | varvalue; | ||
734 | vari,c; | ||
735 | |||
736 | c = args.length; | ||
737 | value = new Array(c); | ||
738 | for (i=0; i<c; i++) { | ||
739 | value.push(Clipperz.ByteArray.unicodeToUtf8HexString(args.charCodeAt(i))); | ||
740 | } | ||
741 | |||
742 | this._value = value.join(""); | ||
743 | } | ||
744 | } else { | ||
745 | this.appendBytes(MochiKit.Base.extend(null, arguments)); | ||
746 | } | ||
747 | } | ||
748 | return this; | ||
749 | } | ||
750 | |||
751 | Clipperz.ByteArray_hex.prototype = MochiKit.Base.update(new Clipperz.ByteArray_abstract(), { | ||
752 | |||
753 | //------------------------------------------------------------------------- | ||
754 | |||
755 | 'toString': function() { | ||
756 | return "Clipperz.ByteArray_hex"; | ||
757 | }, | ||
758 | |||
759 | //------------------------------------------------------------------------- | ||
760 | |||
761 | 'clone': function() { | ||
762 | var result; | ||
763 | |||
764 | result = this.newInstance(); | ||
765 | result._value = this._value; | ||
766 | |||
767 | return result; | ||
768 | }, | ||
769 | |||
770 | //------------------------------------------------------------------------- | ||
771 | |||
772 | 'newInstance': function() { | ||
773 | return new Clipperz.ByteArray_hex(); | ||
774 | }, | ||
775 | |||
776 | //------------------------------------------------------------------------- | ||
777 | |||
778 | 'reset': function() { | ||
779 | this._value = ""; | ||
780 | }, | ||
781 | |||
782 | //------------------------------------------------------------------------- | ||
783 | |||
784 | 'length': function() { | ||
785 | return (this._value.length / 2); | ||
786 | }, | ||
787 | |||
788 | //------------------------------------------------------------------------- | ||
789 | |||
790 | 'appendBlock': function(aBlock) { | ||
791 | this._value = this._value += aBlock.toHexString().substring(2); | ||
792 | |||
793 | return this; | ||
794 | }, | ||
795 | |||
796 | //------------------------------------------------------------------------- | ||
797 | |||
798 | 'appendByte': function(aValue) { | ||
799 | if (aValue != null) { | ||
800 | this.checkByteValue(aValue); | ||
801 | this._value += Clipperz.ByteArray.byteToHex(aValue); | ||
802 | } | ||
803 | |||
804 | return this; | ||
805 | }, | ||
806 | |||
807 | //------------------------------------------------------------------------- | ||
808 | |||
809 | 'byteAtIndex': function(anIndex) { | ||
810 | return parseInt(this._value.substr(anIndex*2, 2), 16); | ||
811 | }, | ||
812 | |||
813 | 'setByteAtIndex': function(aValue, anIndex) { | ||
814 | varmissingBytes; | ||
815 | |||
816 | this.checkByteValue(aValue); | ||
817 | |||
818 | missingBytes = anIndex - this.length(); | ||
819 | |||
820 | if (missingBytes < 0) { | ||
821 | varcurrentValue; | ||
822 | varfirstCutIndex; | ||
823 | var secondCutIndex; | ||
824 | |||
825 | firstCutIndex = anIndex * 2; | ||
826 | secondCutIndex = firstCutIndex + 2; | ||
827 | currentValue = this._value; | ||
828 | this._value =currentValue.substring(0, firstCutIndex) + | ||
829 | Clipperz.ByteArray.byteToHex(aValue) + | ||
830 | currentValue.substring(secondCutIndex); | ||
831 | } else if (missingBytes == 0) { | ||
832 | this.appendByte(aValue); | ||
833 | } else { | ||
834 | var i,c; | ||
835 | |||
836 | c = missingBytes; | ||
837 | for (i=0; i<c; i++) { | ||
838 | this.appendByte(0); | ||
839 | } | ||
840 | |||
841 | this.appendByte(aValue); | ||
842 | } | ||
843 | }, | ||
844 | |||
845 | //------------------------------------------------------------------------- | ||
846 | |||
847 | 'toHexString': function() { | ||
848 | return "0x" + this._value; | ||
849 | }, | ||
850 | |||
851 | //------------------------------------------------------------------------- | ||
852 | |||
853 | 'split': function(aStartingIndex, anEndingIndex) { | ||
854 | var result; | ||
855 | varstartingIndex; | ||
856 | var endingIndex; | ||
857 | |||
858 | result = this.newInstance(); | ||
859 | |||
860 | startingIndex = aStartingIndex * 2; | ||
861 | if (typeof(anEndingIndex) != 'undefined') { | ||
862 | endingIndex = anEndingIndex * 2; | ||
863 | result._value = this._value.substring(startingIndex, endingIndex); | ||
864 | } else { | ||
865 | result._value = this._value.substring(startingIndex); | ||
866 | } | ||
867 | |||
868 | return result; | ||
869 | }, | ||
870 | |||
871 | //------------------------------------------------------------------------- | ||
872 | |||
873 | 'arrayValues': function() { | ||
874 | var result; | ||
875 | var i,c; | ||
876 | |||
877 | c = this.length(); | ||
878 | |||
879 | result = new Array(c); | ||
880 | for (i=0; i<c; i++) { | ||
881 | result[i] = this.byteAtIndex(i); | ||
882 | } | ||
883 | |||
884 | return result; | ||
885 | }, | ||
886 | |||
887 | //------------------------------------------------------------------------- | ||
888 | __syntaxFix__: "syntax fix" | ||
889 | }); | ||
890 | */ | ||
891 | |||
892 | //============================================================================= | ||
893 | // | ||
894 | //Clipperz.ByteArray_array | ||
895 | // | ||
896 | //============================================================================= | ||
897 | |||
898 | Clipperz.ByteArray_array = function (args) { | ||
899 | if (typeof(args) != 'undefined') { | ||
900 | if (args.constructor == Array) { | ||
901 | this._value = args.slice(0); | ||
902 | } else if (args.constructor == String) { | ||
903 | var result; | ||
904 | varvalue; | ||
905 | var i, c; | ||
906 | |||
907 | if (args.indexOf("0x") == 0) { | ||
908 | |||
909 | value = args.substring(2).toLowerCase(); | ||
910 | if (/[0123456789abcdef]*/.test(value)) { | ||
911 | if ((value.length % 2) != 0) { | ||
912 | value = "0" + value; | ||
913 | } | ||
914 | } else { | ||
915 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | ||
916 | throw Clipperz.ByteArray.exception.InvalidValue; | ||
917 | } | ||
918 | |||
919 | c = value.length / 2 | ||
920 | result = new Array(c); | ||
921 | for (i=0; i<c; i++) { | ||
922 | result[i] = parseInt(value.substr(i*2, 2), 16); | ||
923 | } | ||
924 | |||
925 | } else { | ||
926 | var unicode; | ||
927 | result = []; | ||
928 | c = args.length; | ||
929 | for (i=0; i<c; i++) { | ||
930 | // Clipperz.ByteArray.pushUtf8BytesOfUnicodeChar(result, args.charCodeAt(i)); | ||
931 | |||
932 | unicode = args.charCodeAt(i); | ||
933 | if (unicode <= 0x7f) { //0x00000000 - 0x0000007f -> 0xxxxxxx | ||
934 | result.push(unicode); | ||
935 | // } else if ((unicode >= 0x80) && (unicode <= 0x7ff)) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx | ||
936 | } else if (unicode <= 0x7ff) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx | ||
937 | result.push((unicode >> 6) | 0xc0); | ||
938 | result.push((unicode & 0x3F) | 0x80); | ||
939 | // } else if ((unicode >= 0x0800) && (unicode <= 0xffff)) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx | ||
940 | } else if (unicode <= 0xffff) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx | ||
941 | result.push((unicode >> 12) | 0xe0); | ||
942 | result.push(((unicode >> 6) & 0x3f) | 0x80); | ||
943 | result.push((unicode & 0x3f) | 0x80); | ||
944 | } else { //0x00010000 - 0x001fffff -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | ||
945 | result.push((unicode >> 18) | 0xf0); | ||
946 | result.push(((unicode >> 12) & 0x3f) | 0x80); | ||
947 | result.push(((unicode >> 6) & 0x3f) | 0x80); | ||
948 | result.push((unicode & 0x3f) | 0x80); | ||
949 | } | ||
950 | } | ||
951 | } | ||
952 | |||
953 | |||
954 | this._value = result; | ||
955 | } else { | ||
956 | this._value = []; | ||
957 | this.appendBytes(MochiKit.Base.extend(null, arguments)); | ||
958 | } | ||
959 | } else { | ||
960 | this._value = []; | ||
961 | } | ||
962 | |||
963 | return this; | ||
964 | } | ||
965 | |||
966 | Clipperz.ByteArray_array.prototype = MochiKit.Base.update(new Clipperz.ByteArray_abstract(), { | ||
967 | |||
968 | //------------------------------------------------------------------------- | ||
969 | |||
970 | 'toString': function() { | ||
971 | return "Clipperz.ByteArray_array"; | ||
972 | }, | ||
973 | |||
974 | //------------------------------------------------------------------------- | ||
975 | |||
976 | 'clone': function() { | ||
977 | var result; | ||
978 | |||
979 | result = this.newInstance(); | ||
980 | result.appendBytes(this._value); | ||
981 | |||
982 | return result; | ||
983 | }, | ||
984 | |||
985 | //------------------------------------------------------------------------- | ||
986 | |||
987 | 'newInstance': function() { | ||
988 | return new Clipperz.ByteArray_array(); | ||
989 | }, | ||
990 | |||
991 | //------------------------------------------------------------------------- | ||
992 | |||
993 | 'reset': function() { | ||
994 | this._value = []; | ||
995 | }, | ||
996 | |||
997 | //------------------------------------------------------------------------- | ||
998 | |||
999 | 'length': function() { | ||
1000 | return (this._value.length); | ||
1001 | }, | ||
1002 | |||
1003 | //------------------------------------------------------------------------- | ||
1004 | |||
1005 | 'appendBlock': function(aBlock) { | ||
1006 | MochiKit.Base.extend(this._value, aBlock._value); | ||
1007 | |||
1008 | return this; | ||
1009 | }, | ||
1010 | |||
1011 | //------------------------------------------------------------------------- | ||
1012 | |||
1013 | 'appendByte': function(aValue) { | ||
1014 | if (aValue != null) { | ||
1015 | this.checkByteValue(aValue); | ||
1016 | this._value.push(aValue); | ||
1017 | } | ||
1018 | |||
1019 | return this; | ||
1020 | }, | ||
1021 | |||
1022 | //------------------------------------------------------------------------- | ||
1023 | |||
1024 | 'byteAtIndex': function(anIndex) { | ||
1025 | return this._value[anIndex]; | ||
1026 | }, | ||
1027 | |||
1028 | 'setByteAtIndex': function(aValue, anIndex) { | ||
1029 | varmissingBytes; | ||
1030 | |||
1031 | this.checkByteValue(aValue); | ||
1032 | |||
1033 | missingBytes = anIndex - this.length(); | ||
1034 | |||
1035 | if (missingBytes < 0) { | ||
1036 | this._value[anIndex] = aValue; | ||
1037 | } else if (missingBytes == 0) { | ||
1038 | this._value.push(aValue); | ||
1039 | } else { | ||
1040 | var i,c; | ||
1041 | |||
1042 | c = missingBytes; | ||
1043 | for (i=0; i<c; i++) { | ||
1044 | this._value.push(0); | ||
1045 | } | ||
1046 | |||
1047 | this._value.push(aValue); | ||
1048 | } | ||
1049 | }, | ||
1050 | |||
1051 | //------------------------------------------------------------------------- | ||
1052 | |||
1053 | 'toHexString': function() { | ||
1054 | var result; | ||
1055 | var i, c; | ||
1056 | |||
1057 | result = "0x"; | ||
1058 | c = this.length(); | ||
1059 | for (i=0; i<c; i++) { | ||
1060 | result += Clipperz.ByteArray.byteToHex(this._value[i]); | ||
1061 | } | ||
1062 | |||
1063 | return result; | ||
1064 | }, | ||
1065 | |||
1066 | //------------------------------------------------------------------------- | ||
1067 | |||
1068 | 'split': function(aStartingIndex, anEndingIndex) { | ||
1069 | var result; | ||
1070 | |||
1071 | result = this.newInstance(); | ||
1072 | result._value = this._value.slice(aStartingIndex, anEndingIndex ? anEndingIndex : this.length()); | ||
1073 | |||
1074 | return result; | ||
1075 | }, | ||
1076 | |||
1077 | //------------------------------------------------------------------------- | ||
1078 | |||
1079 | 'arrayValues': function() { | ||
1080 | return this._value.slice(0); | ||
1081 | }, | ||
1082 | |||
1083 | //------------------------------------------------------------------------- | ||
1084 | __syntaxFix__: "syntax fix" | ||
1085 | }); | ||
1086 | |||
1087 | |||
1088 | |||
1089 | |||
1090 | |||
1091 | //============================================================================= | ||
1092 | // | ||
1093 | //Clipperz.ByteArray_string | ||
1094 | // | ||
1095 | //============================================================================= | ||
1096 | /* | ||
1097 | Clipperz.ByteArray_string = function (args) { | ||
1098 | this._value = ""; | ||
1099 | |||
1100 | if (typeof(args) != 'undefined') { | ||
1101 | if (args.constructor == Array) { | ||
1102 | this.appendBytes(args); | ||
1103 | } else if (args.constructor == String) { | ||
1104 | var result; | ||
1105 | varvalue; | ||
1106 | var i, c; | ||
1107 | |||
1108 | if (args.indexOf("0x") == 0) { | ||
1109 | |||
1110 | value = args.substring(2).toLowerCase(); | ||
1111 | if (/[0123456789abcdef]* /.test(value)) { the space in the regexp shoud be removed if the code is activated | ||
1112 | if ((value.length % 2) != 0) { | ||
1113 | value = "0" + value; | ||
1114 | } | ||
1115 | } else { | ||
1116 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | ||
1117 | throw Clipperz.ByteArray.exception.InvalidValue; | ||
1118 | } | ||
1119 | } else { | ||
1120 | value = ""; | ||
1121 | c = args.length; | ||
1122 | for (i=0; i<c; i++) { | ||
1123 | value += Clipperz.ByteArray.unicodeToUtf8HexString(args.charCodeAt(i)); | ||
1124 | } | ||
1125 | } | ||
1126 | |||
1127 | c = value.length / 2 | ||
1128 | for (i=0; i<c; i++) { | ||
1129 | this.appendByte(parseInt(value.substr(i*2, 2), 16)); | ||
1130 | } | ||
1131 | } else { | ||
1132 | this.appendBytes(MochiKit.Base.extend(null, arguments)); | ||
1133 | } | ||
1134 | } | ||
1135 | |||
1136 | return this; | ||
1137 | } | ||
1138 | |||
1139 | Clipperz.ByteArray_string.prototype = MochiKit.Base.update(new Clipperz.ByteArray_abstract(), { | ||
1140 | |||
1141 | //------------------------------------------------------------------------- | ||
1142 | |||
1143 | 'toString': function() { | ||
1144 | return "Clipperz.ByteArray_string"; | ||
1145 | }, | ||
1146 | |||
1147 | //------------------------------------------------------------------------- | ||
1148 | |||
1149 | 'clone': function() { | ||
1150 | var result; | ||
1151 | |||
1152 | result = this.newInstance(); | ||
1153 | result._value = this._value; | ||
1154 | |||
1155 | return result; | ||
1156 | }, | ||
1157 | |||
1158 | //------------------------------------------------------------------------- | ||
1159 | |||
1160 | 'newInstance': function() { | ||
1161 | return new Clipperz.ByteArray_string(); | ||
1162 | }, | ||
1163 | |||
1164 | //------------------------------------------------------------------------- | ||
1165 | |||
1166 | 'reset': function() { | ||
1167 | this._value = ""; | ||
1168 | }, | ||
1169 | |||
1170 | //------------------------------------------------------------------------- | ||
1171 | |||
1172 | 'length': function() { | ||
1173 | return (this._value.length); | ||
1174 | }, | ||
1175 | |||
1176 | //------------------------------------------------------------------------- | ||
1177 | |||
1178 | 'appendBlock': function(aBlock) { | ||
1179 | this._value += aBlock._value; | ||
1180 | |||
1181 | return this; | ||
1182 | }, | ||
1183 | |||
1184 | //------------------------------------------------------------------------- | ||
1185 | |||
1186 | 'appendByte': function(aValue) { | ||
1187 | if (aValue != null) { | ||
1188 | this.checkByteValue(aValue); | ||
1189 | this._value += String.fromCharCode(aValue); | ||
1190 | } | ||
1191 | |||
1192 | return this; | ||
1193 | }, | ||
1194 | |||
1195 | //------------------------------------------------------------------------- | ||
1196 | |||
1197 | 'byteAtIndex': function(anIndex) { | ||
1198 | return this._value.charCodeAt(anIndex); | ||
1199 | }, | ||
1200 | |||
1201 | 'setByteAtIndex': function(aValue, anIndex) { | ||
1202 | varmissingBytes; | ||
1203 | |||
1204 | this.checkByteValue(aValue); | ||
1205 | |||
1206 | missingBytes = anIndex - this.length(); | ||
1207 | |||
1208 | if (missingBytes < 0) { | ||
1209 | this._value = this._value.substring(0, anIndex) + String.fromCharCode(aValue) + this._value.substring(anIndex + 1); | ||
1210 | } else if (missingBytes == 0) { | ||
1211 | this.appendByte(aValue); | ||
1212 | } else { | ||
1213 | var i,c; | ||
1214 | |||
1215 | c = missingBytes; | ||
1216 | for (i=0; i<c; i++) { | ||
1217 | this.appendByte(0); | ||
1218 | } | ||
1219 | |||
1220 | this.appendByte(aValue); | ||
1221 | } | ||
1222 | }, | ||
1223 | |||
1224 | //------------------------------------------------------------------------- | ||
1225 | |||
1226 | 'toHexString': function() { | ||
1227 | var result; | ||
1228 | var i, c; | ||
1229 | |||
1230 | result = "0x"; | ||
1231 | c = this.length(); | ||
1232 | for (i=0; i<c; i++) { | ||
1233 | result += Clipperz.ByteArray.byteToHex(this.byteAtIndex(i)); | ||
1234 | } | ||
1235 | |||
1236 | return result; | ||
1237 | }, | ||
1238 | |||
1239 | //------------------------------------------------------------------------- | ||
1240 | |||
1241 | 'split': function(aStartingIndex, anEndingIndex) { | ||
1242 | var result; | ||
1243 | result = this.newInstance(); | ||
1244 | result._value = this._value.substring(aStartingIndex, anEndingIndex ? anEndingIndex : this.length()); | ||
1245 | |||
1246 | return result; | ||
1247 | }, | ||
1248 | |||
1249 | //------------------------------------------------------------------------- | ||
1250 | |||
1251 | 'arrayValues': function() { | ||
1252 | var result; | ||
1253 | var i,c; | ||
1254 | |||
1255 | c = this.length(); | ||
1256 | |||
1257 | result = new Array(c); | ||
1258 | for (i=0; i<c; i++) { | ||
1259 | result[i] = this.byteAtIndex(i); | ||
1260 | } | ||
1261 | |||
1262 | return result; | ||
1263 | }, | ||
1264 | |||
1265 | //------------------------------------------------------------------------- | ||
1266 | __syntaxFix__: "syntax fix" | ||
1267 | }); | ||
1268 | */ | ||
1269 | |||
1270 | //============================================================================= | ||
1271 | // | ||
1272 | //Clipperz.ByteArray | ||
1273 | // | ||
1274 | //============================================================================= | ||
1275 | |||
1276 | Clipperz.ByteArray = Clipperz.ByteArray_array; | ||
1277 | //Clipperz.ByteArray = Clipperz.ByteArray_string; | ||
1278 | //Clipperz.ByteArray = Clipperz.ByteArray_hex; | ||
1279 | |||
1280 | //############################################################################# | ||
1281 | |||
1282 | Clipperz.ByteArray.byteToHex = function(aByte) { | ||
1283 | return ((aByte < 16) ? "0" : "") + aByte.toString(16); | ||
1284 | } | ||
1285 | |||
1286 | |||
1287 | Clipperz.ByteArray.unicodeToUtf8HexString = function(aUnicode) { | ||
1288 | var result; | ||
1289 | varself; | ||
1290 | |||
1291 | self = Clipperz.ByteArray; | ||
1292 | |||
1293 | if (aUnicode <= 0x7f) { //0x00000000 - 0x0000007f -> 0xxxxxxx | ||
1294 | result = self.byteToHex(aUnicode); | ||
1295 | // } else if ((aUnicode >= 0x80) && (aUnicode <= 0x7ff)) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx | ||
1296 | } else if (aUnicode <= 0x7ff) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx | ||
1297 | result = self.byteToHex((aUnicode >> 6) | 0xc0); | ||
1298 | result += self.byteToHex((aUnicode & 0x3F) | 0x80); | ||
1299 | // } else if ((aUnicode >= 0x0800) && (aUnicode <= 0xffff)) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx | ||
1300 | } else if (aUnicode <= 0xffff) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx | ||
1301 | result = self.byteToHex((aUnicode >> 12) | 0xe0); | ||
1302 | result += self.byteToHex(((aUnicode >> 6) & 0x3f) | 0x80); | ||
1303 | result += self.byteToHex((aUnicode & 0x3f) | 0x80); | ||
1304 | } else { //0x00010000 - 0x001fffff -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | ||
1305 | result = self.byteToHex((aUnicode >> 18) | 0xf0); | ||
1306 | result += self.byteToHex(((aUnicode >> 12) & 0x3f) | 0x80); | ||
1307 | result += self.byteToHex(((aUnicode >> 6) & 0x3f) | 0x80); | ||
1308 | result += self.byteToHex((aUnicode & 0x3f) | 0x80); | ||
1309 | } | ||
1310 | |||
1311 | return result; | ||
1312 | } | ||
1313 | |||
1314 | Clipperz.ByteArray.pushUtf8BytesOfUnicodeChar = function(anArray, aUnicode) { | ||
1315 | varself; | ||
1316 | |||
1317 | self = Clipperz.ByteArray; | ||
1318 | |||
1319 | if (aUnicode <= 0x7f) { //0x00000000 - 0x0000007f -> 0xxxxxxx | ||
1320 | anArray.push(aUnicode); | ||
1321 | // } else if ((aUnicode >= 0x80) && (aUnicode <= 0x7ff)) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx | ||
1322 | } else if (aUnicode <= 0x7ff) { //0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx | ||
1323 | anArray.push((aUnicode >> 6) | 0xc0); | ||
1324 | anArray.push((aUnicode & 0x3F) | 0x80); | ||
1325 | // } else if ((aUnicode >= 0x0800) && (aUnicode <= 0xffff)) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx | ||
1326 | } else if (aUnicode <= 0xffff) { //0x00000800 - 0x0000ffff -> 1110xxxx 10xxxxxx 10xxxxxx | ||
1327 | anArray.push((aUnicode >> 12) | 0xe0); | ||
1328 | anArray.push(((aUnicode >> 6) & 0x3f) | 0x80); | ||
1329 | anArray.push((aUnicode & 0x3f) | 0x80); | ||
1330 | } else { //0x00010000 - 0x001fffff -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx | ||
1331 | anArray.push((aUnicode >> 18) | 0xf0); | ||
1332 | anArray.push(((aUnicode >> 12) & 0x3f) | 0x80); | ||
1333 | anArray.push(((aUnicode >> 6) & 0x3f) | 0x80); | ||
1334 | anArray.push((aUnicode & 0x3f) | 0x80); | ||
1335 | } | ||
1336 | } | ||
1337 | |||
1338 | Clipperz.ByteArray.prefixMatchingBits = function (aValue, bValue) { | ||
1339 | varresult; | ||
1340 | var i,c; | ||
1341 | |||
1342 | result = 0; | ||
1343 | |||
1344 | c = Math.min(aValue.length(), bValue.length()); | ||
1345 | i = 0; | ||
1346 | while (i<c && (aValue.byteAtIndex(i) == bValue.byteAtIndex(i))) { | ||
1347 | result += 8; | ||
1348 | i++; | ||
1349 | } | ||
1350 | |||
1351 | if (i<c) { | ||
1352 | varxorValue; | ||
1353 | |||
1354 | xorValue = (aValue.byteAtIndex(i) ^ bValue.byteAtIndex(i)); | ||
1355 | |||
1356 | if (xorValue >= 128) { | ||
1357 | result += 0; | ||
1358 | } else if (xorValue >= 64) { | ||
1359 | result += 1; | ||
1360 | } else if (xorValue >= 32) { | ||
1361 | result += 2; | ||
1362 | } else if (xorValue >= 16) { | ||
1363 | result += 3; | ||
1364 | } else if (xorValue >= 8) { | ||
1365 | result += 4; | ||
1366 | } else if (xorValue >= 4) { | ||
1367 | result += 5; | ||
1368 | } else if (xorValue >= 2) { | ||
1369 | result += 6; | ||
1370 | } else if (xorValue >= 1) { | ||
1371 | result += 7; | ||
1372 | } | ||
1373 | } | ||
1374 | |||
1375 | return result; | ||
1376 | }; | ||
1377 | |||
1378 | Clipperz.ByteArray.exception = { | ||
1379 | InvalidValue: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue") | ||
1380 | }; | ||
1381 | |||
1382 | //############################################################################# | ||
1383 | |||
1384 | Clipperz.ByteArrayIterator = function(args) { | ||
1385 | args = args || {}; | ||
1386 | |||
1387 | this._byteArray = args.byteArray; | ||
1388 | this._blockSize = args.blockSize; | ||
1389 | this._finalPadding = args.finalPadding || false; | ||
1390 | |||
1391 | this._currentPosition = 0; | ||
1392 | |||
1393 | return this; | ||
1394 | } | ||
1395 | |||
1396 | Clipperz.ByteArrayIterator.prototype = MochiKit.Base.update(null, { | ||
1397 | |||
1398 | //------------------------------------------------------------------------- | ||
1399 | |||
1400 | 'toString': function() { | ||
1401 | return "Clipperz.ByteArrayIterator"; | ||
1402 | }, | ||
1403 | |||
1404 | //------------------------------------------------------------------------- | ||
1405 | |||
1406 | 'blockSize': function() { | ||
1407 | var result; | ||
1408 | |||
1409 | result = this._blockSize; | ||
1410 | |||
1411 | return result; | ||
1412 | }, | ||
1413 | |||
1414 | //------------------------------------------------------------------------- | ||
1415 | |||
1416 | 'currentPosition': function() { | ||
1417 | var result; | ||
1418 | |||
1419 | result = this._currentPosition; | ||
1420 | |||
1421 | return result; | ||
1422 | }, | ||
1423 | |||
1424 | //------------------------------------------------------------------------- | ||
1425 | |||
1426 | 'byteArray': function() { | ||
1427 | var result; | ||
1428 | |||
1429 | result = this._byteArray; | ||
1430 | |||
1431 | return result; | ||
1432 | }, | ||
1433 | |||
1434 | //------------------------------------------------------------------------- | ||
1435 | |||
1436 | 'finalPadding': function() { | ||
1437 | var result; | ||
1438 | |||
1439 | result = this._finalPadding; | ||
1440 | |||
1441 | return result; | ||
1442 | }, | ||
1443 | |||
1444 | //------------------------------------------------------------------------- | ||
1445 | |||
1446 | 'nextBlock': function() { | ||
1447 | var result; | ||
1448 | var currentPosition; | ||
1449 | varbyteArrayLength; | ||
1450 | |||
1451 | currentPosition = this._currentPosition; | ||
1452 | byteArrayLength = this.byteArray().length(); | ||
1453 | |||
1454 | if (currentPosition < byteArrayLength) { | ||
1455 | var i,c; | ||
1456 | |||
1457 | c = this.blockSize(); | ||
1458 | result = new Array(c); | ||
1459 | for (i=0; i<c; i++) { | ||
1460 | if (currentPosition < byteArrayLength) { | ||
1461 | result[i] = this.byteArray().byteAtIndex(currentPosition); | ||
1462 | currentPosition++; | ||
1463 | } else if (this.finalPadding() == true) { | ||
1464 | result[i] = 0; | ||
1465 | } | ||
1466 | } | ||
1467 | |||
1468 | this._currentPosition = currentPosition; | ||
1469 | } else { | ||
1470 | result = null; | ||
1471 | } | ||
1472 | |||
1473 | return result; | ||
1474 | }, | ||
1475 | |||
1476 | //------------------------------------------------------------------------- | ||
1477 | |||
1478 | 'nextBlockArray': function() { | ||
1479 | var result; | ||
1480 | var nextBlock; | ||
1481 | |||
1482 | nextBlock = this.nextBlock(); | ||
1483 | |||
1484 | if (nextBlock != null) { | ||
1485 | result = new Clipperz.ByteArray(nextBlock); | ||
1486 | } else { | ||
1487 | result = null; | ||
1488 | } | ||
1489 | |||
1490 | return result; | ||
1491 | }, | ||
1492 | |||
1493 | //----------------------------------------------------------------------------- | ||
1494 | __syntaxFix__: "syntax fix" | ||
1495 | |||
1496 | }); | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Curve.js b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Curve.js new file mode 100644 index 0000000..9c61bab --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Curve.js | |||
@@ -0,0 +1,545 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | ||
26 | //} | ||
27 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | ||
28 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | ||
29 | |||
30 | Clipperz.Crypto.ECC.BinaryField.Curve = function(args) { | ||
31 | args = args || {}; | ||
32 | |||
33 | this._modulus = args.modulus; | ||
34 | |||
35 | this._a = args.a; | ||
36 | this._b = args.b; | ||
37 | this._G = args.G; | ||
38 | this._r = args.r; | ||
39 | this._h = args.h; | ||
40 | |||
41 | this._finiteField = null; | ||
42 | |||
43 | return this; | ||
44 | } | ||
45 | |||
46 | Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | ||
47 | |||
48 | 'asString': function() { | ||
49 | return "Clipperz.Crypto.ECC.BinaryField.Curve"; | ||
50 | }, | ||
51 | |||
52 | //----------------------------------------------------------------------------- | ||
53 | |||
54 | 'modulus': function() { | ||
55 | return this._modulus; | ||
56 | }, | ||
57 | |||
58 | 'a': function() { | ||
59 | return this._a; | ||
60 | }, | ||
61 | |||
62 | 'b': function() { | ||
63 | return this._b; | ||
64 | }, | ||
65 | |||
66 | 'G': function() { | ||
67 | return this._G; | ||
68 | }, | ||
69 | |||
70 | 'r': function() { | ||
71 | return this._r; | ||
72 | }, | ||
73 | |||
74 | 'h': function() { | ||
75 | return this._h; | ||
76 | }, | ||
77 | |||
78 | //----------------------------------------------------------------------------- | ||
79 | |||
80 | 'finiteField': function() { | ||
81 | if (this._finiteField == null) { | ||
82 | this._finiteField = new Clipperz.Crypto.ECC.BinaryField.FiniteField({modulus:this.modulus()}) | ||
83 | } | ||
84 | |||
85 | return this._finiteField; | ||
86 | }, | ||
87 | |||
88 | //----------------------------------------------------------------------------- | ||
89 | |||
90 | 'negate': function(aPointA) { | ||
91 | var result; | ||
92 | |||
93 | result = new Clipperz.Crypto.ECC.Point({x:aPointA.x(), y:this.finiteField().add(aPointA.y(), aPointA.x())}) | ||
94 | |||
95 | return result; | ||
96 | }, | ||
97 | |||
98 | //----------------------------------------------------------------------------- | ||
99 | |||
100 | 'add': function(aPointA, aPointB) { | ||
101 | var result; | ||
102 | |||
103 | //console.log(">>> ECC.BinaryField.Curve.add"); | ||
104 | if (aPointA.isZero()) { | ||
105 | //console.log("--- pointA == zero"); | ||
106 | result = aPointB; | ||
107 | } else if (aPointB.isZero()) { | ||
108 | //console.log("--- pointB == zero"); | ||
109 | result = aPointA; | ||
110 | } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) { | ||
111 | //console.log("compare A.x - B.x: ", aPointA.x().compare(aPointB.x())); | ||
112 | //console.log("compare A.y - B.y: ", (aPointA.y().compare(aPointB.y()) != 0)); | ||
113 | //console.log("compare B.x.isZero(): ", aPointB.x().isZero()); | ||
114 | |||
115 | //console.log("--- result = zero"); | ||
116 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | ||
117 | } else { | ||
118 | //console.log("--- result = ELSE"); | ||
119 | varf2m; | ||
120 | var x, y; | ||
121 | var lambda; | ||
122 | var aX, aY, bX, bY; | ||
123 | |||
124 | aX = aPointA.x()._value; | ||
125 | aY = aPointA.y()._value; | ||
126 | bX = aPointB.x()._value; | ||
127 | bY = aPointB.y()._value; | ||
128 | |||
129 | f2m = this.finiteField(); | ||
130 | |||
131 | if (aPointA.x().compare(aPointB.x()) != 0) { | ||
132 | //console.log(" a.x != b.x"); | ||
133 | lambda =f2m._fastMultiply( | ||
134 | f2m._add(aY, bY), | ||
135 | f2m._inverse(f2m._add(aX, bX)) | ||
136 | ); | ||
137 | x = f2m._add(this.a()._value, f2m._square(lambda)); | ||
138 | f2m._overwriteAdd(x, lambda); | ||
139 | f2m._overwriteAdd(x, aX); | ||
140 | f2m._overwriteAdd(x, bX); | ||
141 | } else { | ||
142 | //console.log(" a.x == b.x"); | ||
143 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); | ||
144 | //console.log(" lambda: " + lambda.asString(16)); | ||
145 | x = f2m._add(this.a()._value, f2m._square(lambda)); | ||
146 | //console.log(" x (step 1): " + x.asString(16)); | ||
147 | f2m._overwriteAdd(x, lambda); | ||
148 | //console.log(" x (step 2): " + x.asString(16)); | ||
149 | } | ||
150 | |||
151 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); | ||
152 | //console.log(" y (step 1): " + y.asString(16)); | ||
153 | f2m._overwriteAdd(y, x); | ||
154 | //console.log(" y (step 2): " + y.asString(16)); | ||
155 | f2m._overwriteAdd(y, bY); | ||
156 | //console.log(" y (step 3): " + y.asString(16)); | ||
157 | |||
158 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) | ||
159 | } | ||
160 | //console.log("<<< ECC.BinaryField.Curve.add"); | ||
161 | |||
162 | return result; | ||
163 | }, | ||
164 | |||
165 | //----------------------------------------------------------------------------- | ||
166 | |||
167 | 'addTwice': function(aPointA) { | ||
168 | return this.add(aPointA, aPointA); | ||
169 | }, | ||
170 | |||
171 | //----------------------------------------------------------------------------- | ||
172 | |||
173 | 'overwriteAdd': function(aPointA, aPointB) { | ||
174 | if (aPointA.isZero()) { | ||
175 | // result = aPointB; | ||
176 | aPointA._x._value = aPointB._x._value; | ||
177 | aPointA._y._value = aPointB._y._value; | ||
178 | } else if (aPointB.isZero()) { | ||
179 | // result = aPointA; | ||
180 | } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) { | ||
181 | // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | ||
182 | aPointA._x = Clipperz.Crypto.ECC.BinaryField.Value.O; | ||
183 | aPointA._y = Clipperz.Crypto.ECC.BinaryField.Value.O; | ||
184 | } else { | ||
185 | varf2m; | ||
186 | var x, y; | ||
187 | var lambda; | ||
188 | var aX, aY, bX, bY; | ||
189 | |||
190 | aX = aPointA.x()._value; | ||
191 | aY = aPointA.y()._value; | ||
192 | bX = aPointB.x()._value; | ||
193 | bY = aPointB.y()._value; | ||
194 | |||
195 | f2m = this.finiteField(); | ||
196 | |||
197 | if (aPointA.x().compare(aPointB.x()) != 0) { | ||
198 | //console.log(" a.x != b.x"); | ||
199 | lambda =f2m._fastMultiply( | ||
200 | f2m._add(aY, bY), | ||
201 | f2m._inverse(f2m._add(aX, bX)) | ||
202 | ); | ||
203 | x = f2m._add(this.a()._value, f2m._square(lambda)); | ||
204 | f2m._overwriteAdd(x, lambda); | ||
205 | f2m._overwriteAdd(x, aX); | ||
206 | f2m._overwriteAdd(x, bX); | ||
207 | } else { | ||
208 | //console.log(" a.x == b.x"); | ||
209 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); | ||
210 | //console.log(" lambda: " + lambda.asString(16)); | ||
211 | x = f2m._add(this.a()._value, f2m._square(lambda)); | ||
212 | //console.log(" x (step 1): " + x.asString(16)); | ||
213 | f2m._overwriteAdd(x, lambda); | ||
214 | //console.log(" x (step 2): " + x.asString(16)); | ||
215 | } | ||
216 | |||
217 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); | ||
218 | //console.log(" y (step 1): " + y.asString(16)); | ||
219 | f2m._overwriteAdd(y, x); | ||
220 | //console.log(" y (step 2): " + y.asString(16)); | ||
221 | f2m._overwriteAdd(y, bY); | ||
222 | //console.log(" y (step 3): " + y.asString(16)); | ||
223 | |||
224 | // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) | ||
225 | aPointA._x._value = x; | ||
226 | aPointA._y._value = y; | ||
227 | |||
228 | } | ||
229 | //console.log("<<< ECC.BinaryField.Curve.add"); | ||
230 | |||
231 | return result; | ||
232 | }, | ||
233 | |||
234 | //----------------------------------------------------------------------------- | ||
235 | |||
236 | 'multiply': function(aValue, aPoint) { | ||
237 | var result; | ||
238 | |||
239 | //console.profile(); | ||
240 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | ||
241 | |||
242 | if (aValue.isZero() == false) { | ||
243 | var k, Q; | ||
244 | var i; | ||
245 | var countIndex; countIndex = 0; | ||
246 | |||
247 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { | ||
248 | k = aValue; | ||
249 | Q = aPoint; | ||
250 | } else { | ||
251 | MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); | ||
252 | k = aValue.negate(); | ||
253 | Q = this.negate(aPoint); | ||
254 | } | ||
255 | |||
256 | //console.log("k: " + k.toString(16)); | ||
257 | //console.log("k.bitSize: " + k.bitSize()); | ||
258 | for (i=k.bitSize()-1; i>=0; i--) { | ||
259 | result = this.add(result, result); | ||
260 | // this.overwriteAdd(result, result); | ||
261 | if (k.isBitSet(i)) { | ||
262 | result = this.add(result, Q); | ||
263 | // this.overwriteAdd(result, Q); | ||
264 | } | ||
265 | |||
266 | // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++; | ||
267 | } | ||
268 | } | ||
269 | //console.profileEnd(); | ||
270 | |||
271 | return result; | ||
272 | }, | ||
273 | |||
274 | //----------------------------------------------------------------------------- | ||
275 | |||
276 | 'deferredMultiply': function(aValue, aPoint) { | ||
277 | var deferredResult; | ||
278 | var result; | ||
279 | |||
280 | MochiKit.Logging.logDebug(">>> deferredMultiply - value: " + aValue + ", point: " + aPoint); | ||
281 | //console.profile("ECC.Curve.multiply"); | ||
282 | deferredResult = new MochiKit.Async.Deferred(); | ||
283 | //deferredResult.addCallback(function(res) {console.profile("ECC.Curve.deferredMultiply"); return res;} ); | ||
284 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 1: " + res); return res;}); | ||
285 | |||
286 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | ||
287 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 2: " + res); return res;}); | ||
288 | |||
289 | if (aValue.isZero() == false) { | ||
290 | var k, Q; | ||
291 | var i; | ||
292 | var countIndex; countIndex = 0; | ||
293 | |||
294 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { | ||
295 | k = aValue; | ||
296 | Q = aPoint; | ||
297 | } else { | ||
298 | MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); | ||
299 | k = aValue.negate(); | ||
300 | Q = this.negate(aPoint); | ||
301 | } | ||
302 | |||
303 | //console.log("k: " + k.toString(16)); | ||
304 | //console.log("k.bitSize: " + k.bitSize()); | ||
305 | |||
306 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 3: " + res); return res;}); | ||
307 | for (i=k.bitSize()-1; i>=0; i--) { | ||
308 | //MochiKit.Logging.logDebug("====> " + i); | ||
309 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4 > i = " + i + ": " + res); return res;}); | ||
310 | deferredResult.addMethod(this, "addTwice"); | ||
311 | //# result = this.add(result, result); | ||
312 | // this.overwriteAdd(result, result); | ||
313 | if (k.isBitSet(i)) { | ||
314 | deferredResult.addMethod(this, "add", Q); | ||
315 | //# result = this.add(result, Q); | ||
316 | // this.overwriteAdd(result, Q); | ||
317 | } | ||
318 | if (i%20 == 0) {deferredResult.addCallback(MochiKit.Async.wait, 0.1);} | ||
319 | |||
320 | // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++; | ||
321 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4 < i = " + i + ": " + res); return res;}); | ||
322 | } | ||
323 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4: " + res); return res;}); | ||
324 | } | ||
325 | //#console.profileEnd(); | ||
326 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 5: " + res); return res;}); | ||
327 | //deferredResult.addBoth(function(res) {console.profileEnd(); return res;}); | ||
328 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 6: " + res); return res;}); | ||
329 | deferredResult.callback(result); | ||
330 | |||
331 | //# return result; | ||
332 | return deferredResult; | ||
333 | }, | ||
334 | |||
335 | //----------------------------------------------------------------------------- | ||
336 | __syntaxFix__: "syntax fix" | ||
337 | }); | ||
338 | |||
339 | |||
340 | //############################################################################# | ||
341 | |||
342 | Clipperz.Crypto.ECC.StandardCurves = {}; | ||
343 | |||
344 | MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | ||
345 | /* | ||
346 | '_K571': null, | ||
347 | 'K571': function() { | ||
348 | if (Clipperz.Crypto.ECC.StandardCurves._K571 == null) { | ||
349 | Clipperz.Crypto.ECC.StandardCurves._K571 = new Clipperz.Crypto.ECC.BinaryField.Curve({ | ||
350 | modulus: new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000425', 16), | ||
351 | a: new Clipperz.Crypto.ECC.BinaryField.Value('0', 16), | ||
352 | b: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16), | ||
353 | G: new Clipperz.Crypto.ECC.BinaryField.Point({ | ||
354 | x: new Clipperz.Crypto.ECC.BinaryField.Value('026eb7a8 59923fbc 82189631 f8103fe4 ac9ca297 0012d5d4 60248048 01841ca4 43709584 93b205e6 47da304d b4ceb08c bbd1ba39 494776fb 988b4717 4dca88c7 e2945283 a01c8972', 16), | ||
355 | y: new Clipperz.Crypto.ECC.BinaryField.Value('0349dc80 7f4fbf37 4f4aeade 3bca9531 4dd58cec 9f307a54 ffc61efc 006d8a2c 9d4979c0 ac44aea7 4fbebbb9 f772aedc b620b01a 7ba7af1b 320430c8 591984f6 01cd4c14 3ef1c7a3', 16) | ||
356 | }), | ||
357 | r: new Clipperz.Crypto.ECC.BinaryField.Value('02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850e1 f19a63e4 b391a8db 917f4138 b630d84b e5d63938 1e91deb4 5cfe778f 637c1001', 16), | ||
358 | h: new Clipperz.Crypto.ECC.BinaryField.Value('4', 16) | ||
359 | }); | ||
360 | } | ||
361 | |||
362 | return Clipperz.Crypto.ECC.StandardCurves._K571; | ||
363 | }, | ||
364 | |||
365 | |||
366 | |||
367 | '_K283': null, | ||
368 | 'K283': function() { //f(z) = z^283 + z^12 + z^7 + z^5 + 1 | ||
369 | if (Clipperz.Crypto.ECC.StandardCurves._K283 == null) { | ||
370 | Clipperz.Crypto.ECC.StandardCurves._K283 = new Clipperz.Crypto.ECC.BinaryField.Curve({ | ||
371 | modulus: new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16), | ||
372 | a: new Clipperz.Crypto.ECC.BinaryField.Value('0', 16), | ||
373 | b: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16), | ||
374 | G: new Clipperz.Crypto.ECC.BinaryField.Point({ | ||
375 | x: new Clipperz.Crypto.ECC.BinaryField.Value('0503213f 78ca4488 3f1a3b81 62f188e5 53cd265f 23c1567a 16876913 b0c2ac24 58492836', 16), | ||
376 | y: new Clipperz.Crypto.ECC.BinaryField.Value('01ccda38 0f1c9e31 8d90f95d 07e5426f e87e45c0 e8184698 e4596236 4e341161 77dd2259', 16) | ||
377 | }), | ||
378 | r: new Clipperz.Crypto.ECC.BinaryField.Value('01ffffff ffffffff ffffffff ffffffff ffffe9ae 2ed07577 265dff7f 94451e06 1e163c61', 16), | ||
379 | h: new Clipperz.Crypto.ECC.BinaryField.Value('4', 16) | ||
380 | }); | ||
381 | } | ||
382 | |||
383 | return Clipperz.Crypto.ECC.StandardCurves._K283; | ||
384 | }, | ||
385 | */ | ||
386 | //----------------------------------------------------------------------------- | ||
387 | |||
388 | '_B571': null, | ||
389 | 'B571': function() { //f(z) = z^571 + z^10 + z^5 + z^2 + 1 | ||
390 | if (Clipperz.Crypto.ECC.StandardCurves._B571 == null) { | ||
391 | Clipperz.Crypto.ECC.StandardCurves._B571 = new Clipperz.Crypto.ECC.BinaryField.Curve({ | ||
392 | modulus: new Clipperz.Crypto.ECC.BinaryField.Value('80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425', 16), | ||
393 | a: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16), | ||
394 | b: new Clipperz.Crypto.ECC.BinaryField.Value('02f40e7e2221f295de297117b7f3d62f5c6a97ffcb8ceff1cd6ba8ce4a9a18ad84ffabbd8efa59332be7ad6756a66e294afd185a78ff12aa520e4de739baca0c7ffeff7f2955727a', 16), | ||
395 | G: new Clipperz.Crypto.ECC.BinaryField.Point({ | ||
396 | x: new Clipperz.Crypto.ECC.BinaryField.Value('0303001d 34b85629 6c16c0d4 0d3cd775 0a93d1d2 955fa80a a5f40fc8 db7b2abd bde53950 f4c0d293 cdd711a3 5b67fb14 99ae6003 8614f139 4abfa3b4 c850d927 e1e7769c 8eec2d19', 16), | ||
397 | y: new Clipperz.Crypto.ECC.BinaryField.Value('037bf273 42da639b 6dccfffe b73d69d7 8c6c27a6 009cbbca 1980f853 3921e8a6 84423e43 bab08a57 6291af8f 461bb2a8 b3531d2f 0485c19b 16e2f151 6e23dd3c 1a4827af 1b8ac15b', 16) | ||
398 | }), | ||
399 | r: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff e661ce18 ff559873 08059b18 6823851e c7dd9ca1 161de93d 5174d66e 8382e9bb 2fe84e47', 16), | ||
400 | h: new Clipperz.Crypto.ECC.BinaryField.Value('2', 16) | ||
401 | |||
402 | // S: new Clipperz.Crypto.ECC.BinaryField.Value('2aa058f73a0e33ab486b0f610410c53a7f132310', 10), | ||
403 | // n: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47', 16) | ||
404 | }); | ||
405 | |||
406 | //----------------------------------------------------------------------------- | ||
407 | // | ||
408 | //Guide to Elliptic Curve Cryptography | ||
409 | //Darrel Hankerson, Alfred Menezes, Scott Vanstone | ||
410 | //- Pag: 56, Alorithm 2.45 (with a typo!!!) | ||
411 | // | ||
412 | //----------------------------------------------------------------------------- | ||
413 | // | ||
414 | // http://www.milw0rm.com/papers/136 | ||
415 | // | ||
416 | // ------------------------------------------------------------------------- | ||
417 | // Polynomial Reduction Algorithm Modulo f571 | ||
418 | // ------------------------------------------------------------------------- | ||
419 | // | ||
420 | // Input: Polynomial p(x) of degree 1140 or less, stored as | ||
421 | // an array of 2T machinewords. | ||
422 | // Output: p(x) mod f571(x) | ||
423 | // | ||
424 | // FOR i = T-1, ..., 0 DO | ||
425 | // SET X := P[i+T] | ||
426 | // P[i] := P[i] ^ (X<<5) ^ (X<<7) ^ (X<<10) ^ (X<<15) | ||
427 | // P[i+1] := P[i+1] ^ (X>>17) ^ (X>>22) ^ (X>>25) ^ (X>>27) | ||
428 | // | ||
429 | // SET X := P[T-1] >> 27 | ||
430 | // P[0] := P[0] ^ X ^ (X<<2) ^ (X<<5) ^ (X<<10) | ||
431 | // P[T-1] := P[T-1] & 0x07ffffff | ||
432 | // | ||
433 | // RETURN P[T-1],...,P[0] | ||
434 | // | ||
435 | // ------------------------------------------------------------------------- | ||
436 | // | ||
437 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; | ||
438 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { | ||
439 | varresult; | ||
440 | |||
441 | if (aValue.bitSize() > 1140) { | ||
442 | MochiKit.Logging.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); | ||
443 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); | ||
444 | } else { | ||
445 | varC, T; | ||
446 | var i; | ||
447 | |||
448 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
449 | // C = aValue.value().slice(0); | ||
450 | C = aValue._value.slice(0); | ||
451 | for (i=35; i>=18; i--) { | ||
452 | T = C[i]; | ||
453 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); | ||
454 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); | ||
455 | } | ||
456 | T = (C[17] >>> 27); | ||
457 | C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0); | ||
458 | C[17] = (C[17] & 0x07ffffff); | ||
459 | |||
460 | for(i=18; i<=35; i++) { | ||
461 | C[i] = 0; | ||
462 | } | ||
463 | |||
464 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | ||
465 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
466 | } | ||
467 | |||
468 | return result; | ||
469 | }; | ||
470 | } | ||
471 | |||
472 | return Clipperz.Crypto.ECC.StandardCurves._B571; | ||
473 | }, | ||
474 | |||
475 | //----------------------------------------------------------------------------- | ||
476 | |||
477 | '_B283': null, | ||
478 | 'B283': function() { //f(z) = z^283 + z^12 + z^7 + z^5 + 1 | ||
479 | if (Clipperz.Crypto.ECC.StandardCurves._B283 == null) { | ||
480 | Clipperz.Crypto.ECC.StandardCurves._B283 = new Clipperz.Crypto.ECC.BinaryField.Curve({ | ||
481 | // modulus: new Clipperz.Crypto.ECC.BinaryField.Value('10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16), | ||
482 | modulus: new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16), | ||
483 | a: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16), | ||
484 | b: new Clipperz.Crypto.ECC.BinaryField.Value('027b680a c8b8596d a5a4af8a 19a0303f ca97fd76 45309fa2 a581485a f6263e31 3b79a2f5', 16), | ||
485 | G: new Clipperz.Crypto.ECC.BinaryField.Point({ | ||
486 | x: new Clipperz.Crypto.ECC.BinaryField.Value('05f93925 8db7dd90 e1934f8c 70b0dfec 2eed25b8 557eac9c 80e2e198 f8cdbecd 86b12053', 16), | ||
487 | y: new Clipperz.Crypto.ECC.BinaryField.Value('03676854 fe24141c b98fe6d4 b20d02b4 516ff702 350eddb0 826779c8 13f0df45 be8112f4', 16) | ||
488 | }), | ||
489 | r: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffff ffffffff ffffffff ffffffff ffffef90 399660fc 938a9016 5b042a7c efadb307', 16), | ||
490 | h: new Clipperz.Crypto.ECC.BinaryField.Value('2', 16) | ||
491 | |||
492 | // S: new Clipperz.Crypto.ECC.BinaryField.Value('2aa058f73a0e33ab486b0f610410c53a7f132310', 10), | ||
493 | // n: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47', 16) | ||
494 | }); | ||
495 | |||
496 | //----------------------------------------------------------------------------- | ||
497 | // | ||
498 | //Guide to Elliptic Curve Cryptography | ||
499 | //Darrel Hankerson, Alfred Menezes, Scott Vanstone | ||
500 | //- Pag: 56, Alorithm 2.43 | ||
501 | // | ||
502 | //----------------------------------------------------------------------------- | ||
503 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; | ||
504 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { | ||
505 | varresult; | ||
506 | |||
507 | if (aValue.bitSize() > 564) { | ||
508 | MochiKit.Logging.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); | ||
509 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); | ||
510 | } else { | ||
511 | varC, T; | ||
512 | var i; | ||
513 | |||
514 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
515 | C = aValue._value.slice(0); | ||
516 | for (i=17; i>=9; i--) { | ||
517 | T = C[i]; | ||
518 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); | ||
519 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); | ||
520 | } | ||
521 | T = (C[8] >>> 27); | ||
522 | C[0] = ((C[0] ^ T ^ ((T<<5) ^ (T<<7) ^ (T<<12)) & 0xffffffff) >>> 0); | ||
523 | C[8] = (C[8] & 0x07ffffff); | ||
524 | |||
525 | for(i=9; i<=17; i++) { | ||
526 | C[i] = 0; | ||
527 | } | ||
528 | |||
529 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | ||
530 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
531 | } | ||
532 | |||
533 | return result; | ||
534 | }; | ||
535 | } | ||
536 | |||
537 | return Clipperz.Crypto.ECC.StandardCurves._B283; | ||
538 | }, | ||
539 | |||
540 | //----------------------------------------------------------------------------- | ||
541 | __syntaxFix__: "syntax fix" | ||
542 | }); | ||
543 | |||
544 | //############################################################################# | ||
545 | |||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/FiniteField.js b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/FiniteField.js new file mode 100644 index 0000000..4d1ca67 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/FiniteField.js | |||
@@ -0,0 +1,521 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | ||
26 | //} | ||
27 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | ||
28 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | ||
29 | |||
30 | Clipperz.Crypto.ECC.BinaryField.FiniteField = function(args) { | ||
31 | args = args || {}; | ||
32 | this._modulus = args.modulus; | ||
33 | |||
34 | return this; | ||
35 | } | ||
36 | |||
37 | Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(null, { | ||
38 | |||
39 | 'asString': function() { | ||
40 | return "Clipperz.Crypto.ECC.BinaryField.FiniteField (" + this.modulus().asString() + ")"; | ||
41 | }, | ||
42 | |||
43 | //----------------------------------------------------------------------------- | ||
44 | |||
45 | 'modulus': function() { | ||
46 | return this._modulus; | ||
47 | }, | ||
48 | |||
49 | //----------------------------------------------------------------------------- | ||
50 | |||
51 | '_module': function(aValue) { | ||
52 | varresult; | ||
53 | var modulusComparison; | ||
54 | //console.log(">>> binaryField.finiteField.(standard)module"); | ||
55 | |||
56 | modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); | ||
57 | |||
58 | if (modulusComparison < 0) { | ||
59 | result = aValue; | ||
60 | } else if (modulusComparison == 0) { | ||
61 | result = [0]; | ||
62 | } else { | ||
63 | var modulusBitSize; | ||
64 | var resultBitSize; | ||
65 | |||
66 | result = aValue; | ||
67 | |||
68 | modulusBitSize = this.modulus().bitSize(); | ||
69 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); | ||
70 | while (resultBitSize >= modulusBitSize) { | ||
71 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this.modulus()._value, resultBitSize - modulusBitSize)); | ||
72 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); | ||
73 | } | ||
74 | } | ||
75 | //console.log("<<< binaryField.finiteField.(standard)module"); | ||
76 | |||
77 | return result; | ||
78 | }, | ||
79 | |||
80 | 'module': function(aValue) { | ||
81 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._module(aValue._value.slice(0))); | ||
82 | }, | ||
83 | |||
84 | //----------------------------------------------------------------------------- | ||
85 | |||
86 | '_add': function(a, b) { | ||
87 | return Clipperz.Crypto.ECC.BinaryField.Value._xor(a, b); | ||
88 | }, | ||
89 | |||
90 | '_overwriteAdd': function(a, b) { | ||
91 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(a, b); | ||
92 | }, | ||
93 | |||
94 | 'add': function(a, b) { | ||
95 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._add(a._value, b._value)); | ||
96 | }, | ||
97 | |||
98 | //----------------------------------------------------------------------------- | ||
99 | |||
100 | 'negate': function(aValue) { | ||
101 | return aValue.clone(); | ||
102 | }, | ||
103 | |||
104 | //----------------------------------------------------------------------------- | ||
105 | |||
106 | '_multiply': function(a, b) { | ||
107 | var result; | ||
108 | var valueToXor; | ||
109 | var i,c; | ||
110 | |||
111 | result = [0]; | ||
112 | valueToXor = b; | ||
113 | c = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(a); | ||
114 | for (i=0; i<c; i++) { | ||
115 | if (Clipperz.Crypto.ECC.BinaryField.Value._isBitSet(a, i) === true) { | ||
116 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, valueToXor); | ||
117 | } | ||
118 | valueToXor = Clipperz.Crypto.ECC.BinaryField.Value._overwriteShiftLeft(valueToXor, 1); | ||
119 | } | ||
120 | result = this._module(result); | ||
121 | |||
122 | return result; | ||
123 | }, | ||
124 | |||
125 | 'multiply': function(a, b) { | ||
126 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._multiply(a._value, b._value)); | ||
127 | }, | ||
128 | |||
129 | //----------------------------------------------------------------------------- | ||
130 | |||
131 | '_fastMultiply': function(a, b) { | ||
132 | var result; | ||
133 | var B; | ||
134 | var i,c; | ||
135 | |||
136 | result = [0]; | ||
137 | B = b.slice(0); //Is this array copy avoidable? | ||
138 | c = 32; | ||
139 | for (i=0; i<c; i++) { | ||
140 | var ii, cc; | ||
141 | |||
142 | cc = a.length; | ||
143 | for (ii=0; ii<cc; ii++) { | ||
144 | if (((a[ii] >>> i) & 0x01) == 1) { | ||
145 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, B, ii); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | if (i < (c-1)) { | ||
150 | B = Clipperz.Crypto.ECC.BinaryField.Value._overwriteShiftLeft(B, 1); | ||
151 | } | ||
152 | } | ||
153 | result = this._module(result); | ||
154 | |||
155 | return result; | ||
156 | }, | ||
157 | |||
158 | 'fastMultiply': function(a, b) { | ||
159 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._fastMultiply(a._value, b._value)); | ||
160 | }, | ||
161 | |||
162 | //----------------------------------------------------------------------------- | ||
163 | // | ||
164 | //Guide to Elliptic Curve Cryptography | ||
165 | //Darrel Hankerson, Alfred Menezes, Scott Vanstone | ||
166 | //- Pag: 49, Alorithm 2.34 | ||
167 | // | ||
168 | //----------------------------------------------------------------------------- | ||
169 | |||
170 | '_square': function(aValue) { | ||
171 | var result; | ||
172 | var value; | ||
173 | var c,i; | ||
174 | var precomputedValues; | ||
175 | |||
176 | value = aValue; | ||
177 | result = new Array(value.length * 2); | ||
178 | precomputedValues = Clipperz.Crypto.ECC.BinaryField.FiniteField.squarePrecomputedBytes; | ||
179 | |||
180 | c = value.length; | ||
181 | for (i=0; i<c; i++) { | ||
182 | result[i*2] = precomputedValues[(value[i] & 0x000000ff)]; | ||
183 | result[i*2] |= ((precomputedValues[(value[i] & 0x0000ff00) >>> 8]) << 16); | ||
184 | |||
185 | result[i*2 + 1] = precomputedValues[(value[i] & 0x00ff0000) >>> 16]; | ||
186 | result[i*2 + 1] |= ((precomputedValues[(value[i] & 0xff000000) >>> 24]) << 16); | ||
187 | } | ||
188 | |||
189 | return this._module(result); | ||
190 | }, | ||
191 | |||
192 | 'square': function(aValue) { | ||
193 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._square(aValue._value)); | ||
194 | }, | ||
195 | |||
196 | //----------------------------------------------------------------------------- | ||
197 | |||
198 | '_inverse': function(aValue) { | ||
199 | varresult; | ||
200 | var b, c; | ||
201 | var u, v; | ||
202 | |||
203 | // b = Clipperz.Crypto.ECC.BinaryField.Value.I._value; | ||
204 | b = [1]; | ||
205 | // c = Clipperz.Crypto.ECC.BinaryField.Value.O._value; | ||
206 | c = [0]; | ||
207 | u = this._module(aValue); | ||
208 | v = this.modulus()._value.slice(0); | ||
209 | |||
210 | while (Clipperz.Crypto.ECC.BinaryField.Value._bitSize(u) > 1) { | ||
211 | varbitDifferenceSize; | ||
212 | |||
213 | bitDifferenceSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(u) - Clipperz.Crypto.ECC.BinaryField.Value._bitSize(v); | ||
214 | if (bitDifferenceSize < 0) { | ||
215 | var swap; | ||
216 | |||
217 | swap = u; | ||
218 | u = v; | ||
219 | v = swap; | ||
220 | |||
221 | swap = c; | ||
222 | c = b; | ||
223 | b = swap; | ||
224 | |||
225 | bitDifferenceSize = -bitDifferenceSize; | ||
226 | } | ||
227 | |||
228 | u = this._add(u, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(v, bitDifferenceSize)); | ||
229 | b = this._add(b, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(c, bitDifferenceSize)); | ||
230 | // this._overwriteAdd(u, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(v, bitDifferenceSize)); | ||
231 | // this._overwriteAdd(b, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(c, bitDifferenceSize)); | ||
232 | } | ||
233 | |||
234 | result = this._module(b); | ||
235 | |||
236 | return result; | ||
237 | }, | ||
238 | |||
239 | 'inverse': function(aValue) { | ||
240 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._inverse(aValue._value)); | ||
241 | }, | ||
242 | |||
243 | //----------------------------------------------------------------------------- | ||
244 | __syntaxFix__: "syntax fix" | ||
245 | }); | ||
246 | |||
247 | |||
248 | Clipperz.Crypto.ECC.BinaryField.FiniteField.squarePrecomputedBytes = [ | ||
249 | 0x0000, // 0 = 0000 0000 -> 0000 0000 0000 0000 | ||
250 | 0x0001, // 1 = 0000 0001 -> 0000 0000 0000 0001 | ||
251 | 0x0004, // 2 = 0000 0010 -> 0000 0000 0000 0100 | ||
252 | 0x0005, // 3 = 0000 0011 -> 0000 0000 0000 0101 | ||
253 | 0x0010, // 4 = 0000 0100 -> 0000 0000 0001 0000 | ||
254 | 0x0011, // 5 = 0000 0101 -> 0000 0000 0001 0001 | ||
255 | 0x0014, // 6 = 0000 0110 -> 0000 0000 0001 0100 | ||
256 | 0x0015, // 7 = 0000 0111 -> 0000 0000 0001 0101 | ||
257 | 0x0040, // 8 = 0000 1000 -> 0000 0000 0100 0000 | ||
258 | 0x0041, // 9 = 0000 1001 -> 0000 0000 0100 0001 | ||
259 | 0x0044, // 10 = 0000 1010 -> 0000 0000 0100 0100 | ||
260 | 0x0045, // 11 = 0000 1011 -> 0000 0000 0100 0101 | ||
261 | 0x0050, // 12 = 0000 1100 -> 0000 0000 0101 0000 | ||
262 | 0x0051, // 13 = 0000 1101 -> 0000 0000 0101 0001 | ||
263 | 0x0054, // 14 = 0000 1110 -> 0000 0000 0101 0100 | ||
264 | 0x0055, // 15 = 0000 1111 -> 0000 0000 0101 0101 | ||
265 | |||
266 | 0x0100, // 16 = 0001 0000 -> 0000 0001 0000 0000 | ||
267 | 0x0101, // 17 = 0001 0001 -> 0000 0001 0000 0001 | ||
268 | 0x0104, // 18 = 0001 0010 -> 0000 0001 0000 0100 | ||
269 | 0x0105, // 19 = 0001 0011 -> 0000 0001 0000 0101 | ||
270 | 0x0110, // 20 = 0001 0100 -> 0000 0001 0001 0000 | ||
271 | 0x0111, // 21 = 0001 0101 -> 0000 0001 0001 0001 | ||
272 | 0x0114, // 22 = 0001 0110 -> 0000 0001 0001 0100 | ||
273 | 0x0115, // 23 = 0001 0111 -> 0000 0001 0001 0101 | ||
274 | 0x0140, // 24 = 0001 1000 -> 0000 0001 0100 0000 | ||
275 | 0x0141, // 25 = 0001 1001 -> 0000 0001 0100 0001 | ||
276 | 0x0144, // 26 = 0001 1010 -> 0000 0001 0100 0100 | ||
277 | 0x0145, // 27 = 0001 1011 -> 0000 0001 0100 0101 | ||
278 | 0x0150, // 28 = 0001 1100 -> 0000 0001 0101 0000 | ||
279 | 0x0151, // 28 = 0001 1101 -> 0000 0001 0101 0001 | ||
280 | 0x0154, // 30 = 0001 1110 -> 0000 0001 0101 0100 | ||
281 | 0x0155, // 31 = 0001 1111 -> 0000 0001 0101 0101 | ||
282 | |||
283 | 0x0400, // 32 = 0010 0000 -> 0000 0100 0000 0000 | ||
284 | 0x0401, // 33 = 0010 0001 -> 0000 0100 0000 0001 | ||
285 | 0x0404, // 34 = 0010 0010 -> 0000 0100 0000 0100 | ||
286 | 0x0405, // 35 = 0010 0011 -> 0000 0100 0000 0101 | ||
287 | 0x0410, // 36 = 0010 0100 -> 0000 0100 0001 0000 | ||
288 | 0x0411, // 37 = 0010 0101 -> 0000 0100 0001 0001 | ||
289 | 0x0414, // 38 = 0010 0110 -> 0000 0100 0001 0100 | ||
290 | 0x0415, // 39 = 0010 0111 -> 0000 0100 0001 0101 | ||
291 | 0x0440, // 40 = 0010 1000 -> 0000 0100 0100 0000 | ||
292 | 0x0441, // 41 = 0010 1001 -> 0000 0100 0100 0001 | ||
293 | 0x0444, // 42 = 0010 1010 -> 0000 0100 0100 0100 | ||
294 | 0x0445, // 43 = 0010 1011 -> 0000 0100 0100 0101 | ||
295 | 0x0450, // 44 = 0010 1100 -> 0000 0100 0101 0000 | ||
296 | 0x0451, // 45 = 0010 1101 -> 0000 0100 0101 0001 | ||
297 | 0x0454, // 46 = 0010 1110 -> 0000 0100 0101 0100 | ||
298 | 0x0455, // 47 = 0010 1111 -> 0000 0100 0101 0101 | ||
299 | |||
300 | 0x0500, // 48 = 0011 0000 -> 0000 0101 0000 0000 | ||
301 | 0x0501, // 49 = 0011 0001 -> 0000 0101 0000 0001 | ||
302 | 0x0504, // 50 = 0011 0010 -> 0000 0101 0000 0100 | ||
303 | 0x0505, // 51 = 0011 0011 -> 0000 0101 0000 0101 | ||
304 | 0x0510, // 52 = 0011 0100 -> 0000 0101 0001 0000 | ||
305 | 0x0511, // 53 = 0011 0101 -> 0000 0101 0001 0001 | ||
306 | 0x0514, // 54 = 0011 0110 -> 0000 0101 0001 0100 | ||
307 | 0x0515, // 55 = 0011 0111 -> 0000 0101 0001 0101 | ||
308 | 0x0540, // 56 = 0011 1000 -> 0000 0101 0100 0000 | ||
309 | 0x0541, // 57 = 0011 1001 -> 0000 0101 0100 0001 | ||
310 | 0x0544, // 58 = 0011 1010 -> 0000 0101 0100 0100 | ||
311 | 0x0545, // 59 = 0011 1011 -> 0000 0101 0100 0101 | ||
312 | 0x0550, // 60 = 0011 1100 -> 0000 0101 0101 0000 | ||
313 | 0x0551, // 61 = 0011 1101 -> 0000 0101 0101 0001 | ||
314 | 0x0554, // 62 = 0011 1110 -> 0000 0101 0101 0100 | ||
315 | 0x0555, // 63 = 0011 1111 -> 0000 0101 0101 0101 | ||
316 | |||
317 | 0x1000, // 64 = 0100 0000 -> 0001 0000 0000 0000 | ||
318 | 0x1001, // 65 = 0100 0001 -> 0001 0000 0000 0001 | ||
319 | 0x1004, // 66 = 0100 0010 -> 0001 0000 0000 0100 | ||
320 | 0x1005, // 67 = 0100 0011 -> 0001 0000 0000 0101 | ||
321 | 0x1010, // 68 = 0100 0100 -> 0001 0000 0001 0000 | ||
322 | 0x1011, // 69 = 0100 0101 -> 0001 0000 0001 0001 | ||
323 | 0x1014, // 70 = 0100 0110 -> 0001 0000 0001 0100 | ||
324 | 0x1015, // 71 = 0100 0111 -> 0001 0000 0001 0101 | ||
325 | 0x1040, // 72 = 0100 1000 -> 0001 0000 0100 0000 | ||
326 | 0x1041, // 73 = 0100 1001 -> 0001 0000 0100 0001 | ||
327 | 0x1044, // 74 = 0100 1010 -> 0001 0000 0100 0100 | ||
328 | 0x1045, // 75 = 0100 1011 -> 0001 0000 0100 0101 | ||
329 | 0x1050, // 76 = 0100 1100 -> 0001 0000 0101 0000 | ||
330 | 0x1051, // 77 = 0100 1101 -> 0001 0000 0101 0001 | ||
331 | 0x1054, // 78 = 0100 1110 -> 0001 0000 0101 0100 | ||
332 | 0x1055, // 79 = 0100 1111 -> 0001 0000 0101 0101 | ||
333 | |||
334 | 0x1100, // 80 = 0101 0000 -> 0001 0001 0000 0000 | ||
335 | 0x1101, // 81 = 0101 0001 -> 0001 0001 0000 0001 | ||
336 | 0x1104, // 82 = 0101 0010 -> 0001 0001 0000 0100 | ||
337 | 0x1105, // 83 = 0101 0011 -> 0001 0001 0000 0101 | ||
338 | 0x1110, // 84 = 0101 0100 -> 0001 0001 0001 0000 | ||
339 | 0x1111, // 85 = 0101 0101 -> 0001 0001 0001 0001 | ||
340 | 0x1114, // 86 = 0101 0110 -> 0001 0001 0001 0100 | ||
341 | 0x1115, // 87 = 0101 0111 -> 0001 0001 0001 0101 | ||
342 | 0x1140, // 88 = 0101 1000 -> 0001 0001 0100 0000 | ||
343 | 0x1141, // 89 = 0101 1001 -> 0001 0001 0100 0001 | ||
344 | 0x1144, // 90 = 0101 1010 -> 0001 0001 0100 0100 | ||
345 | 0x1145, // 91 = 0101 1011 -> 0001 0001 0100 0101 | ||
346 | 0x1150, // 92 = 0101 1100 -> 0001 0001 0101 0000 | ||
347 | 0x1151, // 93 = 0101 1101 -> 0001 0001 0101 0001 | ||
348 | 0x1154, // 94 = 0101 1110 -> 0001 0001 0101 0100 | ||
349 | 0x1155, // 95 = 0101 1111 -> 0001 0001 0101 0101 | ||
350 | |||
351 | 0x1400, // 96 = 0110 0000 -> 0001 0100 0000 0000 | ||
352 | 0x1401, // 97 = 0110 0001 -> 0001 0100 0000 0001 | ||
353 | 0x1404, // 98 = 0110 0010 -> 0001 0100 0000 0100 | ||
354 | 0x1405, // 99 = 0110 0011 -> 0001 0100 0000 0101 | ||
355 | 0x1410, //100 = 0110 0100 -> 0001 0100 0001 0000 | ||
356 | 0x1411, //101 = 0110 0101 -> 0001 0100 0001 0001 | ||
357 | 0x1414, //102 = 0110 0110 -> 0001 0100 0001 0100 | ||
358 | 0x1415, //103 = 0110 0111 -> 0001 0100 0001 0101 | ||
359 | 0x1440, //104 = 0110 1000 -> 0001 0100 0100 0000 | ||
360 | 0x1441, //105 = 0110 1001 -> 0001 0100 0100 0001 | ||
361 | 0x1444, //106 = 0110 1010 -> 0001 0100 0100 0100 | ||
362 | 0x1445, //107 = 0110 1011 -> 0001 0100 0100 0101 | ||
363 | 0x1450, //108 = 0110 1100 -> 0001 0100 0101 0000 | ||
364 | 0x1451, //109 = 0110 1101 -> 0001 0100 0101 0001 | ||
365 | 0x1454, //110 = 0110 1110 -> 0001 0100 0101 0100 | ||
366 | 0x1455, //111 = 0110 1111 -> 0001 0100 0101 0101 | ||
367 | |||
368 | 0x1500, //112 = 0111 0000 -> 0001 0101 0000 0000 | ||
369 | 0x1501, //113 = 0111 0001 -> 0001 0101 0000 0001 | ||
370 | 0x1504, //114 = 0111 0010 -> 0001 0101 0000 0100 | ||
371 | 0x1505, //115 = 0111 0011 -> 0001 0101 0000 0101 | ||
372 | 0x1510, //116 = 0111 0100 -> 0001 0101 0001 0000 | ||
373 | 0x1511, //117 = 0111 0101 -> 0001 0101 0001 0001 | ||
374 | 0x1514, //118 = 0111 0110 -> 0001 0101 0001 0100 | ||
375 | 0x1515, //119 = 0111 0111 -> 0001 0101 0001 0101 | ||
376 | 0x1540, //120 = 0111 1000 -> 0001 0101 0100 0000 | ||
377 | 0x1541, //121 = 0111 1001 -> 0001 0101 0100 0001 | ||
378 | 0x1544, //122 = 0111 1010 -> 0001 0101 0100 0100 | ||
379 | 0x1545, //123 = 0111 1011 -> 0001 0101 0100 0101 | ||
380 | 0x1550, //124 = 0111 1100 -> 0001 0101 0101 0000 | ||
381 | 0x1551, //125 = 0111 1101 -> 0001 0101 0101 0001 | ||
382 | 0x1554, //126 = 0111 1110 -> 0001 0101 0101 0100 | ||
383 | 0x1555, //127 = 0111 1111 -> 0001 0101 0101 0101 | ||
384 | |||
385 | 0x4000, //128 = 1000 0000 -> 0100 0000 0000 0000 | ||
386 | 0x4001, //129 = 1000 0001 -> 0100 0000 0000 0001 | ||
387 | 0x4004, //130 = 1000 0010 -> 0100 0000 0000 0100 | ||
388 | 0x4005, //131 = 1000 0011 -> 0100 0000 0000 0101 | ||
389 | 0x4010, //132 = 1000 0100 -> 0100 0000 0001 0000 | ||
390 | 0x4011, //133 = 1000 0101 -> 0100 0000 0001 0001 | ||
391 | 0x4014, //134 = 1000 0110 -> 0100 0000 0001 0100 | ||
392 | 0x4015, //135 = 1000 0111 -> 0100 0000 0001 0101 | ||
393 | 0x4040, //136 = 1000 1000 -> 0100 0000 0100 0000 | ||
394 | 0x4041, //137 = 1000 1001 -> 0100 0000 0100 0001 | ||
395 | 0x4044, //138 = 1000 1010 -> 0100 0000 0100 0100 | ||
396 | 0x4045, //139 = 1000 1011 -> 0100 0000 0100 0101 | ||
397 | 0x4050, //140 = 1000 1100 -> 0100 0000 0101 0000 | ||
398 | 0x4051, //141 = 1000 1101 -> 0100 0000 0101 0001 | ||
399 | 0x4054, //142 = 1000 1110 -> 0100 0000 0101 0100 | ||
400 | 0x4055, //143 = 1000 1111 -> 0100 0000 0101 0101 | ||
401 | |||
402 | 0x4100, //144 = 1001 0000 -> 0100 0001 0000 0000 | ||
403 | 0x4101, //145 = 1001 0001 -> 0100 0001 0000 0001 | ||
404 | 0x4104, //146 = 1001 0010 -> 0100 0001 0000 0100 | ||
405 | 0x4105, //147 = 1001 0011 -> 0100 0001 0000 0101 | ||
406 | 0x4110, //148 = 1001 0100 -> 0100 0001 0001 0000 | ||
407 | 0x4111, //149 = 1001 0101 -> 0100 0001 0001 0001 | ||
408 | 0x4114, //150 = 1001 0110 -> 0100 0001 0001 0100 | ||
409 | 0x4115, //151 = 1001 0111 -> 0100 0001 0001 0101 | ||
410 | 0x4140, //152 = 1001 1000 -> 0100 0001 0100 0000 | ||
411 | 0x4141, //153 = 1001 1001 -> 0100 0001 0100 0001 | ||
412 | 0x4144, //154 = 1001 1010 -> 0100 0001 0100 0100 | ||
413 | 0x4145, //155 = 1001 1011 -> 0100 0001 0100 0101 | ||
414 | 0x4150, //156 = 1001 1100 -> 0100 0001 0101 0000 | ||
415 | 0x4151, //157 = 1001 1101 -> 0100 0001 0101 0001 | ||
416 | 0x4154, //158 = 1001 1110 -> 0100 0001 0101 0100 | ||
417 | 0x4155, //159 = 1001 1111 -> 0100 0001 0101 0101 | ||
418 | |||
419 | 0x4400, //160 = 1010 0000 -> 0100 0100 0000 0000 | ||
420 | 0x4401, //161 = 1010 0001 -> 0100 0100 0000 0001 | ||
421 | 0x4404, //162 = 1010 0010 -> 0100 0100 0000 0100 | ||
422 | 0x4405, //163 = 1010 0011 -> 0100 0100 0000 0101 | ||
423 | 0x4410, //164 = 1010 0100 -> 0100 0100 0001 0000 | ||
424 | 0x4411, //165 = 1010 0101 -> 0100 0100 0001 0001 | ||
425 | 0x4414, //166 = 1010 0110 -> 0100 0100 0001 0100 | ||
426 | 0x4415, //167 = 1010 0111 -> 0100 0100 0001 0101 | ||
427 | 0x4440, //168 = 1010 1000 -> 0100 0100 0100 0000 | ||
428 | 0x4441, //169 = 1010 1001 -> 0100 0100 0100 0001 | ||
429 | 0x4444, //170 = 1010 1010 -> 0100 0100 0100 0100 | ||
430 | 0x4445, //171 = 1010 1011 -> 0100 0100 0100 0101 | ||
431 | 0x4450, //172 = 1010 1100 -> 0100 0100 0101 0000 | ||
432 | 0x4451, //173 = 1010 1101 -> 0100 0100 0101 0001 | ||
433 | 0x4454, //174 = 1010 1110 -> 0100 0100 0101 0100 | ||
434 | 0x4455, //175 = 1010 1111 -> 0100 0100 0101 0101 | ||
435 | |||
436 | 0x4500, //176 = 1011 0000 -> 0100 0101 0000 0000 | ||
437 | 0x4501, //177 = 1011 0001 -> 0100 0101 0000 0001 | ||
438 | 0x4504, //178 = 1011 0010 -> 0100 0101 0000 0100 | ||
439 | 0x4505, //179 = 1011 0011 -> 0100 0101 0000 0101 | ||
440 | 0x4510, //180 = 1011 0100 -> 0100 0101 0001 0000 | ||
441 | 0x4511, //181 = 1011 0101 -> 0100 0101 0001 0001 | ||
442 | 0x4514, //182 = 1011 0110 -> 0100 0101 0001 0100 | ||
443 | 0x4515, //183 = 1011 0111 -> 0100 0101 0001 0101 | ||
444 | 0x4540, //184 = 1011 1000 -> 0100 0101 0100 0000 | ||
445 | 0x4541, //185 = 1011 1001 -> 0100 0101 0100 0001 | ||
446 | 0x4544, //186 = 1011 1010 -> 0100 0101 0100 0100 | ||
447 | 0x4545, //187 = 1011 1011 -> 0100 0101 0100 0101 | ||
448 | 0x4550, //188 = 1011 1100 -> 0100 0101 0101 0000 | ||
449 | 0x4551, //189 = 1011 1101 -> 0100 0101 0101 0001 | ||
450 | 0x4554, //190 = 1011 1110 -> 0100 0101 0101 0100 | ||
451 | 0x4555, //191 = 1011 1111 -> 0100 0101 0101 0101 | ||
452 | |||
453 | 0x5000, //192 = 1100 0000 -> 0101 0000 0000 0000 | ||
454 | 0x5001, //193 = 1100 0001 -> 0101 0000 0000 0001 | ||
455 | 0x5004, //194 = 1100 0010 -> 0101 0000 0000 0100 | ||
456 | 0x5005, //195 = 1100 0011 -> 0101 0000 0000 0101 | ||
457 | 0x5010, //196 = 1100 0100 -> 0101 0000 0001 0000 | ||
458 | 0x5011, //197 = 1100 0101 -> 0101 0000 0001 0001 | ||
459 | 0x5014, //198 = 1100 0110 -> 0101 0000 0001 0100 | ||
460 | 0x5015, //199 = 1100 0111 -> 0101 0000 0001 0101 | ||
461 | 0x5040, //200 = 1100 1000 -> 0101 0000 0100 0000 | ||
462 | 0x5041, //201 = 1100 1001 -> 0101 0000 0100 0001 | ||
463 | 0x5044, //202 = 1100 1010 -> 0101 0000 0100 0100 | ||
464 | 0x5045, //203 = 1100 1011 -> 0101 0000 0100 0101 | ||
465 | 0x5050, //204 = 1100 1100 -> 0101 0000 0101 0000 | ||
466 | 0x5051, //205 = 1100 1101 -> 0101 0000 0101 0001 | ||
467 | 0x5054, //206 = 1100 1110 -> 0101 0000 0101 0100 | ||
468 | 0x5055, //207 = 1100 1111 -> 0101 0000 0101 0101 | ||
469 | |||
470 | 0x5100, //208 = 1101 0000 -> 0101 0001 0000 0000 | ||
471 | 0x5101, //209 = 1101 0001 -> 0101 0001 0000 0001 | ||
472 | 0x5104, //210 = 1101 0010 -> 0101 0001 0000 0100 | ||
473 | 0x5105, //211 = 1101 0011 -> 0101 0001 0000 0101 | ||
474 | 0x5110, //212 = 1101 0100 -> 0101 0001 0001 0000 | ||
475 | 0x5111, //213 = 1101 0101 -> 0101 0001 0001 0001 | ||
476 | 0x5114, //214 = 1101 0110 -> 0101 0001 0001 0100 | ||
477 | 0x5115, //215 = 1101 0111 -> 0101 0001 0001 0101 | ||
478 | 0x5140, //216 = 1101 1000 -> 0101 0001 0100 0000 | ||
479 | 0x5141, //217 = 1101 1001 -> 0101 0001 0100 0001 | ||
480 | 0x5144, //218 = 1101 1010 -> 0101 0001 0100 0100 | ||
481 | 0x5145, //219 = 1101 1011 -> 0101 0001 0100 0101 | ||
482 | 0x5150, //220 = 1101 1100 -> 0101 0001 0101 0000 | ||
483 | 0x5151, //221 = 1101 1101 -> 0101 0001 0101 0001 | ||
484 | 0x5154, //222 = 1101 1110 -> 0101 0001 0101 0100 | ||
485 | 0x5155, //223 = 1101 1111 -> 0101 0001 0101 0101 | ||
486 | |||
487 | 0x5400, //224 = 1110 0000 -> 0101 0100 0000 0000 | ||
488 | 0x5401, //225 = 1110 0001 -> 0101 0100 0000 0001 | ||
489 | 0x5404, //226 = 1110 0010 -> 0101 0100 0000 0100 | ||
490 | 0x5405, //227 = 1110 0011 -> 0101 0100 0000 0101 | ||
491 | 0x5410, //228 = 1110 0100 -> 0101 0100 0001 0000 | ||
492 | 0x5411, //229 = 1110 0101 -> 0101 0100 0001 0001 | ||
493 | 0x5414, //230 = 1110 0110 -> 0101 0100 0001 0100 | ||
494 | 0x5415, //231 = 1110 0111 -> 0101 0100 0001 0101 | ||
495 | 0x5440, //232 = 1110 1000 -> 0101 0100 0100 0000 | ||
496 | 0x5441, //233 = 1110 1001 -> 0101 0100 0100 0001 | ||
497 | 0x5444, //234 = 1110 1010 -> 0101 0100 0100 0100 | ||
498 | 0x5445, //235 = 1110 1011 -> 0101 0100 0100 0101 | ||
499 | 0x5450, //236 = 1110 1100 -> 0101 0100 0101 0000 | ||
500 | 0x5451, //237 = 1110 1101 -> 0101 0100 0101 0001 | ||
501 | 0x5454, //238 = 1110 1110 -> 0101 0100 0101 0100 | ||
502 | 0x5455, //239 = 1110 1111 -> 0101 0100 0101 0101 | ||
503 | |||
504 | 0x5500, //240 = 1111 0000 -> 0101 0101 0000 0000 | ||
505 | 0x5501, //241 = 1111 0001 -> 0101 0101 0000 0001 | ||
506 | 0x5504, //242 = 1111 0010 -> 0101 0101 0000 0100 | ||
507 | 0x5505, //243 = 1111 0011 -> 0101 0101 0000 0101 | ||
508 | 0x5510, //244 = 1111 0100 -> 0101 0101 0001 0000 | ||
509 | 0x5511, //245 = 1111 0101 -> 0101 0101 0001 0001 | ||
510 | 0x5514, //246 = 1111 0110 -> 0101 0101 0001 0100 | ||
511 | 0x5515, //247 = 1111 0111 -> 0101 0101 0001 0101 | ||
512 | 0x5540, //248 = 1111 1000 -> 0101 0101 0100 0000 | ||
513 | 0x5541, //249 = 1111 1001 -> 0101 0101 0100 0001 | ||
514 | 0x5544, //250 = 1111 1010 -> 0101 0101 0100 0100 | ||
515 | 0x5545, //251 = 1111 1011 -> 0101 0101 0100 0101 | ||
516 | 0x5550, //252 = 1111 1100 -> 0101 0101 0101 0000 | ||
517 | 0x5551, //253 = 1111 1101 -> 0101 0101 0101 0001 | ||
518 | 0x5554, //254 = 1111 1110 -> 0101 0101 0101 0100 | ||
519 | 0x5555 //255 = 1111 1111 -> 0101 0101 0101 0101 | ||
520 | |||
521 | ] | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Point.js b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Point.js new file mode 100644 index 0000000..fef3220 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Point.js | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | ||
26 | //} | ||
27 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | ||
28 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | ||
29 | |||
30 | Clipperz.Crypto.ECC.BinaryField.Point = function(args) { | ||
31 | args = args || {}; | ||
32 | this._x = args.x; | ||
33 | this._y = args.y; | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | Clipperz.Crypto.ECC.BinaryField.Point.prototype = MochiKit.Base.update(null, { | ||
39 | |||
40 | 'asString': function() { | ||
41 | return "Clipperz.Crypto.ECC.BinaryField.Point (" + this.x() + ", " + this.y() + ")"; | ||
42 | }, | ||
43 | |||
44 | //----------------------------------------------------------------------------- | ||
45 | |||
46 | 'x': function() { | ||
47 | return this._x; | ||
48 | }, | ||
49 | |||
50 | 'y': function() { | ||
51 | return this._y; | ||
52 | }, | ||
53 | |||
54 | //----------------------------------------------------------------------------- | ||
55 | |||
56 | 'isZero': function() { | ||
57 | return (this.x().isZero() && this.y().isZero()) | ||
58 | }, | ||
59 | |||
60 | //----------------------------------------------------------------------------- | ||
61 | __syntaxFix__: "syntax fix" | ||
62 | }); | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Value.js b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Value.js new file mode 100644 index 0000000..b046039 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/BinaryField/Value.js | |||
@@ -0,0 +1,381 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | ||
26 | //} | ||
27 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
28 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | ||
29 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | ||
30 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | ||
31 | |||
32 | Clipperz.Crypto.ECC.BinaryField.Value = function(aValue, aBase, aBitSize) { | ||
33 | if (aValue.constructor == String) { | ||
34 | varvalue; | ||
35 | varstringLength; | ||
36 | var numberOfWords; | ||
37 | vari,c; | ||
38 | |||
39 | if (aBase != 16) { | ||
40 | throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase; | ||
41 | } | ||
42 | |||
43 | value = aValue.replace(/ /g, ''); | ||
44 | stringLength = value.length; | ||
45 | numberOfWords = Math.ceil(stringLength / 8); | ||
46 | this._value = new Array(numberOfWords); | ||
47 | |||
48 | c = numberOfWords; | ||
49 | for (i=0; i<c; i++) { | ||
50 | varword; | ||
51 | |||
52 | if (i < (c-1)) { | ||
53 | word = parseInt(value.substr(stringLength-((i+1)*8), 8), 16); | ||
54 | } else { | ||
55 | word = parseInt(value.substr(0, stringLength-(i*8)), 16); | ||
56 | } | ||
57 | |||
58 | this._value[i] = word; | ||
59 | } | ||
60 | } else if (aValue.constructor == Array) { | ||
61 | var itemsToCopy; | ||
62 | |||
63 | itemsToCopy = aValue.length; | ||
64 | while (aValue[itemsToCopy - 1] == 0) { | ||
65 | itemsToCopy --; | ||
66 | } | ||
67 | |||
68 | this._value = aValue.slice(0, itemsToCopy); | ||
69 | } else if (aValue.constructor == Number) { | ||
70 | this._value = [aValue]; | ||
71 | } else { | ||
72 | // throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedConstructorValueType; | ||
73 | } | ||
74 | |||
75 | this._bitSize == aBitSize || null; | ||
76 | |||
77 | return this; | ||
78 | } | ||
79 | |||
80 | Clipperz.Crypto.ECC.BinaryField.Value.prototype = MochiKit.Base.update(null, { | ||
81 | |||
82 | 'value': function() { | ||
83 | return this._value; | ||
84 | }, | ||
85 | |||
86 | //----------------------------------------------------------------------------- | ||
87 | |||
88 | 'wordSize': function() { | ||
89 | return this._value.length | ||
90 | }, | ||
91 | |||
92 | //----------------------------------------------------------------------------- | ||
93 | |||
94 | 'clone': function() { | ||
95 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._value.slice(0), null, this._bitSize); | ||
96 | }, | ||
97 | |||
98 | //----------------------------------------------------------------------------- | ||
99 | |||
100 | 'isZero': function() { | ||
101 | return (this.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) == 0); | ||
102 | }, | ||
103 | |||
104 | //----------------------------------------------------------------------------- | ||
105 | |||
106 | 'asString': function(aBase) { | ||
107 | varresult; | ||
108 | var i,c; | ||
109 | |||
110 | if (aBase != 16) { | ||
111 | throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase; | ||
112 | } | ||
113 | |||
114 | result = ""; | ||
115 | c = this.wordSize(); | ||
116 | for (i=0; i<c; i++) { | ||
117 | varwordAsString; | ||
118 | |||
119 | // wordAsString = ("00000000" + this.value()[i].toString(16)); | ||
120 | wordAsString = ("00000000" + this._value[i].toString(16)); | ||
121 | wordAsString = wordAsString.substring(wordAsString.length - 8); | ||
122 | result = wordAsString + result; | ||
123 | } | ||
124 | |||
125 | result = result.replace(/^(00)*/, ""); | ||
126 | |||
127 | if (result == "") { | ||
128 | result = "0"; | ||
129 | } | ||
130 | |||
131 | return result; | ||
132 | }, | ||
133 | |||
134 | //----------------------------------------------------------------------------- | ||
135 | |||
136 | 'shiftLeft': function(aNumberOfBitsToShift) { | ||
137 | //this method seems like it is never called. :-( | ||
138 | return new Clipperz.Crypto.ECC.BinaryField.Value(Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this._value, aNumberOfBitsToShift)); | ||
139 | }, | ||
140 | |||
141 | //----------------------------------------------------------------------------- | ||
142 | |||
143 | 'bitSize': function() { | ||
144 | if (this._bitSize == null) { | ||
145 | this._bitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(this._value); | ||
146 | } | ||
147 | |||
148 | return this._bitSize; | ||
149 | }, | ||
150 | |||
151 | //----------------------------------------------------------------------------- | ||
152 | |||
153 | 'isBitSet': function(aBitPosition) { | ||
154 | return Clipperz.Crypto.ECC.BinaryField.Value._isBitSet(this._value, aBitPosition); | ||
155 | }, | ||
156 | |||
157 | //----------------------------------------------------------------------------- | ||
158 | |||
159 | 'xor': function(aValue) { | ||
160 | return new Clipperz.Crypto.ECC.BinaryField.Value(Clipperz.Crypto.ECC.BinaryField.Value._xor(this._value, aValue._value)); | ||
161 | }, | ||
162 | |||
163 | //----------------------------------------------------------------------------- | ||
164 | |||
165 | 'compare': function(aValue) { | ||
166 | return Clipperz.Crypto.ECC.BinaryField.Value._compare(this._value, aValue._value); | ||
167 | }, | ||
168 | |||
169 | //----------------------------------------------------------------------------- | ||
170 | __syntaxFix__: "syntax fix" | ||
171 | }); | ||
172 | |||
173 | Clipperz.Crypto.ECC.BinaryField.Value.O = new Clipperz.Crypto.ECC.BinaryField.Value('0', 16); | ||
174 | Clipperz.Crypto.ECC.BinaryField.Value.I = new Clipperz.Crypto.ECC.BinaryField.Value('1', 16); | ||
175 | |||
176 | Clipperz.Crypto.ECC.BinaryField.Value._xor = function(a, b, aFirstItemOffset) { | ||
177 | var result; | ||
178 | var resultSize; | ||
179 | var i,c; | ||
180 | var firstItemOffset; | ||
181 | |||
182 | firstItemOffset = aFirstItemOffset || 0; | ||
183 | resultSize = Math.max((a.length - firstItemOffset), b.length) + firstItemOffset; | ||
184 | |||
185 | result = new Array(resultSize); | ||
186 | |||
187 | c = firstItemOffset; | ||
188 | for (i=0; i<c; i++) { | ||
189 | result[i] = a[i]; | ||
190 | } | ||
191 | |||
192 | c = resultSize; | ||
193 | for (i=firstItemOffset; i<c; i++) { | ||
194 | result[i] = (((a[i] || 0) ^ (b[i - firstItemOffset] || 0)) >>> 0); | ||
195 | } | ||
196 | |||
197 | return result; | ||
198 | }; | ||
199 | |||
200 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor = function(a, b, aFirstItemOffset) { | ||
201 | var i,c; | ||
202 | var firstItemOffset; | ||
203 | |||
204 | firstItemOffset = aFirstItemOffset || 0; | ||
205 | |||
206 | c = Math.max((a.length - firstItemOffset), b.length) + firstItemOffset; | ||
207 | for (i=firstItemOffset; i<c; i++) { | ||
208 | a[i] = (((a[i] || 0) ^ (b[i - firstItemOffset] || 0)) >>> 0); | ||
209 | } | ||
210 | }; | ||
211 | |||
212 | Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft = function(aWordArray, aNumberOfBitsToShift) { | ||
213 | var numberOfWordsToShift; | ||
214 | varnumberOfBitsToShift; | ||
215 | var result; | ||
216 | varoverflowValue; | ||
217 | var nextOverflowValue; | ||
218 | vari,c; | ||
219 | |||
220 | numberOfWordsToShift = Math.floor(aNumberOfBitsToShift / 32); | ||
221 | numberOfBitsToShift = aNumberOfBitsToShift % 32; | ||
222 | |||
223 | result = new Array(aWordArray.length + numberOfWordsToShift); | ||
224 | |||
225 | c = numberOfWordsToShift; | ||
226 | for (i=0; i<c; i++) { | ||
227 | result[i] = 0; | ||
228 | } | ||
229 | |||
230 | overflowValue = 0; | ||
231 | nextOverflowValue = 0; | ||
232 | |||
233 | c = aWordArray.length; | ||
234 | for (i=0; i<c; i++) { | ||
235 | varvalue; | ||
236 | varresultWord; | ||
237 | |||
238 | // value = this.value()[i]; | ||
239 | value = aWordArray[i]; | ||
240 | |||
241 | if (numberOfBitsToShift > 0) { | ||
242 | nextOverflowValue = (value >>> (32 - numberOfBitsToShift)); | ||
243 | value = value & (0xffffffff >>> numberOfBitsToShift); | ||
244 | resultWord = (((value << numberOfBitsToShift) | overflowValue) >>> 0); | ||
245 | } else { | ||
246 | resultWord = value; | ||
247 | } | ||
248 | |||
249 | result[i+numberOfWordsToShift] = resultWord; | ||
250 | overflowValue = nextOverflowValue; | ||
251 | } | ||
252 | |||
253 | if (overflowValue != 0) { | ||
254 | result[aWordArray.length + numberOfWordsToShift] = overflowValue; | ||
255 | } | ||
256 | |||
257 | return result; | ||
258 | }; | ||
259 | |||
260 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteShiftLeft = function(aWordArray, aNumberOfBitsToShift) { | ||
261 | var numberOfWordsToShift; | ||
262 | varnumberOfBitsToShift; | ||
263 | var result; | ||
264 | varoverflowValue; | ||
265 | vari,c; | ||
266 | |||
267 | numberOfWordsToShift = Math.floor(aNumberOfBitsToShift / 32); | ||
268 | numberOfBitsToShift = aNumberOfBitsToShift % 32; | ||
269 | |||
270 | result = new Array(aWordArray.length + numberOfWordsToShift); | ||
271 | |||
272 | c = numberOfWordsToShift; | ||
273 | for (i=0; i<c; i++) { | ||
274 | result[i] = 0; | ||
275 | } | ||
276 | |||
277 | overflowValue = 0; | ||
278 | nextOverflowValue = 0; | ||
279 | |||
280 | c = aWordArray.length; | ||
281 | for (i=0; i<c; i++) { | ||
282 | varvalue; | ||
283 | varresultWord; | ||
284 | |||
285 | // value = this.value()[i]; | ||
286 | value = aWordArray[i]; | ||
287 | |||
288 | if (numberOfBitsToShift > 0) { | ||
289 | var nextOverflowValue; | ||
290 | |||
291 | nextOverflowValue = (value >>> (32 - numberOfBitsToShift)); | ||
292 | value = value & (0xffffffff >>> numberOfBitsToShift); | ||
293 | resultWord = (((value << numberOfBitsToShift) | overflowValue) >>> 0); | ||
294 | } else { | ||
295 | resultWord = value; | ||
296 | } | ||
297 | |||
298 | result[i+numberOfWordsToShift] = resultWord; | ||
299 | overflowValue = nextOverflowValue; | ||
300 | } | ||
301 | |||
302 | if (overflowValue != 0) { | ||
303 | result[aWordArray.length + numberOfWordsToShift] = overflowValue; | ||
304 | } | ||
305 | |||
306 | return result; | ||
307 | }; | ||
308 | |||
309 | Clipperz.Crypto.ECC.BinaryField.Value._bitSize = function(aWordArray) { | ||
310 | varresult; | ||
311 | varnotNullElements; | ||
312 | var mostValuableWord; | ||
313 | var matchingBitsInMostImportantWord; | ||
314 | var mask; | ||
315 | var i,c; | ||
316 | |||
317 | notNullElements = aWordArray.length; | ||
318 | |||
319 | if ((aWordArray.length == 1) && (aWordArray[0] == 0)) { | ||
320 | result = 0; | ||
321 | } else { | ||
322 | notNullElements --; | ||
323 | while((notNullElements > 0) && (aWordArray[notNullElements] == 0)) { | ||
324 | notNullElements --; | ||
325 | } | ||
326 | |||
327 | result = notNullElements * 32; | ||
328 | mostValuableWord = aWordArray[notNullElements]; | ||
329 | |||
330 | matchingBits = 32; | ||
331 | mask = 0x80000000; | ||
332 | |||
333 | while ((matchingBits > 0) && ((mostValuableWord & mask) == 0)) { | ||
334 | matchingBits --; | ||
335 | mask >>>= 1; | ||
336 | } | ||
337 | |||
338 | result += matchingBits; | ||
339 | } | ||
340 | |||
341 | return result; | ||
342 | }; | ||
343 | |||
344 | Clipperz.Crypto.ECC.BinaryField.Value._isBitSet = function(aWordArray, aBitPosition) { | ||
345 | var result; | ||
346 | varbyteIndex; | ||
347 | var bitIndexInSelectedByte; | ||
348 | |||
349 | byteIndex = Math.floor(aBitPosition / 32); | ||
350 | bitIndexInSelectedByte = aBitPosition % 32; | ||
351 | |||
352 | if (byteIndex <= aWordArray.length) { | ||
353 | result = ((aWordArray[byteIndex] & (1 << bitIndexInSelectedByte)) != 0); | ||
354 | } else { | ||
355 | result = false; | ||
356 | } | ||
357 | |||
358 | return result; | ||
359 | }; | ||
360 | |||
361 | Clipperz.Crypto.ECC.BinaryField.Value._compare = function(a,b) { | ||
362 | varresult; | ||
363 | var i,c; | ||
364 | |||
365 | result = MochiKit.Base.compare(a.length, b.length); | ||
366 | |||
367 | c = a.length; | ||
368 | for (i=0; (i<c) && (result==0); i++) { | ||
369 | //console.log("compare[" + c + " - " + i + " - 1] " + this.value()[c-i-1] + ", " + aValue.value()[c-i-1]); | ||
370 | // result = MochiKit.Base.compare(this.value()[c-i-1], aValue.value()[c-i-1]); | ||
371 | result = MochiKit.Base.compare(a[c-i-1], b[c-i-1]); | ||
372 | } | ||
373 | |||
374 | return result; | ||
375 | }; | ||
376 | |||
377 | |||
378 | Clipperz.Crypto.ECC.BinaryField.Value['exception']= { | ||
379 | 'UnsupportedBase': new MochiKit.Base.NamedError("Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase"), | ||
380 | 'UnsupportedConstructorValueType':new MochiKit.Base.NamedError("Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedConstructorValueType") | ||
381 | }; | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/ECC/StandardCurves.js b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/StandardCurves.js new file mode 100644 index 0000000..ed971ae --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/ECC/StandardCurves.js | |||
@@ -0,0 +1,234 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | //try { if (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) == 'undefined') { throw ""; }} catch (e) { | ||
25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.BinaryField.Curve!"; | ||
26 | //} | ||
27 | //try { if (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) == 'undefined') { throw ""; }} catch (e) { | ||
28 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.Koblitz.Curve!"; | ||
29 | //} | ||
30 | |||
31 | Clipperz.Crypto.ECC.StandardCurves = {}; | ||
32 | |||
33 | MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | ||
34 | |||
35 | //============================================================================== | ||
36 | |||
37 | '_K571': null, | ||
38 | 'K571': function() { //f(z) = z^571 + z^10 + z^5 + z^2 + 1 | ||
39 | if ((Clipperz.Crypto.ECC.StandardCurves._K571 == null) && (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) != 'undefined')) { | ||
40 | Clipperz.Crypto.ECC.StandardCurves._K571 = new Clipperz.Crypto.ECC.Koblitz.Curve({ | ||
41 | modulus: new Clipperz.Crypto.ECC.Koblitz.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000425', 16), | ||
42 | a: new Clipperz.Crypto.ECC.Koblitz.Value('0', 16), | ||
43 | b: new Clipperz.Crypto.ECC.Koblitz.Value('1', 16), | ||
44 | G: new Clipperz.Crypto.ECC.Koblitz.Point({ | ||
45 | x: new Clipperz.Crypto.ECC.Koblitz.Value('026eb7a8 59923fbc 82189631 f8103fe4 ac9ca297 0012d5d4 60248048 01841ca4 43709584 93b205e6 47da304d b4ceb08c bbd1ba39 494776fb 988b4717 4dca88c7 e2945283 a01c8972', 16), | ||
46 | y: new Clipperz.Crypto.ECC.Koblitz.Value('0349dc80 7f4fbf37 4f4aeade 3bca9531 4dd58cec 9f307a54 ffc61efc 006d8a2c 9d4979c0 ac44aea7 4fbebbb9 f772aedc b620b01a 7ba7af1b 320430c8 591984f6 01cd4c14 3ef1c7a3', 16) | ||
47 | }), | ||
48 | r: new Clipperz.Crypto.ECC.Koblitz.Value('02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850e1 f19a63e4 b391a8db 917f4138 b630d84b e5d63938 1e91deb4 5cfe778f 637c1001', 16), | ||
49 | h: new Clipperz.Crypto.ECC.Koblitz.Value('4', 16), | ||
50 | primeFactor: new Clipperz.Crypto.ECC.Koblitz.Value('02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850e1 f19a63e4 b391a8db 917f4138 b630d84b e5d63938 1e91deb4 5cfe778f 637c1001', 16) | ||
51 | }); | ||
52 | } | ||
53 | |||
54 | return Clipperz.Crypto.ECC.StandardCurves._K571; | ||
55 | }, | ||
56 | |||
57 | //----------------------------------------------------------------------------- | ||
58 | |||
59 | '_K283': null, | ||
60 | 'K283': function() { //f(z) = z^283 + z^12 + z^7 + z^5 + 1 | ||
61 | if ((Clipperz.Crypto.ECC.StandardCurves._K283 == null) && (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) != 'undefined')) { | ||
62 | Clipperz.Crypto.ECC.StandardCurves._K283 = new Clipperz.Crypto.ECC.Koblitz.Curve({ | ||
63 | modulus: new Clipperz.Crypto.ECC.Koblitz.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16), | ||
64 | a: new Clipperz.Crypto.ECC.Koblitz.Value('0', 16), | ||
65 | b: new Clipperz.Crypto.ECC.Koblitz.Value('1', 16), | ||
66 | G: new Clipperz.Crypto.ECC.Koblitz.Point({ | ||
67 | x: new Clipperz.Crypto.ECC.Koblitz.Value('0503213f 78ca4488 3f1a3b81 62f188e5 53cd265f 23c1567a 16876913 b0c2ac24 58492836', 16), | ||
68 | y: new Clipperz.Crypto.ECC.Koblitz.Value('01ccda38 0f1c9e31 8d90f95d 07e5426f e87e45c0 e8184698 e4596236 4e341161 77dd2259', 16) | ||
69 | }), | ||
70 | r: new Clipperz.Crypto.ECC.Koblitz.Value('01ffffff ffffffff ffffffff ffffffff ffffe9ae 2ed07577 265dff7f 94451e06 1e163c61', 16), | ||
71 | h: new Clipperz.Crypto.ECC.Koblitz.Value('4', 16), | ||
72 | primeFactor: new Clipperz.Crypto.ECC.Koblitz.Value('01ffffff ffffffff ffffffff ffffffff ffffe9ae 2ed07577 265dff7f 94451e06 1e163c61', 16) | ||
73 | }); | ||
74 | } | ||
75 | |||
76 | return Clipperz.Crypto.ECC.StandardCurves._K283; | ||
77 | }, | ||
78 | |||
79 | //============================================================================== | ||
80 | |||
81 | '_B571': null, | ||
82 | 'B571': function() { //f(z) = z^571 + z^10 + z^5 + z^2 + 1 | ||
83 | if ((Clipperz.Crypto.ECC.StandardCurves._B571 == null) && (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) != 'undefined')) { | ||
84 | Clipperz.Crypto.ECC.StandardCurves._B571 = new Clipperz.Crypto.ECC.BinaryField.Curve({ | ||
85 | modulus: new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000425', 16), | ||
86 | a: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16), | ||
87 | b: new Clipperz.Crypto.ECC.BinaryField.Value('02f40e7e 2221f295 de297117 b7f3d62f 5c6a97ff cb8ceff1 cd6ba8ce 4a9a18ad 84ffabbd 8efa5933 2be7ad67 56a66e29 4afd185a 78ff12aa 520e4de7 39baca0c 7ffeff7f 2955727a', 16), | ||
88 | G: new Clipperz.Crypto.ECC.BinaryField.Point({ | ||
89 | x: new Clipperz.Crypto.ECC.BinaryField.Value('0303001d 34b85629 6c16c0d4 0d3cd775 0a93d1d2 955fa80a a5f40fc8 db7b2abd bde53950 f4c0d293 cdd711a3 5b67fb14 99ae6003 8614f139 4abfa3b4 c850d927 e1e7769c 8eec2d19', 16), | ||
90 | y: new Clipperz.Crypto.ECC.BinaryField.Value('037bf273 42da639b 6dccfffe b73d69d7 8c6c27a6 009cbbca 1980f853 3921e8a6 84423e43 bab08a57 6291af8f 461bb2a8 b3531d2f 0485c19b 16e2f151 6e23dd3c 1a4827af 1b8ac15b', 16) | ||
91 | }), | ||
92 | r: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff e661ce18 ff559873 08059b18 6823851e c7dd9ca1 161de93d 5174d66e 8382e9bb 2fe84e47', 16), | ||
93 | h: new Clipperz.Crypto.ECC.BinaryField.Value('2', 16) | ||
94 | |||
95 | // S: new Clipperz.Crypto.ECC.BinaryField.Value('2aa058f73a0e33ab486b0f610410c53a7f132310', 10), | ||
96 | // n: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47', 16) | ||
97 | }); | ||
98 | |||
99 | //----------------------------------------------------------------------------- | ||
100 | // | ||
101 | //Guide to Elliptic Curve Cryptography | ||
102 | //Darrel Hankerson, Alfred Menezes, Scott Vanstone | ||
103 | //- Pag: 56, Alorithm 2.45 (with a typo!!!) | ||
104 | // | ||
105 | //----------------------------------------------------------------------------- | ||
106 | // | ||
107 | // http://www.milw0rm.com/papers/136 | ||
108 | // | ||
109 | // ------------------------------------------------------------------------- | ||
110 | // Polynomial Reduction Algorithm Modulo f571 | ||
111 | // ------------------------------------------------------------------------- | ||
112 | // | ||
113 | // Input: Polynomial p(x) of degree 1140 or less, stored as | ||
114 | // an array of 2T machinewords. | ||
115 | // Output: p(x) mod f571(x) | ||
116 | // | ||
117 | // FOR i = T-1, ..., 0 DO | ||
118 | // SET X := P[i+T] | ||
119 | // P[i] := P[i] ^ (X<<5) ^ (X<<7) ^ (X<<10) ^ (X<<15) | ||
120 | // P[i+1] := P[i+1] ^ (X>>17) ^ (X>>22) ^ (X>>25) ^ (X>>27) | ||
121 | // | ||
122 | // SET X := P[T-1] >> 27 | ||
123 | // P[0] := P[0] ^ X ^ (X<<2) ^ (X<<5) ^ (X<<10) | ||
124 | // P[T-1] := P[T-1] & 0x07ffffff | ||
125 | // | ||
126 | // RETURN P[T-1],...,P[0] | ||
127 | // | ||
128 | // ------------------------------------------------------------------------- | ||
129 | // | ||
130 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; | ||
131 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { | ||
132 | varresult; | ||
133 | |||
134 | if (aValue.bitSize() > 1140) { | ||
135 | MochiKit.Logging.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); | ||
136 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); | ||
137 | } else { | ||
138 | varC, T; | ||
139 | var i; | ||
140 | |||
141 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
142 | // C = aValue.value().slice(0); | ||
143 | C = aValue._value.slice(0); | ||
144 | for (i=35; i>=18; i--) { | ||
145 | T = C[i]; | ||
146 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); | ||
147 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); | ||
148 | } | ||
149 | T = (C[17] >>> 27); | ||
150 | C[0] = ((C[0] ^ T ^ ((T<<2) ^ (T<<5) ^ (T<<10)) & 0xffffffff) >>> 0); | ||
151 | C[17] = (C[17] & 0x07ffffff); | ||
152 | |||
153 | for(i=18; i<=35; i++) { | ||
154 | C[i] = 0; | ||
155 | } | ||
156 | |||
157 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | ||
158 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
159 | } | ||
160 | |||
161 | return result; | ||
162 | }; | ||
163 | } | ||
164 | |||
165 | return Clipperz.Crypto.ECC.StandardCurves._B571; | ||
166 | }, | ||
167 | |||
168 | //----------------------------------------------------------------------------- | ||
169 | |||
170 | '_B283': null, | ||
171 | 'B283': function() { //f(z) = z^283 + z^12 + z^7 + z^5 + 1 | ||
172 | if ((Clipperz.Crypto.ECC.StandardCurves._B283 == null) && (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) != 'undefined')) { | ||
173 | Clipperz.Crypto.ECC.StandardCurves._B283 = new Clipperz.Crypto.ECC.BinaryField.Curve({ | ||
174 | modulus: new Clipperz.Crypto.ECC.BinaryField.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16), | ||
175 | a: new Clipperz.Crypto.ECC.BinaryField.Value('1', 16), | ||
176 | b: new Clipperz.Crypto.ECC.BinaryField.Value('027b680a c8b8596d a5a4af8a 19a0303f ca97fd76 45309fa2 a581485a f6263e31 3b79a2f5', 16), | ||
177 | G: new Clipperz.Crypto.ECC.BinaryField.Point({ | ||
178 | x: new Clipperz.Crypto.ECC.BinaryField.Value('05f93925 8db7dd90 e1934f8c 70b0dfec 2eed25b8 557eac9c 80e2e198 f8cdbecd 86b12053', 16), | ||
179 | y: new Clipperz.Crypto.ECC.BinaryField.Value('03676854 fe24141c b98fe6d4 b20d02b4 516ff702 350eddb0 826779c8 13f0df45 be8112f4', 16) | ||
180 | }), | ||
181 | r: new Clipperz.Crypto.ECC.BinaryField.Value('03ffffff ffffffff ffffffff ffffffff ffffef90 399660fc 938a9016 5b042a7c efadb307', 16), | ||
182 | h: new Clipperz.Crypto.ECC.BinaryField.Value('2', 16) | ||
183 | }); | ||
184 | |||
185 | //----------------------------------------------------------------------------- | ||
186 | // | ||
187 | //Guide to Elliptic Curve Cryptography | ||
188 | //Darrel Hankerson, Alfred Menezes, Scott Vanstone | ||
189 | //- Pag: 56, Alorithm 2.43 | ||
190 | // | ||
191 | //----------------------------------------------------------------------------- | ||
192 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; | ||
193 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { | ||
194 | varresult; | ||
195 | |||
196 | if (aValue.bitSize() > 564) { | ||
197 | MochiKit.Logging.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); | ||
198 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); | ||
199 | } else { | ||
200 | varC, T; | ||
201 | var i; | ||
202 | |||
203 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
204 | C = aValue._value.slice(0); | ||
205 | for (i=17; i>=9; i--) { | ||
206 | T = C[i]; | ||
207 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); | ||
208 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); | ||
209 | } | ||
210 | T = (C[8] >>> 27); | ||
211 | C[0] = ((C[0] ^ T ^ ((T<<5) ^ (T<<7) ^ (T<<12)) & 0xffffffff) >>> 0); | ||
212 | C[8] = (C[8] & 0x07ffffff); | ||
213 | |||
214 | for(i=9; i<=17; i++) { | ||
215 | C[i] = 0; | ||
216 | } | ||
217 | |||
218 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | ||
219 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
220 | } | ||
221 | |||
222 | return result; | ||
223 | }; | ||
224 | } | ||
225 | |||
226 | return Clipperz.Crypto.ECC.StandardCurves._B283; | ||
227 | }, | ||
228 | |||
229 | //============================================================================== | ||
230 | __syntaxFix__: "syntax fix" | ||
231 | }); | ||
232 | |||
233 | |||
234 | |||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/PRNG.js b/frontend/gamma/js/ClipperzCryptoLibrary/PRNG.js new file mode 100644 index 0000000..18cc260 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/PRNG.js | |||
@@ -0,0 +1,850 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | ||
26 | } | ||
27 | |||
28 | try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { | ||
29 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!"; | ||
30 | } | ||
31 | |||
32 | try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) { | ||
33 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!"; | ||
34 | } | ||
35 | |||
36 | if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; } | ||
37 | |||
38 | //############################################################################# | ||
39 | |||
40 | Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) { | ||
41 | args = args || {}; | ||
42 | //MochiKit.Base.bindMethods(this); | ||
43 | |||
44 | this._stack = new Clipperz.ByteArray(); | ||
45 | this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256; | ||
46 | return this; | ||
47 | } | ||
48 | |||
49 | Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, { | ||
50 | |||
51 | 'toString': function() { | ||
52 | return "Clipperz.Crypto.PRNG.EntropyAccumulator"; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'stack': function() { | ||
58 | return this._stack; | ||
59 | }, | ||
60 | |||
61 | 'setStack': function(aValue) { | ||
62 | this._stack = aValue; | ||
63 | }, | ||
64 | |||
65 | 'resetStack': function() { | ||
66 | this.stack().reset(); | ||
67 | }, | ||
68 | |||
69 | 'maxStackLengthBeforeHashing': function() { | ||
70 | return this._maxStackLengthBeforeHashing; | ||
71 | }, | ||
72 | |||
73 | //------------------------------------------------------------------------- | ||
74 | |||
75 | 'addRandomByte': function(aValue) { | ||
76 | this.stack().appendByte(aValue); | ||
77 | |||
78 | if (this.stack().length() > this.maxStackLengthBeforeHashing()) { | ||
79 | this.setStack(Clipperz.Crypto.SHA.sha_d256(this.stack())); | ||
80 | } | ||
81 | }, | ||
82 | |||
83 | //------------------------------------------------------------------------- | ||
84 | __syntaxFix__: "syntax fix" | ||
85 | }); | ||
86 | |||
87 | //############################################################################# | ||
88 | |||
89 | Clipperz.Crypto.PRNG.RandomnessSource = function(args) { | ||
90 | args = args || {}; | ||
91 | MochiKit.Base.bindMethods(this); | ||
92 | |||
93 | this._generator = args.generator || null; | ||
94 | this._sourceId = args.sourceId || null; | ||
95 | this._boostMode = args.boostMode || false; | ||
96 | |||
97 | this._nextPoolIndex = 0; | ||
98 | |||
99 | return this; | ||
100 | } | ||
101 | |||
102 | Clipperz.Crypto.PRNG.RandomnessSource.prototype = MochiKit.Base.update(null, { | ||
103 | |||
104 | 'generator': function() { | ||
105 | return this._generator; | ||
106 | }, | ||
107 | |||
108 | 'setGenerator': function(aValue) { | ||
109 | this._generator = aValue; | ||
110 | }, | ||
111 | |||
112 | //------------------------------------------------------------------------- | ||
113 | |||
114 | 'boostMode': function() { | ||
115 | return this._boostMode; | ||
116 | }, | ||
117 | |||
118 | 'setBoostMode': function(aValue) { | ||
119 | this._boostMode = aValue; | ||
120 | }, | ||
121 | |||
122 | //------------------------------------------------------------------------- | ||
123 | |||
124 | 'sourceId': function() { | ||
125 | return this._sourceId; | ||
126 | }, | ||
127 | |||
128 | 'setSourceId': function(aValue) { | ||
129 | this._sourceId = aValue; | ||
130 | }, | ||
131 | |||
132 | //------------------------------------------------------------------------- | ||
133 | |||
134 | 'nextPoolIndex': function() { | ||
135 | return this._nextPoolIndex; | ||
136 | }, | ||
137 | |||
138 | 'incrementNextPoolIndex': function() { | ||
139 | this._nextPoolIndex = ((this._nextPoolIndex + 1) % this.generator().numberOfEntropyAccumulators()); | ||
140 | }, | ||
141 | |||
142 | //------------------------------------------------------------------------- | ||
143 | |||
144 | 'updateGeneratorWithValue': function(aRandomValue) { | ||
145 | if (this.generator() != null) { | ||
146 | this.generator().addRandomByte(this.sourceId(), this.nextPoolIndex(), aRandomValue); | ||
147 | this.incrementNextPoolIndex(); | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | //------------------------------------------------------------------------- | ||
152 | __syntaxFix__: "syntax fix" | ||
153 | }); | ||
154 | |||
155 | //############################################################################# | ||
156 | |||
157 | Clipperz.Crypto.PRNG.TimeRandomnessSource = function(args) { | ||
158 | args = args || {}; | ||
159 | //MochiKit.Base.bindMethods(this); | ||
160 | |||
161 | this._intervalTime = args.intervalTime || 1000; | ||
162 | |||
163 | Clipperz.Crypto.PRNG.RandomnessSource.call(this, args); | ||
164 | |||
165 | this.collectEntropy(); | ||
166 | return this; | ||
167 | } | ||
168 | |||
169 | Clipperz.Crypto.PRNG.TimeRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, { | ||
170 | |||
171 | 'intervalTime': function() { | ||
172 | return this._intervalTime; | ||
173 | }, | ||
174 | |||
175 | //------------------------------------------------------------------------- | ||
176 | |||
177 | 'collectEntropy': function() { | ||
178 | varnow; | ||
179 | varentropyByte; | ||
180 | var intervalTime; | ||
181 | now = new Date(); | ||
182 | entropyByte = (now.getTime() & 0xff); | ||
183 | |||
184 | intervalTime = this.intervalTime(); | ||
185 | if (this.boostMode() == true) { | ||
186 | intervalTime = intervalTime / 9; | ||
187 | } | ||
188 | |||
189 | this.updateGeneratorWithValue(entropyByte); | ||
190 | setTimeout(this.collectEntropy, intervalTime); | ||
191 | }, | ||
192 | |||
193 | //------------------------------------------------------------------------- | ||
194 | |||
195 | 'numberOfRandomBits': function() { | ||
196 | return 5; | ||
197 | }, | ||
198 | |||
199 | //------------------------------------------------------------------------- | ||
200 | |||
201 | 'pollingFrequency': function() { | ||
202 | return 10; | ||
203 | }, | ||
204 | |||
205 | //------------------------------------------------------------------------- | ||
206 | __syntaxFix__: "syntax fix" | ||
207 | }); | ||
208 | |||
209 | //***************************************************************************** | ||
210 | |||
211 | Clipperz.Crypto.PRNG.MouseRandomnessSource = function(args) { | ||
212 | args = args || {}; | ||
213 | |||
214 | Clipperz.Crypto.PRNG.RandomnessSource.call(this, args); | ||
215 | |||
216 | this._numberOfBitsToCollectAtEachEvent = 4; | ||
217 | this._randomBitsCollector = 0; | ||
218 | this._numberOfRandomBitsCollected = 0; | ||
219 | |||
220 | MochiKit.Signal.connect(document, 'onmousemove', this, 'collectEntropy'); | ||
221 | |||
222 | return this; | ||
223 | } | ||
224 | |||
225 | Clipperz.Crypto.PRNG.MouseRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, { | ||
226 | |||
227 | //------------------------------------------------------------------------- | ||
228 | |||
229 | 'numberOfBitsToCollectAtEachEvent': function() { | ||
230 | return this._numberOfBitsToCollectAtEachEvent; | ||
231 | }, | ||
232 | |||
233 | //------------------------------------------------------------------------- | ||
234 | |||
235 | 'randomBitsCollector': function() { | ||
236 | return this._randomBitsCollector; | ||
237 | }, | ||
238 | |||
239 | 'setRandomBitsCollector': function(aValue) { | ||
240 | this._randomBitsCollector = aValue; | ||
241 | }, | ||
242 | |||
243 | 'appendRandomBitsToRandomBitsCollector': function(aValue) { | ||
244 | var collectedBits; | ||
245 | var numberOfRandomBitsCollected; | ||
246 | |||
247 | numberOfRandomBitsCollected = this.numberOfRandomBitsCollected(); | ||
248 | collectetBits = this.randomBitsCollector() | (aValue << numberOfRandomBitsCollected); | ||
249 | this.setRandomBitsCollector(collectetBits); | ||
250 | numberOfRandomBitsCollected += this.numberOfBitsToCollectAtEachEvent(); | ||
251 | |||
252 | if (numberOfRandomBitsCollected == 8) { | ||
253 | this.updateGeneratorWithValue(collectetBits); | ||
254 | numberOfRandomBitsCollected = 0; | ||
255 | this.setRandomBitsCollector(0); | ||
256 | } | ||
257 | |||
258 | this.setNumberOfRandomBitsCollected(numberOfRandomBitsCollected) | ||
259 | }, | ||
260 | |||
261 | //------------------------------------------------------------------------- | ||
262 | |||
263 | 'numberOfRandomBitsCollected': function() { | ||
264 | return this._numberOfRandomBitsCollected; | ||
265 | }, | ||
266 | |||
267 | 'setNumberOfRandomBitsCollected': function(aValue) { | ||
268 | this._numberOfRandomBitsCollected = aValue; | ||
269 | }, | ||
270 | |||
271 | //------------------------------------------------------------------------- | ||
272 | |||
273 | 'collectEntropy': function(anEvent) { | ||
274 | var mouseLocation; | ||
275 | var randomBit; | ||
276 | var mask; | ||
277 | |||
278 | mask = 0xffffffff >>> (32 - this.numberOfBitsToCollectAtEachEvent()); | ||
279 | |||
280 | mouseLocation = anEvent.mouse().client; | ||
281 | randomBit = ((mouseLocation.x ^ mouseLocation.y) & mask); | ||
282 | this.appendRandomBitsToRandomBitsCollector(randomBit) | ||
283 | }, | ||
284 | |||
285 | //------------------------------------------------------------------------- | ||
286 | |||
287 | 'numberOfRandomBits': function() { | ||
288 | return 1; | ||
289 | }, | ||
290 | |||
291 | //------------------------------------------------------------------------- | ||
292 | |||
293 | 'pollingFrequency': function() { | ||
294 | return 10; | ||
295 | }, | ||
296 | |||
297 | //------------------------------------------------------------------------- | ||
298 | __syntaxFix__: "syntax fix" | ||
299 | }); | ||
300 | |||
301 | //***************************************************************************** | ||
302 | |||
303 | Clipperz.Crypto.PRNG.KeyboardRandomnessSource = function(args) { | ||
304 | args = args || {}; | ||
305 | Clipperz.Crypto.PRNG.RandomnessSource.call(this, args); | ||
306 | |||
307 | this._randomBitsCollector = 0; | ||
308 | this._numberOfRandomBitsCollected = 0; | ||
309 | |||
310 | MochiKit.Signal.connect(document, 'onkeypress', this, 'collectEntropy'); | ||
311 | |||
312 | return this; | ||
313 | } | ||
314 | |||
315 | Clipperz.Crypto.PRNG.KeyboardRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, { | ||
316 | |||
317 | //------------------------------------------------------------------------- | ||
318 | |||
319 | 'randomBitsCollector': function() { | ||
320 | return this._randomBitsCollector; | ||
321 | }, | ||
322 | |||
323 | 'setRandomBitsCollector': function(aValue) { | ||
324 | this._randomBitsCollector = aValue; | ||
325 | }, | ||
326 | |||
327 | 'appendRandomBitToRandomBitsCollector': function(aValue) { | ||
328 | var collectedBits; | ||
329 | var numberOfRandomBitsCollected; | ||
330 | |||
331 | numberOfRandomBitsCollected = this.numberOfRandomBitsCollected(); | ||
332 | collectetBits = this.randomBitsCollector() | (aValue << numberOfRandomBitsCollected); | ||
333 | this.setRandomBitsCollector(collectetBits); | ||
334 | numberOfRandomBitsCollected ++; | ||
335 | |||
336 | if (numberOfRandomBitsCollected == 8) { | ||
337 | this.updateGeneratorWithValue(collectetBits); | ||
338 | numberOfRandomBitsCollected = 0; | ||
339 | this.setRandomBitsCollector(0); | ||
340 | } | ||
341 | |||
342 | this.setNumberOfRandomBitsCollected(numberOfRandomBitsCollected) | ||
343 | }, | ||
344 | |||
345 | //------------------------------------------------------------------------- | ||
346 | |||
347 | 'numberOfRandomBitsCollected': function() { | ||
348 | return this._numberOfRandomBitsCollected; | ||
349 | }, | ||
350 | |||
351 | 'setNumberOfRandomBitsCollected': function(aValue) { | ||
352 | this._numberOfRandomBitsCollected = aValue; | ||
353 | }, | ||
354 | |||
355 | //------------------------------------------------------------------------- | ||
356 | |||
357 | 'collectEntropy': function(anEvent) { | ||
358 | /* | ||
359 | var mouseLocation; | ||
360 | var randomBit; | ||
361 | |||
362 | mouseLocation = anEvent.mouse().client; | ||
363 | |||
364 | randomBit = ((mouseLocation.x ^ mouseLocation.y) & 0x1); | ||
365 | this.appendRandomBitToRandomBitsCollector(randomBit); | ||
366 | */ | ||
367 | }, | ||
368 | |||
369 | //------------------------------------------------------------------------- | ||
370 | |||
371 | 'numberOfRandomBits': function() { | ||
372 | return 1; | ||
373 | }, | ||
374 | |||
375 | //------------------------------------------------------------------------- | ||
376 | |||
377 | 'pollingFrequency': function() { | ||
378 | return 10; | ||
379 | }, | ||
380 | |||
381 | //------------------------------------------------------------------------- | ||
382 | __syntaxFix__: "syntax fix" | ||
383 | }); | ||
384 | |||
385 | //############################################################################# | ||
386 | |||
387 | Clipperz.Crypto.PRNG.Fortuna = function(args) { | ||
388 | vari,c; | ||
389 | |||
390 | args = args || {}; | ||
391 | |||
392 | this._key = args.seed || null; | ||
393 | if (this._key == null) { | ||
394 | this._counter = 0; | ||
395 | this._key = new Clipperz.ByteArray(); | ||
396 | } else { | ||
397 | this._counter = 1; | ||
398 | } | ||
399 | |||
400 | this._aesKey = null; | ||
401 | |||
402 | this._firstPoolReseedLevel = args.firstPoolReseedLevel || 32 || 64; | ||
403 | this._numberOfEntropyAccumulators = args.numberOfEntropyAccumulators || 32; | ||
404 | |||
405 | this._accumulators = []; | ||
406 | c = this.numberOfEntropyAccumulators(); | ||
407 | for (i=0; i<c; i++) { | ||
408 | this._accumulators.push(new Clipperz.Crypto.PRNG.EntropyAccumulator()); | ||
409 | } | ||
410 | |||
411 | this._randomnessSources = []; | ||
412 | this._reseedCounter = 0; | ||
413 | |||
414 | return this; | ||
415 | } | ||
416 | |||
417 | Clipperz.Crypto.PRNG.Fortuna.prototype = MochiKit.Base.update(null, { | ||
418 | |||
419 | 'toString': function() { | ||
420 | return "Clipperz.Crypto.PRNG.Fortuna"; | ||
421 | }, | ||
422 | |||
423 | //------------------------------------------------------------------------- | ||
424 | |||
425 | 'key': function() { | ||
426 | return this._key; | ||
427 | }, | ||
428 | |||
429 | 'setKey': function(aValue) { | ||
430 | this._key = aValue; | ||
431 | this._aesKey = null; | ||
432 | }, | ||
433 | |||
434 | 'aesKey': function() { | ||
435 | if (this._aesKey == null) { | ||
436 | this._aesKey = new Clipperz.Crypto.AES.Key({key:this.key()}); | ||
437 | } | ||
438 | |||
439 | return this._aesKey; | ||
440 | }, | ||
441 | |||
442 | 'accumulators': function() { | ||
443 | return this._accumulators; | ||
444 | }, | ||
445 | |||
446 | 'firstPoolReseedLevel': function() { | ||
447 | return this._firstPoolReseedLevel; | ||
448 | }, | ||
449 | |||
450 | //------------------------------------------------------------------------- | ||
451 | |||
452 | 'reseedCounter': function() { | ||
453 | return this._reseedCounter; | ||
454 | }, | ||
455 | |||
456 | 'incrementReseedCounter': function() { | ||
457 | this._reseedCounter = this._reseedCounter +1; | ||
458 | }, | ||
459 | |||
460 | //------------------------------------------------------------------------- | ||
461 | |||
462 | 'reseed': function() { | ||
463 | varnewKeySeed; | ||
464 | var reseedCounter; | ||
465 | varreseedCounterMask; | ||
466 | var i, c; | ||
467 | |||
468 | newKeySeed = this.key(); | ||
469 | this.incrementReseedCounter(); | ||
470 | reseedCounter = this.reseedCounter(); | ||
471 | |||
472 | c = this.numberOfEntropyAccumulators(); | ||
473 | reseedCounterMask = 0xffffffff >>> (32 - c); | ||
474 | for (i=0; i<c; i++) { | ||
475 | if ((i == 0) || ((reseedCounter & (reseedCounterMask >>> (c - i))) == 0)) { | ||
476 | newKeySeed.appendBlock(this.accumulators()[i].stack()); | ||
477 | this.accumulators()[i].resetStack(); | ||
478 | } | ||
479 | } | ||
480 | |||
481 | if (reseedCounter == 1) { | ||
482 | c = this.randomnessSources().length; | ||
483 | for (i=0; i<c; i++) { | ||
484 | this.randomnessSources()[i].setBoostMode(false); | ||
485 | } | ||
486 | } | ||
487 | |||
488 | this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed)); | ||
489 | if (reseedCounter == 1) { | ||
490 | //MochiKit.Logging.logDebug("### PRNG.readyToGenerateRandomBytes"); | ||
491 | Clipperz.log("### PRNG.readyToGenerateRandomBytes"); | ||
492 | MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); | ||
493 | } | ||
494 | MochiKit.Signal.signal(this, 'reseeded'); | ||
495 | }, | ||
496 | |||
497 | //------------------------------------------------------------------------- | ||
498 | |||
499 | 'isReadyToGenerateRandomValues': function() { | ||
500 | return this.reseedCounter() != 0; | ||
501 | }, | ||
502 | |||
503 | //------------------------------------------------------------------------- | ||
504 | |||
505 | 'entropyLevel': function() { | ||
506 | return this.accumulators()[0].stack().length() + (this.reseedCounter() * this.firstPoolReseedLevel()); | ||
507 | }, | ||
508 | |||
509 | //------------------------------------------------------------------------- | ||
510 | |||
511 | 'counter': function() { | ||
512 | return this._counter; | ||
513 | }, | ||
514 | |||
515 | 'incrementCounter': function() { | ||
516 | this._counter += 1; | ||
517 | }, | ||
518 | |||
519 | 'counterBlock': function() { | ||
520 | var result; | ||
521 | |||
522 | result = new Clipperz.ByteArray().appendWords(this.counter(), 0, 0, 0); | ||
523 | |||
524 | return result; | ||
525 | }, | ||
526 | |||
527 | //------------------------------------------------------------------------- | ||
528 | |||
529 | 'getRandomBlock': function() { | ||
530 | var result; | ||
531 | |||
532 | result = new Clipperz.ByteArray(Clipperz.Crypto.AES.encryptBlock(this.aesKey(), this.counterBlock().arrayValues())); | ||
533 | this.incrementCounter(); | ||
534 | |||
535 | return result; | ||
536 | }, | ||
537 | |||
538 | //------------------------------------------------------------------------- | ||
539 | |||
540 | 'getRandomBytes': function(aSize) { | ||
541 | var result; | ||
542 | |||
543 | if (this.isReadyToGenerateRandomValues()) { | ||
544 | var i,c; | ||
545 | var newKey; | ||
546 | |||
547 | result = new Clipperz.ByteArray(); | ||
548 | |||
549 | c = Math.ceil(aSize / (128 / 8)); | ||
550 | for (i=0; i<c; i++) { | ||
551 | result.appendBlock(this.getRandomBlock()); | ||
552 | } | ||
553 | |||
554 | if (result.length() != aSize) { | ||
555 | result = result.split(0, aSize); | ||
556 | } | ||
557 | |||
558 | newKey = this.getRandomBlock().appendBlock(this.getRandomBlock()); | ||
559 | this.setKey(newKey); | ||
560 | } else { | ||
561 | MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!"); | ||
562 | throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy; | ||
563 | } | ||
564 | |||
565 | return result; | ||
566 | }, | ||
567 | |||
568 | //------------------------------------------------------------------------- | ||
569 | |||
570 | 'addRandomByte': function(aSourceId, aPoolId, aRandomValue) { | ||
571 | varselectedAccumulator; | ||
572 | |||
573 | selectedAccumulator = this.accumulators()[aPoolId]; | ||
574 | selectedAccumulator.addRandomByte(aRandomValue); | ||
575 | |||
576 | if (aPoolId == 0) { | ||
577 | MochiKit.Signal.signal(this, 'addedRandomByte') | ||
578 | if (selectedAccumulator.stack().length() > this.firstPoolReseedLevel()) { | ||
579 | this.reseed(); | ||
580 | } | ||
581 | } | ||
582 | }, | ||
583 | |||
584 | //------------------------------------------------------------------------- | ||
585 | |||
586 | 'numberOfEntropyAccumulators': function() { | ||
587 | return this._numberOfEntropyAccumulators; | ||
588 | }, | ||
589 | |||
590 | //------------------------------------------------------------------------- | ||
591 | |||
592 | 'randomnessSources': function() { | ||
593 | return this._randomnessSources; | ||
594 | }, | ||
595 | |||
596 | 'addRandomnessSource': function(aRandomnessSource) { | ||
597 | aRandomnessSource.setGenerator(this); | ||
598 | aRandomnessSource.setSourceId(this.randomnessSources().length); | ||
599 | this.randomnessSources().push(aRandomnessSource); | ||
600 | |||
601 | if (this.isReadyToGenerateRandomValues() == false) { | ||
602 | aRandomnessSource.setBoostMode(true); | ||
603 | } | ||
604 | }, | ||
605 | |||
606 | //------------------------------------------------------------------------- | ||
607 | |||
608 | 'deferredEntropyCollection': function(aValue) { | ||
609 | var result; | ||
610 | |||
611 | //MochiKit.Logging.logDebug(">>> PRNG.deferredEntropyCollection"); | ||
612 | |||
613 | if (this.isReadyToGenerateRandomValues()) { | ||
614 | //MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 1"); | ||
615 | result = aValue; | ||
616 | } else { | ||
617 | //MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 2"); | ||
618 | var deferredResult; | ||
619 | |||
620 | // Clipperz.NotificationCenter.notify(this, 'updatedProgressState', 'collectingEntropy', true); | ||
621 | |||
622 | deferredResult = new Clipperz.Async.Deferred("PRNG.deferredEntropyCollection"); | ||
623 | // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.1 - PRNG.deferredEntropyCollection - 1: " + res); return res;}); | ||
624 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue)); | ||
625 | // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.2 - PRNG.deferredEntropyCollection - 2: " + res); return res;}); | ||
626 | MochiKit.Signal.connect(this, | ||
627 | 'readyToGenerateRandomBytes', | ||
628 | deferredResult, | ||
629 | 'callback'); | ||
630 | |||
631 | result = deferredResult; | ||
632 | } | ||
633 | //MochiKit.Logging.logDebug("<<< PRNG.deferredEntropyCollection - result: " + result); | ||
634 | |||
635 | return result; | ||
636 | }, | ||
637 | |||
638 | //------------------------------------------------------------------------- | ||
639 | |||
640 | 'fastEntropyAccumulationForTestingPurpose': function() { | ||
641 | while (! this.isReadyToGenerateRandomValues()) { | ||
642 | this.addRandomByte(Math.floor(Math.random() * 32), Math.floor(Math.random() * 32), Math.floor(Math.random() * 256)); | ||
643 | } | ||
644 | }, | ||
645 | |||
646 | //------------------------------------------------------------------------- | ||
647 | |||
648 | 'dump': function(appendToDoc) { | ||
649 | var tbl; | ||
650 | var i,c; | ||
651 | |||
652 | tbl = document.createElement("table"); | ||
653 | tbl.border = 0; | ||
654 | with (tbl.style) { | ||
655 | border = "1px solid lightgrey"; | ||
656 | fontFamily = 'Helvetica, Arial, sans-serif'; | ||
657 | fontSize = '8pt'; | ||
658 | //borderCollapse = "collapse"; | ||
659 | } | ||
660 | var hdr = tbl.createTHead(); | ||
661 | var hdrtr = hdr.insertRow(0); | ||
662 | // document.createElement("tr"); | ||
663 | { | ||
664 | var ntd; | ||
665 | |||
666 | ntd = hdrtr.insertCell(0); | ||
667 | ntd.style.borderBottom = "1px solid lightgrey"; | ||
668 | ntd.style.borderRight = "1px solid lightgrey"; | ||
669 | ntd.appendChild(document.createTextNode("#")); | ||
670 | |||
671 | ntd = hdrtr.insertCell(1); | ||
672 | ntd.style.borderBottom = "1px solid lightgrey"; | ||
673 | ntd.style.borderRight = "1px solid lightgrey"; | ||
674 | ntd.appendChild(document.createTextNode("s")); | ||
675 | |||
676 | ntd = hdrtr.insertCell(2); | ||
677 | ntd.colSpan = this.firstPoolReseedLevel(); | ||
678 | ntd.style.borderBottom = "1px solid lightgrey"; | ||
679 | ntd.style.borderRight = "1px solid lightgrey"; | ||
680 | ntd.appendChild(document.createTextNode("base values")); | ||
681 | |||
682 | ntd = hdrtr.insertCell(3); | ||
683 | ntd.colSpan = 20; | ||
684 | ntd.style.borderBottom = "1px solid lightgrey"; | ||
685 | ntd.appendChild(document.createTextNode("extra values")); | ||
686 | |||
687 | } | ||
688 | |||
689 | c = this.accumulators().length; | ||
690 | for (i=0; i<c ; i++) { | ||
691 | varcurrentAccumulator; | ||
692 | var bdytr; | ||
693 | var bdytd; | ||
694 | var ii, cc; | ||
695 | |||
696 | currentAccumulator = this.accumulators()[i] | ||
697 | |||
698 | bdytr = tbl.insertRow(true); | ||
699 | |||
700 | bdytd = bdytr.insertCell(0); | ||
701 | bdytd.style.borderRight = "1px solid lightgrey"; | ||
702 | bdytd.style.color = "lightgrey"; | ||
703 | bdytd.appendChild(document.createTextNode("" + i)); | ||
704 | |||
705 | bdytd = bdytr.insertCell(1); | ||
706 | bdytd.style.borderRight = "1px solid lightgrey"; | ||
707 | bdytd.style.color = "gray"; | ||
708 | bdytd.appendChild(document.createTextNode("" + currentAccumulator.stack().length())); | ||
709 | |||
710 | |||
711 | cc = Math.max(currentAccumulator.stack().length(), this.firstPoolReseedLevel()); | ||
712 | for (ii=0; ii<cc; ii++) { | ||
713 | var cellText; | ||
714 | |||
715 | bdytd = bdytr.insertCell(ii + 2); | ||
716 | |||
717 | if (ii < currentAccumulator.stack().length()) { | ||
718 | cellText = Clipperz.ByteArray.byteToHex(currentAccumulator.stack().byteAtIndex(ii)); | ||
719 | } else { | ||
720 | cellText = "_"; | ||
721 | } | ||
722 | |||
723 | if (ii == (this.firstPoolReseedLevel() - 1)) { | ||
724 | bdytd.style.borderRight = "1px solid lightgrey"; | ||
725 | } | ||
726 | |||
727 | bdytd.appendChild(document.createTextNode(cellText)); | ||
728 | } | ||
729 | |||
730 | } | ||
731 | |||
732 | |||
733 | if (appendToDoc) { | ||
734 | var ne = document.createElement("div"); | ||
735 | ne.id = "entropyGeneratorStatus"; | ||
736 | with (ne.style) { | ||
737 | fontFamily = "Courier New, monospace"; | ||
738 | fontSize = "12px"; | ||
739 | lineHeight = "16px"; | ||
740 | borderTop = "1px solid black"; | ||
741 | padding = "10px"; | ||
742 | } | ||
743 | if (document.getElementById(ne.id)) { | ||
744 | MochiKit.DOM.swapDOM(ne.id, ne); | ||
745 | } else { | ||
746 | document.body.appendChild(ne); | ||
747 | } | ||
748 | ne.appendChild(tbl); | ||
749 | } | ||
750 | |||
751 | return tbl; | ||
752 | }, | ||
753 | |||
754 | //----------------------------------------------------------------------------- | ||
755 | __syntaxFix__: "syntax fix" | ||
756 | }); | ||
757 | |||
758 | //############################################################################# | ||
759 | |||
760 | Clipperz.Crypto.PRNG.Random = function(args) { | ||
761 | args = args || {}; | ||
762 | //MochiKit.Base.bindMethods(this); | ||
763 | |||
764 | return this; | ||
765 | } | ||
766 | |||
767 | Clipperz.Crypto.PRNG.Random.prototype = MochiKit.Base.update(null, { | ||
768 | |||
769 | 'toString': function() { | ||
770 | return "Clipperz.Crypto.PRNG.Random"; | ||
771 | }, | ||
772 | |||
773 | //------------------------------------------------------------------------- | ||
774 | |||
775 | 'getRandomBytes': function(aSize) { | ||
776 | //Clipperz.Profile.start("Clipperz.Crypto.PRNG.Random.getRandomBytes"); | ||
777 | varresult; | ||
778 | var i,c; | ||
779 | |||
780 | result = new Clipperz.ByteArray() | ||
781 | c = aSize || 1; | ||
782 | for (i=0; i<c; i++) { | ||
783 | result.appendByte((Math.random()*255) & 0xff); | ||
784 | } | ||
785 | |||
786 | //Clipperz.Profile.stop("Clipperz.Crypto.PRNG.Random.getRandomBytes"); | ||
787 | return result; | ||
788 | }, | ||
789 | |||
790 | //------------------------------------------------------------------------- | ||
791 | __syntaxFix__: "syntax fix" | ||
792 | }); | ||
793 | |||
794 | //############################################################################# | ||
795 | |||
796 | _clipperz_crypt_prng_defaultPRNG = null; | ||
797 | |||
798 | Clipperz.Crypto.PRNG.defaultRandomGenerator = function() { | ||
799 | if (_clipperz_crypt_prng_defaultPRNG == null) { | ||
800 | _clipperz_crypt_prng_defaultPRNG = new Clipperz.Crypto.PRNG.Fortuna(); | ||
801 | |||
802 | //............................................................. | ||
803 | // | ||
804 | // TimeRandomnessSource | ||
805 | // | ||
806 | //............................................................. | ||
807 | { | ||
808 | var newRandomnessSource; | ||
809 | |||
810 | newRandomnessSource = new Clipperz.Crypto.PRNG.TimeRandomnessSource({intervalTime:111}); | ||
811 | _clipperz_crypt_prng_defaultPRNG.addRandomnessSource(newRandomnessSource); | ||
812 | } | ||
813 | |||
814 | //............................................................. | ||
815 | // | ||
816 | // MouseRandomnessSource | ||
817 | // | ||
818 | //............................................................. | ||
819 | { | ||
820 | varnewRandomnessSource; | ||
821 | |||
822 | newRandomnessSource = new Clipperz.Crypto.PRNG.MouseRandomnessSource(); | ||
823 | _clipperz_crypt_prng_defaultPRNG.addRandomnessSource(newRandomnessSource); | ||
824 | } | ||
825 | |||
826 | //............................................................. | ||
827 | // | ||
828 | // KeyboardRandomnessSource | ||
829 | // | ||
830 | //............................................................. | ||
831 | { | ||
832 | varnewRandomnessSource; | ||
833 | |||
834 | newRandomnessSource = new Clipperz.Crypto.PRNG.KeyboardRandomnessSource(); | ||
835 | _clipperz_crypt_prng_defaultPRNG.addRandomnessSource(newRandomnessSource); | ||
836 | } | ||
837 | |||
838 | } | ||
839 | |||
840 | return _clipperz_crypt_prng_defaultPRNG; | ||
841 | }; | ||
842 | |||
843 | //############################################################################# | ||
844 | |||
845 | Clipperz.Crypto.PRNG.exception = { | ||
846 | NotEnoughEntropy: new MochiKit.Base.NamedError("Clipperz.Crypto.PRNG.exception.NotEnoughEntropy") | ||
847 | }; | ||
848 | |||
849 | |||
850 | MochiKit.DOM.addLoadEvent(Clipperz.Crypto.PRNG.defaultRandomGenerator); | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/RSA.js b/frontend/gamma/js/ClipperzCryptoLibrary/RSA.js new file mode 100644 index 0000000..5a480f1 --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/RSA.js | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { | ||
25 | throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!"; | ||
26 | } | ||
27 | |||
28 | if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; } | ||
29 | |||
30 | Clipperz.Crypto.RSA.VERSION = "0.1"; | ||
31 | Clipperz.Crypto.RSA.NAME = "Clipperz.RSA"; | ||
32 | |||
33 | //############################################################################# | ||
34 | |||
35 | MochiKit.Base.update(Clipperz.Crypto.RSA, { | ||
36 | |||
37 | //------------------------------------------------------------------------- | ||
38 | |||
39 | 'publicKeyWithValues': function (e, d, n) { | ||
40 | varresult; | ||
41 | |||
42 | result = {}; | ||
43 | |||
44 | if (e.isBigInt) { | ||
45 | result.e = e; | ||
46 | } else { | ||
47 | result.e = new Clipperz.Crypto.BigInt(e, 16); | ||
48 | } | ||
49 | |||
50 | if (d.isBigInt) { | ||
51 | result.d = d; | ||
52 | } else { | ||
53 | result.d = new Clipperz.Crypto.BigInt(d, 16); | ||
54 | } | ||
55 | |||
56 | if (n.isBigInt) { | ||
57 | result.n = n; | ||
58 | } else { | ||
59 | result.n = new Clipperz.Crypto.BigInt(n, 16); | ||
60 | } | ||
61 | |||
62 | return result; | ||
63 | }, | ||
64 | |||
65 | 'privateKeyWithValues': function(e, d, n) { | ||
66 | return Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n); | ||
67 | }, | ||
68 | |||
69 | //----------------------------------------------------------------------------- | ||
70 | |||
71 | 'encryptUsingPublicKey': function (aKey, aMessage) { | ||
72 | varmessageValue; | ||
73 | varresult; | ||
74 | |||
75 | messageValue = new Clipperz.Crypto.BigInt(aMessage, 16); | ||
76 | result = messageValue.powerModule(aKey.e, aKey.n); | ||
77 | |||
78 | return result.asString(16); | ||
79 | }, | ||
80 | |||
81 | //............................................................................. | ||
82 | |||
83 | 'decryptUsingPublicKey': function (aKey, aMessage) { | ||
84 | return Clipperz.Crypto.RSA.encryptUsingPublicKey(aKey, aMessage); | ||
85 | }, | ||
86 | |||
87 | //----------------------------------------------------------------------------- | ||
88 | |||
89 | 'encryptUsingPrivateKey': function (aKey, aMessage) { | ||
90 | varmessageValue; | ||
91 | varresult; | ||
92 | |||
93 | messageValue = new Clipperz.Crypto.BigInt(aMessage, 16); | ||
94 | result = messageValue.powerModule(aKey.d, aKey.n); | ||
95 | |||
96 | return result.asString(16); | ||
97 | }, | ||
98 | |||
99 | //............................................................................. | ||
100 | |||
101 | 'decryptUsingPrivateKey': function (aKey, aMessage) { | ||
102 | return Clipperz.Crypto.RSA.encryptUsingPrivateKey(aKey, aMessage); | ||
103 | }, | ||
104 | |||
105 | //----------------------------------------------------------------------------- | ||
106 | |||
107 | 'generatePublicKey': function(aNumberOfBits) { | ||
108 | varresult; | ||
109 | vare; | ||
110 | vard; | ||
111 | varn; | ||
112 | |||
113 | e = new Clipperz.Crypto.BigInt("10001", 16); | ||
114 | |||
115 | { | ||
116 | var p, q; | ||
117 | varphi; | ||
118 | |||
119 | do { | ||
120 | p = Clipperz.Crypto.BigInt.randomPrime(aNumberOfBits); | ||
121 | } while (p.module(e).equals(1)); | ||
122 | |||
123 | do { | ||
124 | q = Clipperz.Crypto.BigInt.randomPrime(aNumberOfBits); | ||
125 | } while ((q.equals(p)) || (q.module(e).equals(1))); | ||
126 | |||
127 | n = p.multiply(q); | ||
128 | phi = (p.subtract(1).multiply(q.subtract(1))); | ||
129 | d = e.powerModule(-1, phi); | ||
130 | } | ||
131 | |||
132 | result = Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n); | ||
133 | |||
134 | return result; | ||
135 | }, | ||
136 | |||
137 | //------------------------------------------------------------------------- | ||
138 | |||
139 | __syntaxFix__: "syntax fix" | ||
140 | |||
141 | //------------------------------------------------------------------------- | ||
142 | |||
143 | }); | ||
144 | |||
145 | //############################################################################# | ||
146 | |||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/SHA.js b/frontend/gamma/js/ClipperzCryptoLibrary/SHA.js new file mode 100644 index 0000000..f8bfe6e --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/SHA.js | |||
@@ -0,0 +1,296 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | ||
26 | } | ||
27 | |||
28 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | ||
29 | if (typeof(Clipperz.Crypto.SHA) == 'undefined') { Clipperz.Crypto.SHA = {}; } | ||
30 | |||
31 | Clipperz.Crypto.SHA.VERSION = "0.3"; | ||
32 | Clipperz.Crypto.SHA.NAME = "Clipperz.Crypto.SHA"; | ||
33 | |||
34 | MochiKit.Base.update(Clipperz.Crypto.SHA, { | ||
35 | |||
36 | '__repr__': function () { | ||
37 | return "[" + this.NAME + " " + this.VERSION + "]"; | ||
38 | }, | ||
39 | |||
40 | 'toString': function () { | ||
41 | return this.__repr__(); | ||
42 | }, | ||
43 | |||
44 | //----------------------------------------------------------------------------- | ||
45 | |||
46 | 'rotateRight': function(aValue, aNumberOfBits) { | ||
47 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.rotateRight"); | ||
48 | var result; | ||
49 | |||
50 | result = (aValue >>> aNumberOfBits) | (aValue << (32 - aNumberOfBits)); | ||
51 | |||
52 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.rotateRight"); | ||
53 | return result; | ||
54 | }, | ||
55 | |||
56 | 'shiftRight': function(aValue, aNumberOfBits) { | ||
57 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.shiftRight"); | ||
58 | var result; | ||
59 | |||
60 | result = aValue >>> aNumberOfBits; | ||
61 | |||
62 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.shiftRight"); | ||
63 | return result; | ||
64 | }, | ||
65 | |||
66 | //----------------------------------------------------------------------------- | ||
67 | |||
68 | 'safeAdd': function() { | ||
69 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.safeAdd"); | ||
70 | varresult; | ||
71 | vari, c; | ||
72 | |||
73 | result = arguments[0]; | ||
74 | c = arguments.length; | ||
75 | for (i=1; i<c; i++) { | ||
76 | varlowerBytesSum; | ||
77 | |||
78 | lowerBytesSum = (result & 0xffff) + (arguments[i] & 0xffff); | ||
79 | result = (((result >> 16) + (arguments[i] >> 16) + (lowerBytesSum >> 16)) << 16) | (lowerBytesSum & 0xffff); | ||
80 | } | ||
81 | |||
82 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.safeAdd"); | ||
83 | return result; | ||
84 | }, | ||
85 | |||
86 | //----------------------------------------------------------------------------- | ||
87 | |||
88 | 'sha256_array': function(aValue) { | ||
89 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.sha256_array"); | ||
90 | varresult; | ||
91 | varmessage; | ||
92 | var h0, h1, h2, h3, h4, h5, h6, h7; | ||
93 | vark; | ||
94 | varmessageLength; | ||
95 | varmessageLengthInBits; | ||
96 | var_i, _c; | ||
97 | var charBits; | ||
98 | var rotateRight; | ||
99 | var shiftRight; | ||
100 | var safeAdd; | ||
101 | varbytesPerBlock; | ||
102 | var currentMessageIndex; | ||
103 | |||
104 | bytesPerBlock = 512/8; | ||
105 | rotateRight = Clipperz.Crypto.SHA.rotateRight; | ||
106 | shiftRight = Clipperz.Crypto.SHA.shiftRight; | ||
107 | safeAdd = Clipperz.Crypto.SHA.safeAdd; | ||
108 | |||
109 | charBits = 8; | ||
110 | |||
111 | h0 = 0x6a09e667; | ||
112 | h1 = 0xbb67ae85; | ||
113 | h2 = 0x3c6ef372; | ||
114 | h3 = 0xa54ff53a; | ||
115 | h4 = 0x510e527f; | ||
116 | h5 = 0x9b05688c; | ||
117 | h6 = 0x1f83d9ab; | ||
118 | h7 = 0x5be0cd19; | ||
119 | |||
120 | k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, | ||
121 | 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, | ||
122 | 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, | ||
123 | 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, | ||
124 | 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, | ||
125 | 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, | ||
126 | 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, | ||
127 | 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; | ||
128 | |||
129 | message = aValue; | ||
130 | messageLength = message.length; | ||
131 | |||
132 | //Pre-processing: | ||
133 | message.push(0x80); //append a single "1" bit to message | ||
134 | |||
135 | _c = (512 - (((messageLength + 1) * charBits) % 512) - 64) / charBits; | ||
136 | if (_c < 0) { | ||
137 | _c = _c + (512 / charBits); | ||
138 | } | ||
139 | |||
140 | for (_i=0; _i<_c; _i++) { | ||
141 | message.push(0x00); //append "0" bits until message length ≡ 448 ≡ -64 (mod 512) | ||
142 | } | ||
143 | |||
144 | messageLengthInBits = messageLength * charBits; | ||
145 | message.push(0x00); //the 4 most high byte are alway 0 as message length is represented with a 32bit value; | ||
146 | message.push(0x00); | ||
147 | message.push(0x00); | ||
148 | message.push(0x00); | ||
149 | message.push((messageLengthInBits >> 24)& 0xff); | ||
150 | message.push((messageLengthInBits >> 16)& 0xff); | ||
151 | message.push((messageLengthInBits >> 8) & 0xff); | ||
152 | message.push( messageLengthInBits & 0xff); | ||
153 | |||
154 | currentMessageIndex = 0; | ||
155 | while(currentMessageIndex < message.length) { | ||
156 | varw; | ||
157 | vara, b, c, d, e, f, g, h; | ||
158 | |||
159 | w = Array(64); | ||
160 | |||
161 | _c = 16; | ||
162 | for (_i=0; _i<_c; _i++) { | ||
163 | var _j; | ||
164 | |||
165 | _j = currentMessageIndex + _i*4; | ||
166 | w[_i] = (message[_j] << 24) | (message[_j + 1] << 16) | (message[_j + 2] << 8) | (message[_j + 3] << 0); | ||
167 | } | ||
168 | |||
169 | _c = 64; | ||
170 | for (_i=16; _i<_c; _i++) { | ||
171 | vars0, s1; | ||
172 | |||
173 | s0 = (rotateRight(w[_i-15], 7)) ^ (rotateRight(w[_i-15], 18)) ^ (shiftRight(w[_i-15], 3)); | ||
174 | s1 = (rotateRight(w[_i-2], 17)) ^ (rotateRight(w[_i-2], 19)) ^ (shiftRight(w[_i-2], 10)); | ||
175 | w[_i] = safeAdd(w[_i-16], s0, w[_i-7], s1); | ||
176 | } | ||
177 | |||
178 | a=h0; b=h1; c=h2; d=h3; e=h4; f=h5; g=h6; h=h7; | ||
179 | |||
180 | _c = 64; | ||
181 | for (_i=0; _i<_c; _i++) { | ||
182 | var s0, s1, ch, maj, t1, t2; | ||
183 | |||
184 | s0 = (rotateRight(a, 2)) ^ (rotateRight(a, 13)) ^ (rotateRight(a, 22)); | ||
185 | maj = (a & b) ^ (a & c) ^ (b & c); | ||
186 | t2 = safeAdd(s0, maj); | ||
187 | s1 = (rotateRight(e, 6)) ^ (rotateRight(e, 11)) ^ (rotateRight(e, 25)); | ||
188 | ch = (e & f) ^ ((~e) & g); | ||
189 | t1 = safeAdd(h, s1, ch, k[_i], w[_i]); | ||
190 | |||
191 | h = g; | ||
192 | g = f; | ||
193 | f = e; | ||
194 | e = safeAdd(d, t1); | ||
195 | d = c; | ||
196 | c = b; | ||
197 | b = a; | ||
198 | a = safeAdd(t1, t2); | ||
199 | } | ||
200 | |||
201 | h0 = safeAdd(h0, a); | ||
202 | h1 = safeAdd(h1, b); | ||
203 | h2 = safeAdd(h2, c); | ||
204 | h3 = safeAdd(h3, d); | ||
205 | h4 = safeAdd(h4, e); | ||
206 | h5 = safeAdd(h5, f); | ||
207 | h6 = safeAdd(h6, g); | ||
208 | h7 = safeAdd(h7, h); | ||
209 | |||
210 | currentMessageIndex += bytesPerBlock; | ||
211 | } | ||
212 | |||
213 | result = new Array(256/8); | ||
214 | result[0] = (h0 >> 24)& 0xff; | ||
215 | result[1] = (h0 >> 16)& 0xff; | ||
216 | result[2] = (h0 >> 8)& 0xff; | ||
217 | result[3] = h0 & 0xff; | ||
218 | |||
219 | result[4] = (h1 >> 24)& 0xff; | ||
220 | result[5] = (h1 >> 16)& 0xff; | ||
221 | result[6] = (h1 >> 8)& 0xff; | ||
222 | result[7] = h1 & 0xff; | ||
223 | |||
224 | result[8] = (h2 >> 24)& 0xff; | ||
225 | result[9] = (h2 >> 16)& 0xff; | ||
226 | result[10] = (h2 >> 8)& 0xff; | ||
227 | result[11] = h2 & 0xff; | ||
228 | |||
229 | result[12] = (h3 >> 24)& 0xff; | ||
230 | result[13] = (h3 >> 16)& 0xff; | ||
231 | result[14] = (h3 >> 8)& 0xff; | ||
232 | result[15] = h3 & 0xff; | ||
233 | |||
234 | result[16] = (h4 >> 24)& 0xff; | ||
235 | result[17] = (h4 >> 16)& 0xff; | ||
236 | result[18] = (h4 >> 8)& 0xff; | ||
237 | result[19] = h4 & 0xff; | ||
238 | |||
239 | result[20] = (h5 >> 24)& 0xff; | ||
240 | result[21] = (h5 >> 16)& 0xff; | ||
241 | result[22] = (h5 >> 8)& 0xff; | ||
242 | result[23] = h5 & 0xff; | ||
243 | |||
244 | result[24] = (h6 >> 24)& 0xff; | ||
245 | result[25] = (h6 >> 16)& 0xff; | ||
246 | result[26] = (h6 >> 8)& 0xff; | ||
247 | result[27] = h6 & 0xff; | ||
248 | |||
249 | result[28] = (h7 >> 24)& 0xff; | ||
250 | result[29] = (h7 >> 16)& 0xff; | ||
251 | result[30] = (h7 >> 8)& 0xff; | ||
252 | result[31] = h7 & 0xff; | ||
253 | |||
254 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.sha256_array"); | ||
255 | return result; | ||
256 | }, | ||
257 | |||
258 | //----------------------------------------------------------------------------- | ||
259 | |||
260 | 'sha256': function(aValue) { | ||
261 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.sha256"); | ||
262 | var result; | ||
263 | var resultArray; | ||
264 | varvalueArray; | ||
265 | |||
266 | valueArray = aValue.arrayValues(); | ||
267 | resultArray = Clipperz.Crypto.SHA.sha256_array(valueArray); | ||
268 | |||
269 | result = new Clipperz.ByteArray(resultArray); | ||
270 | |||
271 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.sha256"); | ||
272 | return result; | ||
273 | }, | ||
274 | |||
275 | //----------------------------------------------------------------------------- | ||
276 | |||
277 | 'sha_d256': function(aValue) { | ||
278 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.sha_d256"); | ||
279 | var result; | ||
280 | var resultArray; | ||
281 | varvalueArray; | ||
282 | |||
283 | valueArray = aValue.arrayValues(); | ||
284 | resultArray = Clipperz.Crypto.SHA.sha256_array(valueArray); | ||
285 | resultArray = Clipperz.Crypto.SHA.sha256_array(resultArray); | ||
286 | |||
287 | result = new Clipperz.ByteArray(resultArray); | ||
288 | |||
289 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.sha256"); | ||
290 | return result; | ||
291 | }, | ||
292 | |||
293 | //----------------------------------------------------------------------------- | ||
294 | __syntaxFix__: "syntax fix" | ||
295 | |||
296 | }); | ||
diff --git a/frontend/gamma/js/ClipperzCryptoLibrary/SRP.js b/frontend/gamma/js/ClipperzCryptoLibrary/SRP.js new file mode 100644 index 0000000..8cc80ba --- a/dev/null +++ b/frontend/gamma/js/ClipperzCryptoLibrary/SRP.js | |||
@@ -0,0 +1,326 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | ||
25 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | ||
26 | } | ||
27 | |||
28 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { | ||
29 | throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.BigInt!"; | ||
30 | } | ||
31 | |||
32 | try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { | ||
33 | throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.PRNG!"; | ||
34 | } | ||
35 | |||
36 | if (typeof(Clipperz.Crypto.SRP) == 'undefined') { Clipperz.Crypto.SRP = {}; } | ||
37 | |||
38 | Clipperz.Crypto.SRP.VERSION = "0.1"; | ||
39 | Clipperz.Crypto.SRP.NAME = "Clipperz.Crypto.SRP"; | ||
40 | |||
41 | //############################################################################# | ||
42 | |||
43 | MochiKit.Base.update(Clipperz.Crypto.SRP, { | ||
44 | |||
45 | '_n': null, | ||
46 | '_g': null, | ||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'n': function() { | ||
50 | if (Clipperz.Crypto.SRP._n == null) { | ||
51 | Clipperz.Crypto.SRP._n = new Clipperz.Crypto.BigInt("115b8b692e0e045692cf280b436735c77a5a9e8a9e7ed56c965f87db5b2a2ece3", 16); | ||
52 | } | ||
53 | |||
54 | return Clipperz.Crypto.SRP._n; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | |||
59 | 'g': function() { | ||
60 | if (Clipperz.Crypto.SRP._g == null) { | ||
61 | Clipperz.Crypto.SRP._g = new Clipperz.Crypto.BigInt(2); //eventually 5 (as suggested on the Diffi-Helmann documentation) | ||
62 | } | ||
63 | |||
64 | return Clipperz.Crypto.SRP._g; | ||
65 | }, | ||
66 | |||
67 | //----------------------------------------------------------------------------- | ||
68 | |||
69 | 'exception': { | ||
70 | 'InvalidValue': new MochiKit.Base.NamedError("Clipperz.Crypto.SRP.exception.InvalidValue") | ||
71 | }, | ||
72 | |||
73 | //------------------------------------------------------------------------- | ||
74 | __syntaxFix__: "syntax fix" | ||
75 | |||
76 | }); | ||
77 | |||
78 | //############################################################################# | ||
79 | // | ||
80 | // S R P C o n n e c t i o n version 1.0 | ||
81 | // | ||
82 | //============================================================================= | ||
83 | Clipperz.Crypto.SRP.Connection = function (args) { | ||
84 | args = args || {}; | ||
85 | |||
86 | this._C = args.C; | ||
87 | this._P = args.P; | ||
88 | this.hash = args.hash; | ||
89 | |||
90 | this._a = null; | ||
91 | this._A = null; | ||
92 | |||
93 | this._s = null; | ||
94 | this._B = null; | ||
95 | |||
96 | this._x = null; | ||
97 | |||
98 | this._u = null; | ||
99 | this._K = null; | ||
100 | this._M1 = null; | ||
101 | this._M2 = null; | ||
102 | |||
103 | this._sessionKey = null; | ||
104 | |||
105 | return this; | ||
106 | } | ||
107 | |||
108 | Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, { | ||
109 | |||
110 | 'toString': function () { | ||
111 | return "Clipperz.Crypto.SRP.Connection (username: " + this.username() + "). Status: " + this.statusDescription(); | ||
112 | }, | ||
113 | |||
114 | //------------------------------------------------------------------------- | ||
115 | |||
116 | 'C': function () { | ||
117 | return this._C; | ||
118 | }, | ||
119 | |||
120 | //------------------------------------------------------------------------- | ||
121 | |||
122 | 'P': function () { | ||
123 | return this._P; | ||
124 | }, | ||
125 | |||
126 | //------------------------------------------------------------------------- | ||
127 | |||
128 | 'a': function () { | ||
129 | if (this._a == null) { | ||
130 | this._a = new Clipperz.Crypto.BigInt(Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2), 16); | ||
131 | // this._a = new Clipperz.Crypto.BigInt("37532428169486597638072888476611365392249575518156687476805936694442691012367", 10); | ||
132 | //MochiKit.Logging.logDebug("SRP a: " + this._a); | ||
133 | } | ||
134 | |||
135 | return this._a; | ||
136 | }, | ||
137 | |||
138 | //------------------------------------------------------------------------- | ||
139 | |||
140 | 'A': function () { | ||
141 | if (this._A == null) { | ||
142 | //Warning: this value should be strictly greater than zero: how should we perform this check? | ||
143 | this._A = Clipperz.Crypto.SRP.g().powerModule(this.a(), Clipperz.Crypto.SRP.n()); | ||
144 | |||
145 | if (this._A.equals(0)) { | ||
146 | MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'A' to 0."); | ||
147 | throw Clipperz.Crypto.SRP.exception.InvalidValue; | ||
148 | } | ||
149 | //MochiKit.Logging.logDebug("SRP A: " + this._A); | ||
150 | } | ||
151 | |||
152 | return this._A; | ||
153 | }, | ||
154 | |||
155 | //------------------------------------------------------------------------- | ||
156 | |||
157 | 's': function () { | ||
158 | return this._s; | ||
159 | //MochiKit.Logging.logDebug("SRP s: " + this._S); | ||
160 | }, | ||
161 | |||
162 | 'set_s': function(aValue) { | ||
163 | this._s = aValue; | ||
164 | }, | ||
165 | |||
166 | //------------------------------------------------------------------------- | ||
167 | |||
168 | 'B': function () { | ||
169 | return this._B; | ||
170 | }, | ||
171 | |||
172 | 'set_B': function(aValue) { | ||
173 | //Warning: this value should be strictly greater than zero: how should we perform this check? | ||
174 | if (! aValue.equals(0)) { | ||
175 | this._B = aValue; | ||
176 | //MochiKit.Logging.logDebug("SRP B: " + this._B); | ||
177 | } else { | ||
178 | MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to 0."); | ||
179 | throw Clipperz.Crypto.SRP.exception.InvalidValue; | ||
180 | } | ||
181 | }, | ||
182 | |||
183 | //------------------------------------------------------------------------- | ||
184 | |||
185 | 'x': function () { | ||
186 | if (this._x == null) { | ||
187 | this._x = new Clipperz.Crypto.BigInt(this.stringHash(this.s().asString(16, 64) + this.P()), 16); | ||
188 | //MochiKit.Logging.logDebug("SRP x: " + this._x); | ||
189 | } | ||
190 | |||
191 | return this._x; | ||
192 | }, | ||
193 | |||
194 | //------------------------------------------------------------------------- | ||
195 | |||
196 | 'u': function () { | ||
197 | if (this._u == null) { | ||
198 | this._u = new Clipperz.Crypto.BigInt(this.stringHash(this.B().asString()), 16); | ||
199 | //MochiKit.Logging.logDebug("SRP u: " + this._u); | ||
200 | } | ||
201 | |||
202 | return this._u; | ||
203 | }, | ||
204 | |||
205 | //------------------------------------------------------------------------- | ||
206 | |||
207 | 'S': function () { | ||
208 | if (this._S == null) { | ||
209 | var bigint; | ||
210 | varsrp; | ||
211 | |||
212 | bigint = Clipperz.Crypto.BigInt; | ||
213 | srp = Clipperz.Crypto.SRP; | ||
214 | |||
215 | this._S =bigint.powerModule( | ||
216 | bigint.subtract(this.B(), bigint.powerModule(srp.g(), this.x(), srp.n())), | ||
217 | bigint.add(this.a(), bigint.multiply(this.u(), this.x())), | ||
218 | srp.n() | ||
219 | ) | ||
220 | //MochiKit.Logging.logDebug("SRP S: " + this._S); | ||
221 | } | ||
222 | |||
223 | return this._S; | ||
224 | }, | ||
225 | |||
226 | //------------------------------------------------------------------------- | ||
227 | |||
228 | 'K': function () { | ||
229 | if (this._K == null) { | ||
230 | this._K = this.stringHash(this.S().asString()); | ||
231 | //MochiKit.Logging.logDebug("SRP K: " + this._K); | ||
232 | } | ||
233 | |||
234 | return this._K; | ||
235 | }, | ||
236 | |||
237 | //------------------------------------------------------------------------- | ||
238 | |||
239 | 'M1': function () { | ||
240 | if (this._M1 == null) { | ||
241 | this._M1 = this.stringHash(this.A().asString(10) + this.B().asString(10) + this.K()); | ||
242 | //MochiKit.Logging.logDebug("SRP M1: " + this._M1); | ||
243 | } | ||
244 | |||
245 | return this._M1; | ||
246 | }, | ||
247 | |||
248 | //------------------------------------------------------------------------- | ||
249 | |||
250 | 'M2': function () { | ||
251 | if (this._M2 == null) { | ||
252 | this._M2 = this.stringHash(this.A().asString(10) + this.M1() + this.K()); | ||
253 | //MochiKit.Logging.logDebug("SRP M2: " + this._M2); | ||
254 | } | ||
255 | |||
256 | return this._M2; | ||
257 | }, | ||
258 | |||
259 | //========================================================================= | ||
260 | |||
261 | 'serverSideCredentialsWithSalt': function(aSalt) { | ||
262 | var result; | ||
263 | var s, x, v; | ||
264 | |||
265 | s = aSalt; | ||
266 | x = this.stringHash(s + this.P()); | ||
267 | v = Clipperz.Crypto.SRP.g().powerModule(new Clipperz.Crypto.BigInt(x, 16), Clipperz.Crypto.SRP.n()); | ||
268 | |||
269 | result = {}; | ||
270 | result['C'] = this.C(); | ||
271 | result['s'] = s; | ||
272 | result['v'] = v.asString(16); | ||
273 | |||
274 | return result; | ||
275 | }, | ||
276 | |||
277 | 'serverSideCredentials': function() { | ||
278 | var result; | ||
279 | var s; | ||
280 | |||
281 | s = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); | ||
282 | |||
283 | result = this.serverSideCredentialsWithSalt(s); | ||
284 | |||
285 | return result; | ||
286 | }, | ||
287 | |||
288 | //========================================================================= | ||
289 | /* | ||
290 | 'computeServerSide_S': function(b) { | ||
291 | var result; | ||
292 | var v; | ||
293 | var bigint; | ||
294 | varsrp; | ||
295 | |||
296 | bigint = Clipperz.Crypto.BigInt; | ||
297 | srp = Clipperz.Crypto.SRP; | ||
298 | |||
299 | v = new Clipperz.Crypto.BigInt(srpConnection.serverSideCredentialsWithSalt(this.s().asString(16, 64)).v, 16); | ||
300 | // _S = (this.A().multiply(this.v().modPow(this.u(), this.n()))).modPow(this.b(), this.n()); | ||
301 | result = bigint.powerModule( | ||
302 | bigint.multiply( | ||
303 | this.A(), | ||
304 | bigint.powerModule(v, this.u(), srp.n()) | ||
305 | ), new Clipperz.Crypto.BigInt(b, 10), srp.n() | ||
306 | ); | ||
307 | |||
308 | return result; | ||
309 | }, | ||
310 | */ | ||
311 | //========================================================================= | ||
312 | |||
313 | 'stringHash': function(aValue) { | ||
314 | varresult; | ||
315 | |||
316 | result = this.hash(new Clipperz.ByteArray(aValue)).toHexString().substring(2); | ||
317 | |||
318 | return result; | ||
319 | }, | ||
320 | |||
321 | //========================================================================= | ||
322 | __syntaxFix__: "syntax fix" | ||
323 | |||
324 | }); | ||
325 | |||
326 | //############################################################################# | ||
diff --git a/frontend/gamma/js/main.js b/frontend/gamma/js/main.js index 934b325..6816754 100644 --- a/frontend/gamma/js/main.js +++ b/frontend/gamma/js/main.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | function _pm_logEvent(anEvent) { | 24 | function _pm_logEvent(anEvent) { |
27 | //console.log("####", anEvent); | 25 | //console.log("####", anEvent); |
28 | 26 | ||
29 | anEvent.preventDefault(); | 27 | anEvent.preventDefault(); |
30 | } | 28 | } |
diff --git a/frontend/gamma/js/main.mobile.js b/frontend/gamma/js/main.mobile.js index 60a32fa..2fdd920 100644 --- a/frontend/gamma/js/main.mobile.js +++ b/frontend/gamma/js/main.mobile.js | |||
@@ -1,30 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | function _pm_logEvent(anEvent) { | 24 | function _pm_logEvent(anEvent) { |
27 | //console.log("####", anEvent); | 25 | //console.log("####", anEvent); |
28 | 26 | ||
29 | anEvent.preventDefault(); | 27 | anEvent.preventDefault(); |
30 | } | 28 | } |