简体   繁体   中英

GnuPG encrypt with private key

Suppose I would like to encrypt a file with my private key for whatever reason so that only people with my public key can have access to the file. How would I do this?

gpg --sign --armor file

does not work because if you omit the --armor and use

gpg --sign --compress-level 0 file

the plaintext appears in the file.gpg.

gpg --encrypt file

will also not work because that uses public keys. Does anybody know how to do this?

You unfortunately have got some fundamental misconceptions about the cryptography you want use. By definition if you want to asymmetrically encrypt some data you need to use the public key and the encrypted data can only be decrypted with the private key.

If you want to encrypt a message so that only a certain group of people can access it you can asymmetrically encrypt it with all the public keys of each individual in the group or encrypt it symmetrically with a random key and share that key with each individual in the group.

您可以使用公钥对称地加密文件,这样每个有权访问您公钥的人都可以解密您的文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM