Professional Documents
Culture Documents
Lab 2: Classical Encryption Techniques, RSA, DES, Hash and Authentication Protocols
Lab 2: Classical Encryption Techniques, RSA, DES, Hash and Authentication Protocols
I. Objectives
Get knowledge of the use of some common cryptographic techniques:
Monoalphabetic substitution cipher, RSA, DES
II. Preparation
You need to install OpenSSL with some requirements:
make
Perl 5
an ANSI C compiler
a development environment in form of development libraries and C header files
a supported Unix operating system
CuuDuongThanCong.com https://fb.com/tailieudientucntt
III. Monoalphabetic substitution cipher
The earliest known use of a substitution cipher, and the simplest, was by Julius Caesar.
The Caesar cipher involves replacing each letter of the alphabet with the letter standing
three places further down the alphabet. For example,
Note that the alphabet is wrapped around, so that the letter following Z is A. We can
define the transformation by listing all possibilities, as follows:
plain: a b c d e f g h i j k l m n o p q r s t u v w x y z
cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
IV. RSA
OpenSSL is a full featured encryption toolkit that is used to implement secure services.
Using openssl create a 2048-bit RSA key pair.
CuuDuongThanCong.com https://fb.com/tailieudientucntt
openssl rsautl -verify -in out_pri.txt -out decrypt_pri.txt -inkey
publickey.pem -pubin
6. Encrypt the text file with your public key and decrypt it with your private key.
openssl rsautl -encrypt -in input.txt -out out_pub.txt -inkey
publickey.pem –pubin
openssl rsautl -decrypt -in out_pub.txt -out decrypt_pub.txt -inkey
privatekey.pem
7. Using OpenSSL extract p, q, n, e,and d from your public-private key pair above.
V. DES
8. Encrypt and decrypt input.txt using tripple des. (giả sử password là abc)
openssl des3 -salt -in input.txt -out out.des3
openssl des3 -d -salt -in out.des3 -out output.txt -k abc
9. From where can you use the symmetric key?
Trên thực tế, các khóa này đại diện cho một bí mật được phân hưởng bởi hai bên hoặc nhiều hơn
và được sử dụng để giữ gìn sự bí mật trong kênh truyền thông tin.
10. How can the participants know the symmetric key?
Symmetric key gồm có public key và private key. Người sử dụng chỉ cần biết private key của mình
và bảo mật nó. Khi nhận thông điệp, chỉ cần dùng public key của người gửi để giải mã.
CuuDuongThanCong.com https://fb.com/tailieudientucntt