Member-only story
OpenSSL: Ciphering With Certificates
Just Between Us
2 min readOct 10, 2020
After credentials and keys generation, beyond attestation and authentication, we can cipher.
Caveat: Do not use the same keys to cipher and sign / verify.
The sample utility found at: _lab_cipher_with_cert, illustrates the use.
Ciphering
The sample utility shows how ciphering can be done with using digital certificates.
* Use lab_rsa_oaep_cipher.sh for a quick demo view.
$ ./lab_rsa_oaep_cipher.sh
Caveat: RSA public key can encrypt a file less than the key size, hence, it is usually used to cipher symmetric keys, hence, for data > key size, 'error: data too large for key size'Generating RSA private key, 1024 bit long modulus (2 primes)
........+++++
....................................+++++
e is 65537 (0x010001)Export public key to: ./public.pem
writing RSA key=====================================================
file (plaintext in): ./messages/message_plaintext.txt
=====================================================
can you see me now?=====================================================
file (ciphered out): ./message_ciphered.out
=====================================================
=▒▒▒GD▒▒+▒▒DXM▒9܅_▒▒᾿▒▒▒▒O▒▒OW▒▒▒▒
3>J7ꠛ▒a▒▒_%▒e▒▒_▒v▒▒▒ȅL▒▒p2▒▒?wr▒▒S▒▒▒▒ƻ▒=f▒▒
▒▒2.g▒;K=====================================================
file…