Commit Graph

45 Commits

Author SHA1 Message Date
0cbbc77976
Merge branch 'master' into file-sys 2020-08-28 19:28:25 +03:00
96e8f753ff
prepare merge 2020-08-28 19:27:56 +03:00
d51a42589c
Use sys.exit() instead of exit():
exit() cuases stack trace output from pyinstaller exe.
	It is also recommended to use sys.exit() in prodcution.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-08-28 19:02:08 +03:00
c059a7dccd
version 1.2.1
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-08-28 17:52:18 +03:00
7ae3e4dc04
Improved and accurate signature output
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-08-28 17:47:48 +03:00
d7a8ec02ea
Rename rsa.py to hrsa:
hashbang in hrsa file will invoke python3 on linux
2020-07-06 02:18:03 +03:00
960468ad21
Output header/footer 2020-07-06 00:29:30 +03:00
51d9571a37
Save message to file 2020-07-05 10:08:51 +03:00
30069c3d2b
Print message for unknown sig.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-21 23:53:04 +03:00
9738da7dca
Merge branch 'master' of https://apollo-server.ddns.net/gitea/Hesham/hesham-rsa 2020-04-21 07:41:53 +03:00
bdb2fa7780
base-16 representation for all.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-21 07:40:31 +03:00
c351efa716
Print out n, e, d after key gen. 2020-04-20 21:20:34 +03:00
321fb3ec01
Added help command 2020-04-20 00:19:09 +03:00
23b421ee1f
print key command.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-19 20:26:05 +03:00
e086a2cdcc
Cracking keys function:
- Given n and e, try factoring n and
	generate d if p or q is found.
	works well with 16-bit to 64-bit keys.
	larger keys take vary long which is
	good.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-19 20:24:57 +03:00
bfdbca50e7
Simple Cracking. Vary inefficient.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-19 16:25:45 +03:00
e5a66e4d29
Cleanup:
- Interface exit codes
	- Clean up
2020-04-19 15:45:51 +03:00
611a6c45ea
Added Miller Rabin's algorithm:
- Now can generate a 4096-bit key in seconds.
	However, a longer key makes the cipher way too
	long. Should make a padding or an encoding to
	reduce the cipher size with big keys.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 22:49:06 +03:00
06793f5fb7
Updated list command output. 2020-04-18 17:53:12 +03:00
8d2b822999
Fixed list output.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 17:18:58 +03:00
0cb6d56236
Added export key.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 15:23:06 +03:00
45c1abd0fa
Fixed output of listKeys().
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 14:12:46 +03:00
bfc572386e
Improved interface:
- Catch wrong number of args.
	- Logic was not correct.
	- Print command template.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 14:12:01 +03:00
998089f94c
Added list keys command.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 03:27:08 +03:00
d1257320a8
Added 4th argument to sign with a given key other than
the one for encryption

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 03:16:35 +03:00
1924c14df0
Fixed bugs:
- Key save did not save all values.
	- Index out of range of tempKey when only
	  it is only public part.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 03:15:08 +03:00
ff3df34597
Full signing and verification system.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-18 02:27:16 +03:00
486e40c7f5
Add signiture in last word.
Redid key save file to inclue id.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-17 23:53:07 +03:00
719d54aaa1
New key save format:
- Save p, q, phi also
	- Added index constants for readability

Updated gitignore


Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-17 20:35:20 +03:00
7facaf1207
Split words in message into a list of strings and encrypt each.
This should allow unlimited length of any message.
2020-04-17 17:31:34 +03:00
01e3f69c94
Merge branch 'master' of https://apollo-server.ddns.net/gitea/Hesham/hesham-rsa 2020-04-17 16:37:10 +03:00
654cb52ca4
Check if keys dir exists. if not make it before saving to prevent exception. 2020-04-17 16:34:03 +03:00
4c16bbc282
Improved key print 2020-04-17 16:32:10 +03:00
18df4d2b07
Added a second thread. Should be faster. up to 140 bits 2020-04-17 12:23:08 +03:00
936a6eebb6
New keys folder and global variables.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-17 05:21:58 +03:00
f9ff56651d
rsa gen: cleaner stdout with carriage return. (printing to the same line)
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-17 04:40:31 +03:00
b2dc176d40
Changed key representation to hex r-16.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2020-04-17 04:38:09 +03:00
db2a852cf3
isPrime() function/algo optimization:
insted of taking all integers from 2 to K, take only odds
	since we know that the even prime is 2. This should in theory
	reduce the time to check primilaty to half.
2020-04-16 21:51:36 +03:00
1954308cb4
improved interface
- Accept key generation size. (not practical above 64-bit)
	- Decrypt from command args only for now
	- Catch Unicode Decode Error cuased by wong key or size.
2020-04-16 18:56:04 +03:00
feeea933c3
Working interface.
- Encrypt a signle word message. for now
    - Decrypt only with target private key
    - Runtime errors when using wrong key to decrypt or message too long.
2020-04-16 14:33:24 +03:00
a1e05a572a
Interfacing changes:
- Split into methods.
    - Added a cli interface with commands 'gen <filename>' to generate keys
      and 'encrypt <message> <publicKey>' to encrypt a message
      to the passed key.
    - Read and save keys.
2020-04-16 12:40:48 +03:00
1993551a59
Working key pair generation, encryption and decryption
TODO:
   - Clean up
   - Split into methods
   - Save a key pair in a file (interactivly)?
2020-04-16 09:48:31 +03:00
1a591cc75e
getPrime() method working. gets random prime based on bit size. 2020-04-16 05:54:36 +03:00
7fe7065700
isPrime() method working with good accuracy. needs more testing. 2020-04-16 05:11:00 +03:00
9f5d9fe5a5
init commit 2020-04-16 00:05:03 +03:00