forgiva 1.0.pre.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fbcefba4b89100d254ff1034a2cd68b50c9a2b9d
4
+ data.tar.gz: 7c4d55d7f552a25e7b58d46631270ed28165f429
5
+ SHA512:
6
+ metadata.gz: 93fd09bb2320508a6ac47c340088f655f1648499cfaafd389f4368cd8557de9f12e21a8f7e7e954924fc75f8a3ca8c22cfe1f24647938783af474e283a3c9a2e
7
+ data.tar.gz: 7d1292aec1385f00abe9f1cda1089de04f2a025ea84e62fb54f6b6b2c87eaee4d419ea17692f72647110d4b9312b25472c35fdda039181c17dcb11256b5773d2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,180 @@
1
+
2
+ Copyright (c) 2016 Sceptive
3
+
4
+ ## Creative Commons
5
+
6
+ # Attribution-NonCommercial-ShareAlike 4.0 International
7
+
8
+ Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
9
+
10
+ ### Using Creative Commons Public Licenses
11
+
12
+ Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
13
+
14
+ * __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
15
+
16
+ * __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
17
+
18
+ ## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
19
+
20
+ By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
21
+
22
+ ### Section 1 – Definitions.
23
+
24
+ a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
25
+
26
+ b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
27
+
28
+ c. __BY-NC-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License.
29
+
30
+ d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
31
+
32
+ e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
33
+
34
+ f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
35
+
36
+ g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
37
+
38
+ h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
39
+
40
+ i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
41
+
42
+ h. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
43
+
44
+ i. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
45
+
46
+ j. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
47
+
48
+ k. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
49
+
50
+ l. __You__ means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
51
+
52
+ ### Section 2 – Scope.
53
+
54
+ a. ___License grant.___
55
+
56
+ 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
57
+
58
+ A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
59
+
60
+ B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
61
+
62
+ 2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
63
+
64
+ 3. __Term.__ The term of this Public License is specified in Section 6(a).
65
+
66
+ 4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
67
+
68
+ 5. __Downstream recipients.__
69
+
70
+ A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
71
+
72
+ B. __Additional offer from the Licensor – Adapted Material.__ Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
73
+
74
+ C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
75
+
76
+ 6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
77
+
78
+ b. ___Other rights.___
79
+
80
+ 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
81
+
82
+ 2. Patent and trademark rights are not licensed under this Public License.
83
+
84
+ 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
85
+
86
+ ### Section 3 – License Conditions.
87
+
88
+ Your exercise of the Licensed Rights is expressly made subject to the following conditions.
89
+
90
+ a. ___Attribution.___
91
+
92
+ 1. If You Share the Licensed Material (including in modified form), You must:
93
+
94
+ A. retain the following if it is supplied by the Licensor with the Licensed Material:
95
+
96
+ i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
97
+
98
+ ii. a copyright notice;
99
+
100
+ iii. a notice that refers to this Public License;
101
+
102
+ iv. a notice that refers to the disclaimer of warranties;
103
+
104
+ v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
105
+
106
+ B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
107
+
108
+ C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
109
+
110
+ 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
111
+
112
+ 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
113
+
114
+ b. ___ShareAlike.___
115
+
116
+ In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
117
+
118
+ 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
119
+
120
+ 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
121
+
122
+ 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
123
+
124
+ ### Section 4 – Sui Generis Database Rights.
125
+
126
+ Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
127
+
128
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
129
+
130
+ b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
131
+
132
+ c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
133
+
134
+ For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
135
+
136
+ ### Section 5 – Disclaimer of Warranties and Limitation of Liability.
137
+
138
+ a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
139
+
140
+ b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
141
+
142
+ c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
143
+
144
+ ### Section 6 – Term and Termination.
145
+
146
+ a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
147
+
148
+ b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
149
+
150
+ 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
151
+
152
+ 2. upon express reinstatement by the Licensor.
153
+
154
+ For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
155
+
156
+ c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
157
+
158
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
159
+
160
+ ### Section 7 – Other Terms and Conditions.
161
+
162
+ a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
163
+
164
+ b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
165
+
166
+ ### Section 8 – Interpretation.
167
+
168
+ a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
169
+
170
+ b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
171
+
172
+ c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
173
+
174
+ d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
175
+
176
+ ```
177
+ Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
178
+
179
+ Creative Commons may be contacted at creativecommons.org
180
+ ```
data/README.md ADDED
@@ -0,0 +1,242 @@
1
+ Forgiva Open Source Edition
2
+ =============================
3
+ For more information please refer to https://www.forgiva.com
4
+
5
+ ## Overview
6
+
7
+ Forgiva is a brand new password managing idea. It's developed by security
8
+ professionals to maintain and protect passwords far more better than any
9
+ other commercial solution available on the market.
10
+
11
+ * It never stores your passwords anywhere! There is nothing to crack.
12
+ * Resistant to key-loggers.
13
+ * Combines various hashing and encryption algorithms depending on your
14
+ master-key. Thus makes very difficult to estimate an effective
15
+ brute-force and/or dictionary attack.
16
+ * You can choose complexity depending on your paranoia level.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ $ gem install forgiva
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ Just type `forgiva` on the command line to run, and pick any password depending
27
+ on your favourite animal.
28
+
29
+ ```
30
+
31
+ $ forgiva
32
+
33
+ .-" L_ FORGIVA (Open Source Edition)
34
+ ;', / ( o\ The new-age password manager
35
+ \ ; `' /
36
+ ;_/"'.__.-"
37
+
38
+ Hostname: abc.com
39
+ Account: superuser
40
+ Master password:
41
+ Master password (again):
42
+ Generating...
43
+
44
+ Ape 0en8*qxxbTopbKD_
45
+ Bat OJJ6+wv6*bx2wscf
46
+ Bear tFOAx/@aYd@a8zDG
47
+ Whale l/RiCiHlKz_c3+Xt
48
+ Crow 0d4nXlk7mx,6g16H
49
+ Dog xdYhK.Tr,O,wSXBb
50
+ Duck tTGbDlVWdDJv!3Pj
51
+ Cat +kEWip3mU_6DhWkz
52
+ Wasp SGAl789+hsdoM_qD
53
+ Fox X0wxIXc_KdGC1z9t
54
+ Gull vnkEml-27mJJ1DmC
55
+ Hyena scpcqlNhTdpjbn.7
56
+ Lion TiMrSkoCjOj5wQ-+
57
+ Panda iDJ+fkJDiv,8y+-h
58
+ Rat map_sqAjAucsDsPh
59
+ Shark n1*-a4.BzPbAugUP
60
+ Spider Iuw6T%4qDVQyRiZh
61
+ Turtle PndQxbYFm0%HsCNf
62
+ Wolf Q%eLIONHqscny7on
63
+ Zebra VQRD!27jVnVSpC.E
64
+ ```
65
+
66
+ Command line options:
67
+
68
+ ```
69
+ forgiva [-h HOST] [-a ACCOUNT-ID] [-l LENGTH] [-s] [-c [1-3]] [-e] [OPTION...]
70
+
71
+ Help Options:
72
+ -?, --help Show help options
73
+
74
+ Application Options:
75
+ -h, --host-name=HOST Host/Web Site/Domain name (e.g.: facebook.com)
76
+ -a, --account=ACCOUNT-ID Account id to log-in to host such as such as e-mail address or nick-name etc.
77
+ -r, --renewal-date=DATE Date for passwords to generate
78
+ -l, --length=LENGTH Password length (Default: 16)
79
+ -s, --save-credentials Save host name and account to local database to remember next time
80
+ -c, --complexity=C_LEVEL 0-3 complexity level of password generation. (Default: 0)
81
+ -e, --select-credentials Select host and account info from saved list of credentials. If just host or account specified then you get filtered credentials.
82
+ -t, --test Runs core tests for the algorithm
83
+ ```
84
+
85
+ ## Algorithm
86
+
87
+ Forgiva uses following digest and encryption algorithm to complex password
88
+ generation phases:
89
+
90
+ for encryption;
91
+
92
+ [des-ede3-cbc](https://en.wikipedia.org/wiki/Triple_DES) c[amellia-128-cbc camellia-192-cbc camellia-256-cbc](https://en.wikipedia.org/wiki/Camellia_(cipher)) [cast5-cbc](https://en.wikipedia.org/wiki/CAST-128)
93
+ [bf-cbc](https://en.wikipedia.org/wiki/Blowfish_(cipher)) [aes-128-cbc aes-192-cbc aes-256-cbc](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)
94
+
95
+ for hashing;
96
+
97
+ [sha512 sha384 sha256 sha224](https://en.wikipedia.org/wiki/SHA-2) [sha1](https://en.wikipedia.org/wiki/SHA-1) [sha](https://en.wikipedia.org/wiki/SHA-1#SHA-0) [md5](https://en.wikipedia.org/wiki/MD5) [md4](https://en.wikipedia.org/wiki/MD4) [ripemd160](https://en.wikipedia.org/wiki/RIPEMD)
98
+
99
+ Depending on data provided by the user Forgiva may or may not use all the encryption and hashing algorithms in an password re-generation process.
100
+
101
+ Algorithm uses 4 key data to generate password(s);
102
+
103
+ * Host (ex. google.com/facebook.com/192.168.0.1 etc.)
104
+ * Account (ex. root/abc@mail.com etc.)
105
+ * Renewal date
106
+ * Master key (SHA512 hash value of user entered key)
107
+
108
+
109
+ ### Basic Algorithms
110
+
111
+ ##### A. Hashing
112
+
113
+ Forgiva generates hashes by keeping key-space stable. n-bits of data gets hashed to n-bits of data by dividing data into hash-size.
114
+
115
+ ```
116
+ algorithm forgiva-hashing
117
+ Input: Value to get hashed as DATA, Hashing algorithm HALG
118
+ Output: Hashed input data
119
+ if HALG.hash-size < data-size
120
+ start_index = 0
121
+ end_index = HALG.hash-size
122
+ while start_index < DATA size
123
+ input_block = DATA content from start_index to end_index
124
+ output_block = HALG.hash(input_block)
125
+ result = result appended output_block
126
+ start_index = end_index
127
+ end_index = start_index + HALG.hash-size
128
+ return result with the same size of DATA
129
+ else
130
+ return ALG.hash(DATA)
131
+ ```
132
+ ##### B. Iterative Hashing
133
+
134
+ Resembles hashing a value with various algorithms which are chosen by the characters of the value. Before getting into algorithm it must be understood that hashing algorithms are contained in an array and gets chosen by index number of it.
135
+
136
+ ```
137
+ algorithm forgiva-iterative-hashing
138
+ Input: Value to hashed as DATA, Algorithm array AARRAY
139
+ Ouput: Hashed input data
140
+ final_value = DATA
141
+ for each character C in DATA
142
+ algorithm = AARRAY index of (C code num modulus AARRAY)
143
+ final_value = forgiva-hash(final_value, algorithm)
144
+ return final_value
145
+ ```
146
+
147
+ ##### C. Encrypting
148
+
149
+ Encryption process with Forgiva is totally same with the algorithms except;
150
+
151
+ * Data block sizes gets fit into algorithm block sizes by padding zeroes or shortening.
152
+ * Encryption key gets put into PBKDF2_HMAC_SHA1 algorithm with 10_000 iteration and initialization vector (IV) is set as 'SHA512' value of encryption key.
153
+
154
+
155
+ ##### D. Iterative Encryption
156
+
157
+ It's totaly same iteration-method used iterative hashing by using encryption algorithm array. As a different approach there is two input data and one will be used data to get encrypted and the other one will be used as key.
158
+
159
+
160
+ ```
161
+ algorithm forgiva-iterative-encryption
162
+ Input: Value to get encrypted as DATA, Value to used in encryption as DATA2, Algorithm array AARRAY
163
+ Ouput: Encrypted input data
164
+ final_value = DATA
165
+ for each character C in DATA
166
+ algorithm = AARRAY index of (C code num modulus AARRAY size)
167
+ final_value = forgiva-encrypt(algorithm,final_value,DATA2)
168
+ return final_value
169
+ ```
170
+ ### Password generation process
171
+
172
+
173
+ #### 1. Iterative hashing
174
+
175
+ Host, Account, Renewal Date and Master key gets into **forgiva-iterative-hashing** algorithm twice.
176
+
177
+ ```
178
+ Output: Hashed Host -> HHOST
179
+ Hashed Account -> HACCOUNT
180
+ Hashed Renewal Date -> HRDATE
181
+ Hashed Master Key -> HMKEY
182
+ ```
183
+
184
+ #### 2. Iterative encryption
185
+
186
+ Hashed datas gets into **forgiva-iterative-encryption** process as pairs and finally whole encryption phase reduces into one result.
187
+
188
+ ```
189
+ algorithm forgiva-encrypted-inputs
190
+ Input: Hashed Host as HHOST, Hashed Account HACCOUNT, Hashed Renewal Date HRDATE, Hashed Master Key as HMKEY
191
+ Output: Encrypted result as DATA
192
+ first_pair_pre = forgiva-iterative-encryption(HHOST, HACCOUNT)
193
+ first_pair = forgiva-iterative-encryption(first_pair_pre, HMKEY)
194
+ second_pair = forgiva-iterative-encryption(HRDATE,HMKEY)
195
+ return forgiva-iterative-encryption(first_pair,second_pair)
196
+ ```
197
+
198
+ #### 3. Password derivation
199
+
200
+ Forgiva uses PBKDF2-HMAC as base of the key-derivation family and uses **forgiva-encypted-inputs** as salt mechanism.
201
+
202
+ Depending on choices of the complexity it uses SHA1 (Normal),SHA256 (Intermediate) and SHA512 (Advanced) hashing algorithms.
203
+
204
+ ```
205
+ algorithm key-derivation
206
+ Input: forgiva-encrypted-inputs as SALT, SHA512 value of master key as KEY
207
+ Output: Array of password sized of animal count
208
+ hash = KEY
209
+ for each Animal
210
+ hash = PBKDF2_HMAC_SHA1(hash,SALT, 10.000 iterationg with 32 bit key expectation)
211
+ password = forgiva-hash-to-password(hash)
212
+ push password to return animal array
213
+ ```
214
+
215
+
216
+ #### 3.1. Hash to password conversion
217
+
218
+ Due to choice of complexity Forgiva uses different character-ranges to generate a good password by using hashes.
219
+
220
+
221
+ ```
222
+ algorithm hash-to-password
223
+ Input: Hashed value as DATA, characters which will be used in password as CHARACTER_ARRAY
224
+ Output: 512 bit of data as KEY
225
+ temporary_hash = SHA512(DATA)
226
+ for each character C in temporary_hash
227
+ password += CHARACTER_ARRAY index of (C code num modulus CHARACTER_ARRAY size)
228
+ return password
229
+
230
+ ```
231
+
232
+ ## Intellectual Property
233
+
234
+ Except for the components mentioned within their own copyright restrictions, the Forgiva code in this repository is copyright (c) 2016 Sceptive and under [CC BY-NC-SA 4.0 license.](https://creativecommons.org/licenses/by-nc-sa/4.0/)
235
+
236
+ ## References
237
+
238
+ [1] [PKCS #5: Password-Based Cryptography Specification Version 2.0](https://tools.ietf.org/html/rfc2898)
239
+
240
+ [2] [US Secure Hash Algorithms (SHA and HMAC-SHA)](https://tools.ietf.org/html/rfc4634)
241
+
242
+ [3] [HMAC: Keyed-Hashing for Message Authentication](https://tools.ietf.org/html/rfc2104)
data/bin/forgiva ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'forgiva_test'
4
+ require 'forgiva_commands'
5
+ require 'constants'
6
+
7
+ BANNER = Constants::COLOR_CYA + "\n .-\" L_ " +
8
+ Constants::COLOR_CYA + " FORGIVA (" + Constants::COLOR_MGN + "Open Source Edition" + Constants::COLOR_CYA + ")\n " +
9
+ Constants::COLOR_CYA + ";`, / ( o\\ " +
10
+ Constants::COLOR_CYA + " The new-age password manager\n" +
11
+ Constants::COLOR_CYA + " \\ ; `, / \n" +
12
+ " ;_/\"`.__.-\" \n\n" + Constants::COLOR_RST
13
+
14
+ USAGE = <<ENDUSAGE
15
+ Usage:
16
+ forgiva [-h HOST] [-a ACCOUNT-ID] [-l LENGTH] [-s] [-c [1-3]] [-e] [OPTION...]
17
+ ENDUSAGE
18
+
19
+ HELP = <<ENDHELP
20
+
21
+ Help Options:
22
+ \t-?, --help Show help options
23
+
24
+ Application Options:
25
+ \t-h, --host-name=HOST Host/Web Site/Domain name (e.g.: facebook.com)
26
+ \t-a, --account=ACCOUNT-ID Account id to log-in to host such as such as e-mail address or nick-name etc.
27
+ \t-r, --renewal-date=DATE Date for passwords to generate
28
+ \t-l, --length=LENGTH Password length (Default: 16)
29
+ \t-s, --save-credentials Save host name and account to local database to remember next time
30
+ \t-c, --complexity=C_LEVEL 0-3 complexity level of password generation. (Default: 0)
31
+ \t-e, --select-credentials Select host and account info from saved list of credentials. If just host or account specified then you get filtered credentials.
32
+ \t-t, --test Runs core tests for the algorithm
33
+ ENDHELP
34
+
35
+
36
+ puts BANNER
37
+
38
+ hash_args = {}
39
+
40
+ t_hash_args = Hash[ ARGV.join(" ").scan(/--?([^=\s]+)(?:[=\s+]?([^-]\S+))?/) ]
41
+
42
+
43
+ # Fixes bug if somehow option get set as value
44
+ t_hash_args.each do |key,val|
45
+
46
+ if (val == nil) then
47
+ hash_args[key] = nil
48
+ else
49
+ if (val.strip.start_with?("-")) then
50
+ hash_args[key] = nil
51
+ hash_args[val.strip.gsub(/-/,'')] = nil
52
+ else
53
+ hash_args[key] = val
54
+ end
55
+ end
56
+ end
57
+
58
+
59
+ if (hash_args.key?('?') || hash_args.key?('help')) then
60
+ puts USAGE
61
+ puts HELP
62
+ exit 1
63
+ end
64
+
65
+ if (hash_args.key?('t') || hash_args.key?('test')) then
66
+ ForgivaTest.run_tests
67
+ exit 1
68
+ end
69
+
70
+ ForgivaCommands.new(hash_args).run
data/forgiva.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = 'forgiva'
3
+ gem.version = '1.0-0'
4
+ gem.date = '2016-07-12'
5
+
6
+ gem.summary = 'Forgiva'
7
+ gem.description = 'The new-age password manager.'
8
+ gem.authors = ['Harun Esur']
9
+ gem.email = 'root@sceptive.com'
10
+ gem.homepage = 'http://sceptive.com'
11
+ gem.license = 'MIT'
12
+ gem.requirements << 'Ruby should be compiled with openssl support.'
13
+
14
+ gem.executables << 'forgiva'
15
+
16
+ gem.files = `git ls-files`.split("\n")
17
+
18
+ gem.add_runtime_dependency 'highline', '~> 1.6', '>= 1.6.20'
19
+
20
+ gem.add_development_dependency 'rubocop', '~> 0.26'
21
+ end
data/lib/constants.rb ADDED
@@ -0,0 +1,53 @@
1
+ # Algorithms, password characters, animals
2
+ module Constants
3
+
4
+ ENC_ALGS = %w(des-ede3-cbc camellia-128-cbc camellia-192-cbc camellia-256-cbc cast5-cbc bf-cbc aes-128-cbc aes-192-cbc aes-256-cbc).freeze
5
+ HASH_ALGS = %w(sha512 sha384 sha256 sha224 sha1 sha md5 md4 ripemd160).freeze
6
+
7
+ LETTERS = %w(q w e r t y u i o p a s d f g h j k l z x c v b n m).freeze
8
+ BIG_LETTERS = %w(Q W E R T Y U I O P A S D F G H J K L Z X C V B N M).freeze
9
+ NUMBERS = %w(0 1 2 3 4 5 6 7 8 9).freeze
10
+ SPECIAL_CHARS = %w(. @ + - * / % _ ! ,).freeze
11
+
12
+ INTERMEDIATE_CHARS = %w(| # $ ; \\ ( ) > < " =).freeze
13
+
14
+ ADVANCED_CHARS = %w(´ ~ £ ¢ § ^ & ± { }).freeze
15
+
16
+ PASSWORD_CHARS = (LETTERS + BIG_LETTERS + NUMBERS + SPECIAL_CHARS).freeze
17
+
18
+ PASSWORD_CHARS_INTERMEDIATE = (PASSWORD_CHARS + INTERMEDIATE_CHARS).freeze
19
+
20
+ PASSWORD_CHARS_ADVANCED = (PASSWORD_CHARS_INTERMEDIATE + ADVANCED_CHARS).freeze
21
+
22
+ ANIMALS = %w(Ape Bat Bear Whale Crow Dog Duck Cat Wasp Fox Gull Hyena Lion Panda
23
+ Rat Shark Spider Turtle Wolf Zebra).freeze
24
+
25
+ FORGIVA_PG_SIMPLE = 1
26
+ FORGIVA_PG_INTERMEDIATE = 2
27
+ FORGIVA_PG_ADVANCED = 3
28
+
29
+ COLOR_BLK = Gem.win_platform? ? "" : "\x1b[0;30m"
30
+ COLOR_RED = Gem.win_platform? ? "" : "\x1b[0;31m"
31
+ COLOR_GRN = Gem.win_platform? ? "" : "\x1b[0;32m"
32
+ COLOR_BRN = Gem.win_platform? ? "" : "\x1b[0;33m"
33
+ COLOR_BLU = Gem.win_platform? ? "" : "\x1b[0;34m"
34
+ COLOR_MGN = Gem.win_platform? ? "" : "\x1b[0;35m"
35
+ COLOR_CYA = Gem.win_platform? ? "" : "\x1b[0;36m"
36
+ COLOR_LGR = Gem.win_platform? ? "" : "\x1b[0;37m"
37
+ COLOR_GRA = Gem.win_platform? ? "" : "\x1b[1;90m"
38
+ COLOR_LRD = Gem.win_platform? ? "" : "\x1b[1;91m"
39
+ COLOR_LGN = Gem.win_platform? ? "" : "\x1b[1;92m"
40
+ COLOR_YEL = Gem.win_platform? ? "" : "\x1b[1;93m"
41
+ COLOR_LBL = Gem.win_platform? ? "" : "\x1b[1;94m"
42
+ COLOR_PIN = Gem.win_platform? ? "" : "\x1b[1;95m"
43
+ COLOR_LCY = Gem.win_platform? ? "" : "\x1b[1;96m"
44
+ COLOR_BRI = Gem.win_platform? ? "" : "\x1b[1;97m"
45
+ COLOR_RST = Gem.win_platform? ? "" : "\x1b[0m"
46
+
47
+ # Set true to dump password generation details
48
+ DEBUG_OUTPUT = false
49
+
50
+
51
+
52
+
53
+ end