Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-23963

PEM retrieve from REST requires GETer to remove (and realize) newlines

    Details

    • Type: Improvement
    • Status: New
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: REST, SSL
    • Labels:
      None

      Description

      curl -X GET "http://localhost:8081/service/rest/beta/security/ssl?host=google.com&port=443" -H "accept: applicaton/json" -u admin:admin123

      returns a pem certificate like:

      -----BEGIN CERTIFICATE-----\nMIIJUDCCCDigAwIBAgIRAPILNAoqBMh9AgAAAABl4iEwDQYJKoZIhvcNAQELBQAw\nQjELMAkGA1UEBhMCVVMxHjAcBgNVBAoTFUdvb2dsZSBUcnVzdCBTZXJ2aWNlczET\nMBEGA1UEAxMKR1RTIENBIDFPMTAeFw0yMDA0MjgwNzQzNDFaFw0yMDA3MjEwNzQz\nNDFaMGYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH\nEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgTExDMRUwEwYDVQQDDAwq\nLmdvb2dsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQPRU4vDKeImrkk\n/1dQ3PGrbt0+f4ImMKcSn4GKJ519Bi7T4lA7zmwtLlsyzn3rhgZ8jCkrR2He8Mr4\nt5gAIWo0o4IG5jCCBuIwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUF\nBwMBMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFKCJhNC+tStxOvpzBd3kLMWK2kfv\nMB8GA1UdIwQYMBaAFJjR+G4Q68+b7GCfGJAboOt9Cf0rMGQGCCsGAQUFBwEBBFgw\nVjAnBggrBgEFBQcwAYYbaHR0cDovL29jc3AucGtpLmdvb2cvZ3RzMW8xMCsGCCsG\nAQUFBzAChh9odHRwOi8vcGtpLmdvb2cvZ3NyMi9H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Kle/us5TEP/Qf+Qyk\nzE4tpCm57K9G0xrXfmG1Cjty/gNaToLemj7FSAghLOcMDHBSEtNHxnPIet9nZ1KQ\nigi5ZfzrJHt/0Sekda4aI7GcgaTMTD6K6QghW7V0AAz6UTs0gMLpqb/B1aaEHxku\nu31NkvbNzSXAq3AFUVIUY+04pL4znSbxK3ZOlmb50Srlmj+zJT6qIHIcE3izIduy\nDsZhQhwentbzPBRSGXN1c6pSEybzzh3/Shj0HyIVIDpalgH980WGL70QT4H7AE9t\nFIo+PYjnfKs+uZLIxi7lwgiwzbEPYUk97ydQaE4oj0XvWPSs\n-----END CERTIFICATE-----\n"
      

      I immediately noticed the \n characters around begin and end certificate but not the ones in the middle. Removing them amounts to something like below which then works. This isn't kind formatting for retrieve, it'd be nice if we could form that better IMO, like:

      -----BEGIN CERTIFICATE-----
      MIIGnjCCBYagAwIBAgIQBtdUrpbSg3Gk3vYKwhGz4TANBgkqhkiG9w0BAQsFADBw
      MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
      d3cuZGlnaWNlcnQuY29tMS8wLQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNz
      dXJhbmNlIFNlcnZlciBDQTAeFw0yMDA1MTEwMDAwMDBaFw0yMDExMDcxMjAwMDBa
      MGMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRIwEAYDVQQHEwlT
      dW5ueXZhbGUxETAPBgNVBAoTCE9hdGggSW5jMRgwFgYDVQQDDA8qLnd3dy55YWhv
      by5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASRiHQW4BJe8AfhEtNQ3kBm
      bpFjRZKMKmZ2zqD/u9mbas9+/+jp6RHsTJKmHTGgix/58PaU28ZeVtQjkFaWl+am
      o4IECjCCBAYwHwYDVR0jBBgwFoAUUWj/kK8CB3U8zNllZGKiErhZcjswHQYDVR0O
      BBYEFLIHWWWSKR5CGAILFvdc3qYIZweEMIIBMgYDVR0RBIIBKTCCASWCCXlhaG9v
      LmNvbYILKi55YWhvby5jb22CDyoud3d3LnlhaG9vLmNvbYIMbWJwLnlpbWcuY29t
      ghEqLm1lZGlhLnlhaG9vLmNvbYINYnJiLnlhaG9vLm5ldIIPKi5hdHQueWFob28u
      Y29tggpzLnlpbWcuY29tgg4qLmFtcC55aW1nLmNvbYIWZnItY2Eucm9nZXJzLnlh
      aG9vLmNvbYIPdHcucmQueWFob28uY29tghBkZGwuZnAueWFob28uY29tghNjYS5y
      b2dlcnMueWFob28uY29tgg9jYS5teS55YWhvby5jb22CEGFkZC5teS55YWhvby5j
      b22CGSouZ2xvYmFsLnZlc3BhLm9hdGguY2xvdWSCD2hrLnJkLnlhaG9vLmNvbTAO
      BgNVHQ8BAf8EBAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMHUG
      A1UdHwRuMGwwNKAyoDCGLmh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9zaGEyLWhh
      LXNlcnZlci1nNi5jcmwwNKAyoDCGLmh0dHA6Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9z
      aGEyLWhhLXNlcnZlci1nNi5jcmwwTAYDVR0gBEUwQzA3BglghkgBhv1sAQEwKjAo
      BggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAIBgZngQwB
      AgIwgYMGCCsGAQUFBwEBBHcwdTAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGln
      aWNlcnQuY29tME0GCCsGAQUFBzAChkFodHRwOi8vY2FjZXJ0cy5kaWdpY2VydC5j
      b20vRGlnaUNlcnRTSEEySGlnaEFzc3VyYW5jZVNlcnZlckNBLmNydDAMBgNVHRMB
      Af8EAjAAMIIBBAYKKwYBBAHWeQIEAgSB9QSB8gDwAHYAsh4FzIuizYogTodm+Su5
      iiUgZ2va+nDnsklTLe+LkF4AAAFyBNxVkQAABAMARzBFAiEA/UGuKoXuExahHcm6
      RkvJb4TVqxTS9uMDXZraawGDsfUCID1MOO5MeB+0LbHxzNGIZJWzd14Wxe0yQjth
      a7VORqkuAHYA8JWkWfIA0YJAEC0vk4iOrUv+HUfjmeHQNKawqKqOsnMAAAFyBNxV
      rAAABAMARzBFAiEAyWlD216hAxmTfeiqu8qAyDTyOc+4GuS/mbVBX1PiB1oCIA4+
      Uu8gmfgK2rgOgMKtHRjLN5A70vp1EuHhF4yMN2sHMA0GCSqGSIb3DQEBCwUAA4IB
      AQAKfdHMXbexW+UVFxZJCAe2ED0nb3DE9W0SZBMMG3RRxM725Jd0wyUMu2P+8yJU
      uCDJn93k+Ag0gBoHyJlrqx5OrYtBobn0IJwkO+inKwUTUKNwUFCBbG7oVtwgnskZ
      GI5YSq/KIGMYV5Rv6DHn3CsbW1CyPbHZVvX/8MoT/ZcCIOtLkBrrIO3htY01MSGC
      qvq+oT46Cest/j47Ge5f84kZSX8YX7jVexCApBljO+l9X20na/IpeHB28W0HWjDF
      soe4y7UP3+/7Zo2IExzzw4u04CGQNiNeCGUgPOkBHFbKBJj+vFrEk0EcYbY3mnqr
      PD8AixmaLSy1oCMK/wpIyGPf
      -----END CERTIFICATE-----
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jtom Joe Tom
            Last Updated By:
            Joe Tom Joe Tom
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                tigCommentSecurity.panel-title