I don't think they're frowned upon, but if you take a step back, your code should be expressive of what you're trying to do, and not merely be the mechanism for getting a certain result. In other words, a while (true) loop with a break is perfectly fine if the idea is that the loop will continue to execute during normal operation, and break at some exceptional condition (or perhaps one of several exceptional conditions). But if, as in this case, the loop is meant to execute exactly two times, a while (true) with a break seems an odd choice. It doesn't communicate intent well, it's confusing to anyone reading your code, and it will be confusing to you when you look at it again after a few months.

Like many things in programming, there is no "consensus" on this. Does it get the job done and fit inside your head? Then use it.

The reason there is no consensus is that it depends entirely on the context of the program, including who the programmer is. You can't really ask "what is the consensus on this general concept?" because it really depends on the specifics.

does anyone here know what i need to add in order to do encryption in the code above?

Yep, write a separate encrypt( ... ) method. We don't know what you want to encrypt and we don't know what that method is supposed to return so you have to decide. But whatever you decide, don't decide to cram that code in the same method as the code above.