Cryptographic algorithm using public key cryptosystem 🎉
RSA is an asymmetric cryptographic algorithm where each user has two keys
- private
- public
It uses data from the theory of numbers and in combination with the particularly large keys achieves encryption in a balance arithmetic that makes decryption by factorization impossible.
- Create a private key1
Description | |
---|---|
p | Prime |
q | Prime |
e | number |
n | p * q |
e,n | Public key |
d | Private key |
- Message encryption
- Message decryption
- Message signing
- Signature Verification
Large numbers bn2 (multiprecision integer arithmetics) library provided by the openssl 3 For more information, you can check bn.
Check the virtual Ubuntu SEED machine 16.04.
- Download SEEDUbuntu-v 16.04 from site
https://seedsecuritylabs.org/lab_env.html
- Download and install VM engine from site
https://www.virtualbox.org/wiki/Downloads
-
Build a new VM os importing SEEDUbuntu
- Select OS Type Linux 4 version Ubuntu
-
PRE-build VM hard disk from SEED file
- From the unzipped folder, select
xxxx.vmdk
where xxx is the SEED_name_version
-
Setting->General->Advanced
- Shared Clipboard : Bidirectional
- Drag'n'Drop : Bidirectional
- Controller : VBoxVGA
- Processor : 1+
-
Open terminal
$ sudo apt update
$ sudo apt install build-essential checkinstall zlib1g-dev -y
$ cd /usr/local/src/
$ wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
$ tar -xf openssl-1.0.2o.tar.gz
$ cd openssl-1.0.2o
$ ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
$ make
$ make test
$ make install
- Configure libraries
$ cd /etc/ld.so.conf.d/
$ vim openssl-1.0.2o.conf
- Paste
$ /usr/local/ssl/lib
- Reload link
$ sudo ldconfig -v
You can edit with atom or any other editor
OpenSSL is installed in the '/usr/local/ssl'
directory.
Any .c
file can be executed as
gcc XXXXX -o XXXXXX.c -lcrypto
where XXXXX
filename
- Assignment for cryptography
Footnotes
-
For simplicity, we use numbers 128 bits. Must be 512. ↩
-
BIGNUM can represent every great number, see https://www.openssl.org/docs/man1.0.2/man3/bn.html ↩
-
Make sure install version ubuntu x32 architecture compatible with SEEDUbuntu. ↩