exaexa / codecrypt

Post-quantum cryptography tool (THIS REPOSITORY IS ONLY A MIRROR OF THE MAIN ONE, PLEASE DO NOT FILE BUGS HERE)
https://gitea.blesmrt.net/exa/codecrypt
GNU Lesser General Public License v3.0
308 stars 40 forks source link

How to encrypt text with a private key? #3

Closed vkefallinos closed 11 years ago

vkefallinos commented 11 years ago

I have done these: ccr -g help ccr -g fmtseq128-sha --name "John Doe" # your signature key ccr -g mceqd128 --name "John Doe" # your encryption key ccr -p -a -o my_pubkeys.asc -F Doe # export your pubkeys for friends

Now I want to encrypt the message "hello" with John Dow private key. I am trying : ccr --user "John Doe" -e "hello" ccr --user John Doe -e "hello" but it doesnt work. Am I missing something obvious?

exaexa commented 11 years ago

Yes. First, when encrypting, you need to specify a recipient, not user -- this is only useful for doing signatures (read about asymmetric encryption on wikipedia to see why). Second, --encrypt and --decrypt are only simple switches and accept no values, encryption and decryption is done like this:

 echo "Hello" | ccr --encrypt -r "Some Recipient" > encrypted-message

then

ccr --decrypt < encrypted-message

should correctly produce the encrypted Hello text.