This repository contains examples of how to use various Ruby libraries to perform cryptographic operations safely and with purpose.
The primary purposes of cryptography are:
- Confidentiality
- Integrity
- Non-repudiation
- Authentication
The examples in this repository depend on the https://github.com/RubyCrypto/rbnacl gem and the libsodium C library.
To install dependencies, run make
Symmetric examples: encrypt.rb
& decrypt.rb
Asymmetric examples: pkencrypt.rb
& pkdecrypt.rb
Run either encrypt.rb
or pkencrypt.rb
with the appropriate arguments and the final output should show the command required to decrypt.
Hash example: hash.rb
Run hash.rb
with the same input argument and you should get the same output argument every time.
Asymmetric example: pksign.rb
& pkverify.rb
Run pksign
with the appropriate arguments and the final output should show the command required to verify.
Asymmetric examples: pksign.rb
& pkverify.rb
Run pksign
with the appropriate arguments and the final output should show the command required to verify.
Symmetric example: auth.rb
& verify.rb
Run auth.rb
with the appropriate arguments and the final output should show the command required to verify.