Friday, 13 July 2018

encryption - How to convert gpg4win's binary to ascii, with Notepad++


I can reliably convert gpg4win's ascii to binary using Notepad++ option "Base64 Decode" (credit: James K Polk). Works every time.


But when I attempt the reverse, i.e. convert binary to ascii, it works sometimes and does not work other times. Here's how I'm doing it:



  • Open the binary file in Notepad++ and select "Base64 Encode".

  • Manually add the BEGIN/END PGP message lines (-----BEGIN PGP MESSAGE-----)


This works sometimes (i.e. gpg4win can decrypt the resulting file), but fails other times (gpg4win can't decrypt). I am careful to do it exactly the same way each time, making sure there are no white spaces, etc. But it only works sometimes.


How can I get it to work using Notepad++?


Note: I can do the conversion using --enarmor, but I would like to be able to do it with Notepad++. Especially since I can get it to work sometimes, so I know it's possible, and maybe I'm missing a small piece.



Answer



Notepad++ is an editor for text files, which are files that end with special binary characters that denote an end-of-line. It will always think that your text-line is found between two end-of-line characters, and will mostly ignore the end-of-line itself in its operations.


This has the potential to destroy the file when converting to Base64, since Notepad++ will convert the text between the end-of-lines, but may cause a problem with not correctly handling the end-of-lines.


In fact, it's pretty amazing for me that this has worked correctly for you for some files, and I can readily understand that it didn't for others.


I think you should really look for another solution than Notepad++ for converting to Base64.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...