WTF!? Annoying error in vim while on OverTheWi…

WTF!? Annoying error in vim while on OverTheWire level Bandit16?:

First of all, mild SPOILER ALERT for anyone currently doing the bandit levels on the OverTheWire site.

Additionally, disclaimer, I consider myself very noob with both vim and private key usage.

Ok so, for this level I needed to create my own PEM RSA key using details from the previous level. I decided to use the vim editor as I like the idea of a CLI text editor and have heard how it’s considered the standard (maybe I’m wrong though)

To my understanding, for the file to save as a valid PEM RSA key file type, it needs to include the relevant header and footer tags surrounding the actual key, which are respectively,

—–BEGIN RSA PRIVATE KEY—–

and

—–END RSA PRIVATE KEY—–

I copied the entirety of the key to the clipboard, from the start of the header to the end of the footer.

First time I paste it into vim, no problem. It saves as the proper file type.

Ended up deleting that and making a new one later on. But now, it was just saving as regular text. Wtf!? What’s going on, I thought to myself. So I re-copy the full key text just to make sure I didn’t somehow miss a character from the source, and paste it into vim, save it, aaand, nope just a regular text file.

So I scroll up on vim and see that now for some reason the top of the header gets cut off, so that now even when I paste the FULL KEY WITH THE COMPLETE HEADER, the text begins at N RSA PRIVATE KEY—–

WTF IS GOING ON

Obviously the error has been identified now and if I manually add —–BEGI to the file I can save it as PEM RSA and continue ahead, but WHY THE FUCK DOES THE START OF IT GET CHOPPED OFF

Excuse my French and caps lock but finding this as the cause of my confusion was rather frustrating.

Thanks in advance 🙂

submitted by /u/exempt1993
[link] [comments] via Linux 101 stuff. Questions are encouraged, noobs are welcome!