Ticker

6/recent/ticker-posts

gpg, cksum command in linux




 

GPG is tool for secure communication.

cksum shows CRC(Cyclic Redundancy Check) value, it is unique for each files.

it can be used when you want to check if two files are same.

$cksum hello.py
2596300010 202 hello.py

Cryptography are basically of two types:

  • Secret key OR Symmetric Single key
  • Asymmetric OR public/private key

Symmetric users a single key and it is shared by both sender and receiver, if the key is compromised so are the communication.

Asymmetric key users users private/public  key to encrypt/decrypt  only share public key with others.


To check the sum there are other ways also:

md5sum it can be used when you want to check if two files are same.

$md5sum hello.py
df718d40d6fc8cb4599e09ebc4381d87  hello.py

sha256sum

$sha256sum hello.py
e38c050f1914c5f886e2ec1efb26d042244f060324b503e91b45619b2bd4f17b  hello.py


load existing public key and private key using gpg tool and encrypt and decrypt the file.

$sudo su -
$gpg --import public_key.asc
$gpg --import private_key.asc

$gpg --list-keys
$gpg --list-secret-keys

###encrypting a encrypt_me.txt file
$gpg --encrypt -r abcd@xyz.com --armor < encrypt_me.txt  -o encrypted_me.asc

###decrypting a decrypt_me.asc file 
$gpg --decrypt decrypt_me.asc > decrypted_me.txt


Post a Comment

0 Comments