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











up vote
1
down vote

favorite












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.










share|improve this question


















  • 1




    With this approach I think you are having difficulties with characters that Notepad++ understands as end-of-line. I don't think this is viable.
    – harrymc
    Nov 14 at 17:25








  • 1




    I don't have access to a windows environment so I can't test gpg4win or Notepad++. However, using gpg I have verified that 1) gpg ignores whitespace except that the -----BEGIN PGP MESSAGE----- must end in a newline and the -----END PGP MESSAGE----- must be preceded by a newline. 2) You don't need a comment line, but if you do have one it must be terminated by a newline. 3) You don't need a checksum line, but if you have one it must be preceded by a newline and it must be the correct checksum.
    – James K Polk
    Nov 14 at 21:01










  • @james-k-polk. Hi James, I could get certutil and even openssl to work (had to add the BEGIN/END lines manually), but Notepad++ doesn't work for encoding. It's works every time for decoding though.
    – get_going
    Nov 15 at 0:21















up vote
1
down vote

favorite












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.










share|improve this question


















  • 1




    With this approach I think you are having difficulties with characters that Notepad++ understands as end-of-line. I don't think this is viable.
    – harrymc
    Nov 14 at 17:25








  • 1




    I don't have access to a windows environment so I can't test gpg4win or Notepad++. However, using gpg I have verified that 1) gpg ignores whitespace except that the -----BEGIN PGP MESSAGE----- must end in a newline and the -----END PGP MESSAGE----- must be preceded by a newline. 2) You don't need a comment line, but if you do have one it must be terminated by a newline. 3) You don't need a checksum line, but if you have one it must be preceded by a newline and it must be the correct checksum.
    – James K Polk
    Nov 14 at 21:01










  • @james-k-polk. Hi James, I could get certutil and even openssl to work (had to add the BEGIN/END lines manually), but Notepad++ doesn't work for encoding. It's works every time for decoding though.
    – get_going
    Nov 15 at 0:21













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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.










share|improve this question













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.







encryption gnupg pgp openpgp gpg4win






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 at 16:37









get_going

285




285








  • 1




    With this approach I think you are having difficulties with characters that Notepad++ understands as end-of-line. I don't think this is viable.
    – harrymc
    Nov 14 at 17:25








  • 1




    I don't have access to a windows environment so I can't test gpg4win or Notepad++. However, using gpg I have verified that 1) gpg ignores whitespace except that the -----BEGIN PGP MESSAGE----- must end in a newline and the -----END PGP MESSAGE----- must be preceded by a newline. 2) You don't need a comment line, but if you do have one it must be terminated by a newline. 3) You don't need a checksum line, but if you have one it must be preceded by a newline and it must be the correct checksum.
    – James K Polk
    Nov 14 at 21:01










  • @james-k-polk. Hi James, I could get certutil and even openssl to work (had to add the BEGIN/END lines manually), but Notepad++ doesn't work for encoding. It's works every time for decoding though.
    – get_going
    Nov 15 at 0:21














  • 1




    With this approach I think you are having difficulties with characters that Notepad++ understands as end-of-line. I don't think this is viable.
    – harrymc
    Nov 14 at 17:25








  • 1




    I don't have access to a windows environment so I can't test gpg4win or Notepad++. However, using gpg I have verified that 1) gpg ignores whitespace except that the -----BEGIN PGP MESSAGE----- must end in a newline and the -----END PGP MESSAGE----- must be preceded by a newline. 2) You don't need a comment line, but if you do have one it must be terminated by a newline. 3) You don't need a checksum line, but if you have one it must be preceded by a newline and it must be the correct checksum.
    – James K Polk
    Nov 14 at 21:01










  • @james-k-polk. Hi James, I could get certutil and even openssl to work (had to add the BEGIN/END lines manually), but Notepad++ doesn't work for encoding. It's works every time for decoding though.
    – get_going
    Nov 15 at 0:21








1




1




With this approach I think you are having difficulties with characters that Notepad++ understands as end-of-line. I don't think this is viable.
– harrymc
Nov 14 at 17:25






With this approach I think you are having difficulties with characters that Notepad++ understands as end-of-line. I don't think this is viable.
– harrymc
Nov 14 at 17:25






1




1




I don't have access to a windows environment so I can't test gpg4win or Notepad++. However, using gpg I have verified that 1) gpg ignores whitespace except that the -----BEGIN PGP MESSAGE----- must end in a newline and the -----END PGP MESSAGE----- must be preceded by a newline. 2) You don't need a comment line, but if you do have one it must be terminated by a newline. 3) You don't need a checksum line, but if you have one it must be preceded by a newline and it must be the correct checksum.
– James K Polk
Nov 14 at 21:01




