Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat application/pgp-encrypted as text #102

Open
vinliao opened this issue Nov 14, 2020 · 3 comments
Open

Treat application/pgp-encrypted as text #102

vinliao opened this issue Nov 14, 2020 · 3 comments

Comments

@vinliao
Copy link

vinliao commented Nov 14, 2020

Copying signed message works well, but wl-clipboard copies nothing when it's used on signed+encrypted text.

Steps to reproduce

  1. Create a file called msg.txt with the content hello world.
  2. Sign with private key
  3. Encrypt
  4. Run cat signed-and-encrypted.asc | wl-copy
  5. Try pasting. Nothing happens.

Here's an example of a signed and encrypted message. You can create a file with this as a content, then try copying it with wl-copy.

-----BEGIN PGP MESSAGE-----

hQIMA0sMAuCg7XG9ARAArC4rC+R4mwXEEgtGo4VmAv5mPdzWvbAdKRx/NVJl0g8e
YM4P03+Pofa655GGx8ZOD+fVKSFrn9yfiUJru2bR6svNbR/wOAS5II4SCpxD91vT
WIpSjaeUNRejqqvNSGXJabcVxtXrA/tAoQNrcnOV9N3CM5OmOd4vPN1xUj77Ui8b
0t/oFADSWrdYoabyIoj9dbmYuBYKzFOKE3KKnd2GColsWimMAv0aKQhChV9NEoeh
4JS1Vpo/xqB9HRyNSkrD3TY0vwYJiyYWjNb15+tCTqDtzJAMetMrexqMMVnPiQ2H
m/u3N9+urD+VA7RNF/piGQsp+9NEECDQo+A+LMVHgPUUGMqDY/u0kXKXhqosv81l
jNu6i61cRRdoXrNoAxdOfWbfLdAFCBvVdWc2VnIXqgJryPR3xb7qI+xzt0Emgviv
kX5euF1xwzYuqOd55qpaP5TY3d1pkSupTEUv4WDWX7j+K8T00nHUKdW/ghDqUQTL
YthteKf9Obwoz5sfzmuzcFkvVZem1dFL29GiFucyyZRR/GLBltBbcTpcq/7R7R+c
myn77OWi1cAnM50uQrS9I0OFmteEUPE78HWtZz/BVwpW+sAxP/HQu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H2/a09lcXj7tnanBMhG0f8rDx5+
+/su+iVNz/HjzEdk5mQ8ecCMOzNYeaKyE77L72WWYYteX4kj/DY8rZSHz3+rgsH7
DD9rzhCtaQXagUNk8yJhwX/O6niy5MNd6iGJzYzU9Sn/GtIz
=Bk74
-----END PGP MESSAGE-----
@bugaevc
Copy link
Owner

bugaevc commented Nov 14, 2020

Hi!

I can successfully copy and paste your example. Is there any reason you believe that copying doesn't work?

$ wl-copy < example.asc
$ wl-paste | head -3
-----BEGIN PGP MESSAGE-----

hQIMA0sMAuCg7XG9ARAArC4rC+R4mwXEEgtGo4VmAv5mPdzWvbAdKRx/NVJl0g8e
$ wl-paste --list-types
application/pgp-encrypted

Perhaps the program you're trying to paste into doesn't recognize application/pgp-encrypted as something it can paste. You can force the MIME type to be, say, text/plain, like this:

$ wl-copy < example.asc --type text/plain

That should be enough to convince other clients that only accept text to paste your encrypted text. I should probably add yet another special case to do this automatically...

@vinliao
Copy link
Author

vinliao commented Nov 15, 2020

Oh yeah, adding --type text/plain works.

(And oh, thanks for showing me that you can use the < operator. That's a pretty cool alternative to cat & pipe.)

@bugaevc bugaevc changed the title Can't copy gpg signed and encrypted text Treat application/pgp-encrypted as text Nov 23, 2020
@setpill
Copy link

setpill commented Jan 29, 2021

I've noticed this as well, when trying to paste the contents of a .asc file into a github issue. Interestingly, firefox turns it into a garble of Chinese characters.

sim590 added a commit to sim590/dotfiles that referenced this issue Feb 6, 2023
Otherwise, some text snippets can fail to copy like PGP encrypted
messages:

bugaevc/wl-clipboard#102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants