Domanda firefox: decriptare i messaggi criptati con gpg all'interno di una pagina web

Stato
Discussione chiusa ad ulteriori risposte.

clyns

Utente Iron
22 Giugno 2022
4
2
0
7
Su alcune pagine web che fanno parte di forum con messaggi postati da me, spesso aggiungo parti criptate che contengono dati tecnici personali.
Ad esempio https://pasteboard.co/bOr4l8dpzmBo.png (vedere la parte finale)

Ma veniamo al dunque.

C'è qualche estensione per firefox per decriptarle istantaneamente o premendo qualche apposito tasto (come fa thunderbird quando un messaggio contiene parti criptate).

Si, naturalmente all'estensione bisogna fornire le apposite chiavi private, ovviamente!!!
 
Una soluzione sarebbe un'estensione o un userscript che usa openpgpjs, che è una libreria in grado di cifrare e decifrare interamente in javascript. Sul sito ufficiale delle addon di firefox se ne trova solo una che lo fa, ma non la consiglierei essendo poco usata, non mantenuta e con il codice sorgente compilato e compresso (potrebbe anche nascondere malware).

Se ne capisci di programmazione ti consiglio di creartela da solo, ti basta includere quella libreria, cercare il testo PGP MESSAGE nella pagina, decifrarlo con la libreria e sostituire il testo. Se invece non ne capisci puoi: commissionarlo a uno sviluppatore, lasciar perdere, oppure accettare il rischio e installare alla cieca l'estensione che viene fuori cercando "PGP" tra le addons.
 
And if the message is inside a file, can is decrypted?

I tried

Codice:
$ cat multi-part.txt.asc
plain text 1
-----BEGIN PGP MESSAGE-----

hQGMAyHa6HqE1N3qAQv/RzVdfwDbmel1Rs3MwU8Oq9YzOxQvYSG3C/4IHOxM+7dJ
u4vpTJ400D28/PeA/y6/SatzelBdko84yMFqn+qNRD2EveLdKyNOyfvr/jOe5bR9
GRtNZAOmOpAntKIrbYDJAcfamj84bhEl95f2JqywJ2K/aaRR7eB3zVg1zh2Iiy79
KHHioBonP3mp7bUBLbBOfsEdIvgo7Keh5zH4G7Zef2e+9Rl4TW0p/WpJ9hYjWL+1
/IGSVzedl75NrcZqIi/CCP7AwAhHs3KpKVQQ00AMVRAgcvIm1bkuah/Q5iKMgSZa
ZtSObfcehGN5uOC0Wt6IrRrW2KnTBhM8r21lF9N7b6EjzDyzQl3NRF+YDUW9diUX
tZZLyuQ4YJluCQyG3GSYxSD+7aDbClG4Vd5jNqsjg7R659NGLjGNSywdwL8j5BMC
3UMZWbTyu8Dc87FpPOZavpacrczsfdw6qT3qnpP9+WvJ1OaY+zuTGifs88dM6c7I
dOli4+br7uuIEyjI6LQ60k4BVTSPjsfowwVpqyQBmEV/uWgJ1FcT5Bk/FuwVYU+W
VepWhDLOaASDelERW3UPvaVyrP71tV9Em2i9evIcPxrXhAjBtJzOmVn7GiP0qbM=
=tbyJ
-----END PGP MESSAGE-----
plain text 2

$ gpg multi-part.txt.asc

$ cat multi-part.txt
helo world

but it only works partially.

The message 'helo world' is decoded, but plain text 1 and plain text 2 are discarded.

Why?
 
And if the message is inside a file, can is decrypted?

I tried

Codice:
$ cat multi-part.txt.asc
plain text 1
-----BEGIN PGP MESSAGE-----

hQGMAyHa6HqE1N3qAQv/RzVdfwDbmel1Rs3MwU8Oq9YzOxQvYSG3C/4IHOxM+7dJ
u4vpTJ400D28/PeA/y6/SatzelBdko84yMFqn+qNRD2EveLdKyNOyfvr/jOe5bR9
GRtNZAOmOpAntKIrbYDJAcfamj84bhEl95f2JqywJ2K/aaRR7eB3zVg1zh2Iiy79
KHHioBonP3mp7bUBLbBOfsEdIvgo7Keh5zH4G7Zef2e+9Rl4TW0p/WpJ9hYjWL+1
/IGSVzedl75NrcZqIi/CCP7AwAhHs3KpKVQQ00AMVRAgcvIm1bkuah/Q5iKMgSZa
ZtSObfcehGN5uOC0Wt6IrRrW2KnTBhM8r21lF9N7b6EjzDyzQl3NRF+YDUW9diUX
tZZLyuQ4YJluCQyG3GSYxSD+7aDbClG4Vd5jNqsjg7R659NGLjGNSywdwL8j5BMC
3UMZWbTyu8Dc87FpPOZavpacrczsfdw6qT3qnpP9+WvJ1OaY+zuTGifs88dM6c7I
dOli4+br7uuIEyjI6LQ60k4BVTSPjsfowwVpqyQBmEV/uWgJ1FcT5Bk/FuwVYU+W
VepWhDLOaASDelERW3UPvaVyrP71tV9Em2i9evIcPxrXhAjBtJzOmVn7GiP0qbM=
=tbyJ
-----END PGP MESSAGE-----
plain text 2

$ gpg multi-part.txt.asc

$ cat multi-part.txt
helo world

but it only works partially.

The message 'helo world' is decoded, but plain text 1 and plain text 2 are discarded.

Why?

It's by design. These markers are meant to locate the message anywhere it is in the text and gpg tool will decode only that because it doesn't know about anything else and trying to parse strings in unknown format could result in unintended behaviors (such as mixing authenticated data with other stuff). You could run gpg to decrypt the message and then use a tool like sed to strip away the pgp message and display the remaining strings.

Example: sed '/^-----BEGIN PGP/,/^-----END PGP/d' file
You can also use it in pipeline instead of a static file but the command needs to be changed a bit.
 
Stato
Discussione chiusa ad ulteriori risposte.