NETCONF-521: Replace literal '\n' by newline 49/69249/2
authorLuis Gomez <ecelgp@gmail.com>
Thu, 8 Mar 2018 04:21:20 +0000 (20:21 -0800)
committerLuis Gomez <ecelgp@gmail.com>
Thu, 8 Mar 2018 05:11:29 +0000 (21:11 -0800)
This fixes the private key decoding error in NETCONF-521.

Change-Id: Iddcd29ea8ce513068e49071c0bdabbb788c11064
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/auth/DatastoreBackedPublicKeyAuth.java

index a33115e465283b0fd21b6e1348f80310f6616250..454b6b3f38a3de3a2addfdccfca1263e7ab655f3 100644 (file)
@@ -72,7 +72,8 @@ public class DatastoreBackedPublicKeyAuth extends AuthenticationHandler {
             try {
                 this.keyPair = Optional.of(
                         new PKIUtil().decodePrivateKey(
-                                new StringReader(encryptionService.decrypt(dsKeypair.getPrivateKey())),
+                                new StringReader(encryptionService.decrypt(
+                                        dsKeypair.getPrivateKey()).replaceAll("\\\\n", "\n")),
                                 encryptionService.decrypt(passPhrase)));
             } catch (IOException exception) {
                 LOG.warn("Unable to decode private key, id={}", pairId, exception);