I don't have access to a windows environment so I can't test gpg4win or Notepad++. However, using gpg I have verified that 1) gpg ignores whitespace except that the -----BEGIN PGP MESSAGE----- must end in a newline and the -----END PGP MESSAGE----- must be preceded by a newline. 2) You don't need a comment line, but if you do have one it must be terminated by a newline. 3) You don't need a checksum line, but if you have one it must be preceded by a newline and it must be the correct checksum.
– James K Polk
Nov 14 at 21:01












@james-k-polk. Hi James, I could get certutil and even openssl to work (had to add the BEGIN/END lines manually), but Notepad++ doesn't work for encoding. It's works every time for decoding though.
– get_going
Nov 15 at 0:21




@james-k-polk. Hi James, I could get certutil and even openssl to work (had to add the BEGIN/END lines manually), but Notepad++ doesn't work for encoding. It's works every time for decoding though.
– get_going
Nov 15 at 0:21










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










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.






share|improve this answer





















  • After some more attempts I found something interesting. If I decrypt the Base64 encoded file, I get an error (i.imgur.com/jcD4n1b.jpg). BUT, If I copy the contents of the file directly into gpg4win's notepad, it works.
    – get_going
    Nov 14 at 19:34










  • You found a method of circumventing the end-of-line problem? I don't know gpg4win so cannot explain why it works.
    – harrymc
    Nov 14 at 20:26










  • No I didn't. I just described what I observed, i.e. if I open the Base64 encoded file and copy the contents to gpg4win's notepad, it can decrypt. So I know Notepad++ is doing something right. But if I ask gpg4win to decrypt the file itself, it fails. What reliable alternative you can recommend on Windows?
    – get_going
    Nov 14 at 20:30






  • 2




    Microsoft#s certutil can do that (and much more), see this answer for a description. There are many others floating around like this one.
    – harrymc
    Nov 14 at 20:39






  • 1




    I agree with this answer. Without thorough investigation, you could say that opening a binary file in a text editor and using a plug-in that expects ascii input is an unreliable solution. I would use gpg --enarmor. certutil generates -----BEGIN CERTIFICATE----- which will prevent gpg from working.
    – evpo
    Nov 15 at 2:34











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375379%2fhow-to-convert-gpg4wins-binary-to-ascii-with-notepad%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










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.






share|improve this answer





















  • After some more attempts I found something interesting. If I decrypt the Base64 encoded file, I get an error (i.imgur.com/jcD4n1b.jpg). BUT, If I copy the contents of the file directly into gpg4win's notepad, it works.
    – get_going
    Nov 14 at 19:34










  • You found a method of circumventing the end-of-line problem? I don't know gpg4win so cannot explain why it works.
    – harrymc
    Nov 14 at 20:26










  • No I didn't. I just described what I observed, i.e. if I open the Base64 encoded file and copy the contents to gpg4win's notepad, it can decrypt. So I know Notepad++ is doing something right. But if I ask gpg4win to decrypt the file itself, it fails. What reliable alternative you can recommend on Windows?
    – get_going
    Nov 14 at 20:30






  • 2




    Microsoft#s certutil can do that (and much more), see this answer for a description. There are many others floating around like this one.
    – harrymc
    Nov 14 at 20:39






  • 1




    I agree with this answer. Without thorough investigation, you could say that opening a binary file in a text editor and using a plug-in that expects ascii input is an unreliable solution. I would use gpg --enarmor. certutil generates -----BEGIN CERTIFICATE----- which will prevent gpg from working.
    – evpo
    Nov 15 at 2:34















up vote
1
down vote



accepted










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.






share|improve this answer





















  • After some more attempts I found something interesting. If I decrypt the Base64 encoded file, I get an error (i.imgur.com/jcD4n1b.jpg). BUT, If I copy the contents of the file directly into gpg4win's notepad, it works.
    – get_going
    Nov 14 at 19:34










  • You found a method of circumventing the end-of-line problem? I don't know gpg4win so cannot explain why it works.
    – harrymc
    Nov 14 at 20:26










  • No I didn't. I just described what I observed, i.e. if I open the Base64 encoded file and copy the contents to gpg4win's notepad, it can decrypt. So I know Notepad++ is doing something right. But if I ask gpg4win to decrypt the file itself, it fails. What reliable alternative you can recommend on Windows?
    – get_going
    Nov 14 at 20:30






  • 2




    Microsoft#s certutil can do that (and much more), see this answer for a description. There are many others floating around like this one.
    – harrymc
    Nov 14 at 20:39






  • 1




    I agree with this answer. Without thorough investigation, you could say that opening a binary file in a text editor and using a plug-in that expects ascii input is an unreliable solution. I would use gpg --enarmor. certutil generates -----BEGIN CERTIFICATE----- which will prevent gpg from working.
    – evpo
    Nov 15 at 2:34













up vote
1
down vote



accepted







up vote
1
down vote



accepted






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.






share|improve this 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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 at 18:42









harrymc

248k10257545




