summaryrefslogtreecommitdiff
path: root/zen/open_ssl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zen/open_ssl.cpp')
-rw-r--r--zen/open_ssl.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/zen/open_ssl.cpp b/zen/open_ssl.cpp
index 99d7582e..6dc13d3d 100644
--- a/zen/open_ssl.cpp
+++ b/zen/open_ssl.cpp
@@ -419,15 +419,13 @@ std::string zen::convertPuttyKeyToPkix(const std::string& keyStream, const std::
{
std::vector<std::string> lines;
- for (auto it = keyStream.begin();;) //=> keep local: "warning: declaration of ‘it’ shadows a previous local"
+ split2(keyStream, isLineBreak<char>,
+ [&lines](const char* blockFirst, const char* blockLast)
{
- auto itLineBegin = std::find_if_not(it, keyStream.end(), isLineBreak<char>);
- if (itLineBegin == keyStream.end())
- break;
+ if (blockFirst != blockLast) //consider Windows' <CR><LF>
+ lines.emplace_back(blockFirst, blockLast);
+ });
- it = std::find_if(itLineBegin + 1, keyStream.end(), isLineBreak<char>);
- lines.emplace_back(itLineBegin, it);
- }
//----------- parse PuTTY ppk structure ----------------------------------
auto itLine = lines.begin();
if (itLine == lines.end() || !startsWith(*itLine, "PuTTY-User-Key-File-2: "))
bgstack15