File desc:
public.ascis the public keyhello.txtis the plaintext file
Then, we try to use public.asc to encrypt the hello.txt .
import public key:
gpg --import public.ascencrypt use the public key:
gpg -o hello.txt.asc --encrypt --recipient BE1F3C466E873A89 hello.txtBE1F3C466E873A89 is the key id.
You can not decrypt hello.txt.asc unless you have the private key, and hello.txt.asc will change every time as it contains the timestamp.
For Test : You can send us an encrypted file, and we check that it can be decrypted by our private key .
you can run com.ciicgat.Main
for mor information, see gnupg - java pgp encrypt file with public key in asc file - Stack Overflow