248k10257545












  • After some more attempts I found something interesting. If I decrypt the Base64 encoded file, I get an error (i.imgur.com/jcD4n1b.jpg). BUT, If I copy the contents of the file directly into gpg4win's notepad, it works.
    – get_going
    Nov 14 at 19:34










  • You found a method of circumventing the end-of-line problem? I don't know gpg4win so cannot explain why it works.
    – harrymc
    Nov 14 at 20:26










  • No I didn't. I just described what I observed, i.e. if I open the Base64 encoded file and copy the contents to gpg4win's notepad, it can decrypt. So I know Notepad++ is doing something right. But if I ask gpg4win to decrypt the file itself, it fails. What reliable alternative you can recommend on Windows?
    – get_going
    Nov 14 at 20:30






  • 2




    Microsoft#s certutil can do that (and much more), see this answer for a description. There are many others floating around like this one.
    – harrymc
    Nov 14 at 20:39






  • 1




    I agree with this answer. Without thorough investigation, you could say that opening a binary file in a text editor and using a plug-in that expects ascii input is an unreliable solution. I would use gpg --enarmor. certutil generates -----BEGIN CERTIFICATE----- which will prevent gpg from working.
    – evpo
    Nov 15 at 2:34


















  • After some more attempts I found something interesting. If I decrypt the Base64 encoded file, I get an error (i.imgur.com/jcD4n1b.jpg). BUT, If I copy the contents of the file directly into gpg4win's notepad, it works.
    – get_going
    Nov 14 at 19:34










  • You found a method of circumventing the end-of-line problem? I don't know gpg4win so cannot explain why it works.
    – harrymc
    Nov 14 at 20:26










  • No I didn't. I just described what I observed, i.e. if I open the Base64 encoded file and copy the contents to gpg4win's notepad, it can decrypt. So I know Notepad++ is doing something right. But if I ask gpg4win to decrypt the file itself, it fails. What reliable alternative you can recommend on Windows?
    – get_going
    Nov 14 at 20:30






  • 2




    Microsoft#s certutil can do that (and much more), see this answer for a description. There are many others floating around like this one.
    – harrymc
    Nov 14 at 20:39






  • 1




    I agree with this answer. Without thorough investigation, you could say that opening a binary file in a text editor and using a plug-in that expects ascii input is an unreliable solution. I would use gpg --enarmor. certutil generates -----BEGIN CERTIFICATE----- which will prevent gpg from working.
    – evpo
    Nov 15 at 2:34
















After some more attempts I found something interesting. If I decrypt the Base64 encoded file, I get an error (i.imgur.com/jcD4n1b.jpg). BUT, If I copy the contents of the file directly into gpg4win's notepad, it works.
– get_going
Nov 14 at 19:34




After some more attempts I found something interesting. If I decrypt the Base64 encoded file, I get an error (i.imgur.com/jcD4n1b.jpg). BUT, If I copy the contents of the file directly into gpg4win's notepad, it works.
– get_going
Nov 14 at 19:34












You found a method of circumventing the end-of-line problem? I don't know gpg4win so cannot explain why it works.
– harrymc
Nov 14 at 20:26




You found a method of circumventing the end-of-line problem? I don't know gpg4win so cannot explain why it works.
– harrymc
Nov 14 at 20:26












No I didn't. I just described what I observed, i.e. if I open the Base64 encoded file and copy the contents to gpg4win's notepad, it can decrypt. So I know Notepad++ is doing something right. But if I ask gpg4win to decrypt the file itself, it fails. What reliable alternative you can recommend on Windows?
– get_going
Nov 14 at 20:30




No I didn't. I just described what I observed, i.e. if I open the Base64 encoded file and copy the contents to gpg4win's notepad, it can decrypt. So I know Notepad++ is doing something right. But if I ask gpg4win to decrypt the file itself, it fails. What reliable alternative you can recommend on Windows?
– get_going
Nov 14 at 20:30




2




2




Microsoft#s certutil can do that (and much more), see this answer for a description. There are many others floating around like this one.
– harrymc
Nov 14 at 20:39




Microsoft#s certutil can do that (and much more), see this answer for a description. There are many others floating around like this one.
– harrymc
Nov 14 at 20:39




1




1




I agree with this answer. Without thorough investigation, you could say that opening a binary file in a text editor and using a plug-in that expects ascii input is an unreliable solution. I would use gpg --enarmor. certutil generates -----BEGIN CERTIFICATE----- which will prevent gpg from working.
– evpo
Nov 15 at 2:34




I agree with this answer. Without thorough investigation, you could say that opening a binary file in a text editor and using a plug-in that expects ascii input is an unreliable solution. I would use gpg --enarmor. certutil generates -----BEGIN CERTIFICATE----- which will prevent gpg from working.
– evpo
Nov 15 at 2:34


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375379%2fhow-to-convert-gpg4wins-binary-to-ascii-with-notepad%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Сан-Квентин

8-я гвардейская общевойсковая армия

Алькесар