<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic REST API upload CA chain in HPE OneView</title>
    <link>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7260078#M10537</link>
    <description>&lt;P&gt;I recently updated the server certificate for one of our OneView instances.&amp;nbsp; When I tried to upload the signed certificate via the REST API it was rejected because the intermdiate certificate it was signed by was not in OneView.&amp;nbsp; So, I tried to upload that intermediate certificate, but it was rejected because the root certificate it was signed by was not in OneView.&amp;nbsp; We have an internal CA with several intermediate and root certificates.&amp;nbsp; So, I downloaded all of those.&amp;nbsp; I read that I can upload the entire chain to&amp;nbsp;/rest/certificates/ca.&amp;nbsp; So, I wrote build-cert-chain.sh to build the cert chain.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
for VAR in OneView currentVersion sessionID DATA; do
   if [[ -z ${!VAR+x} ]]; then echo "${VAR} is not set!  You need to source the get-session-credentials.sh script.";return 1 2&amp;gt;/dev/null || exit 1;fi
done
declare -i NUM=2
OPTIND=1
OPTARG=
OPTERR=1
while getopts 'c:a:n:' flag; do
   case "${flag}" in
      a) ALIAS=${OPTARG};;
      c) SCRT=${OPTARG};;
      n) NUM=${OPTARG};if ! [[ "${NUM}" =~ ^[0-9]+$ ]]; then echo "The value for -n must be a number." &amp;gt;&amp;amp;2;return 2 || exit 2;fi;;
   esac
done
if [[ "${NUM}" == "" ]]; then echo "NUM was not set.  Setting it to 1";NUM=1;fi
SCRTN=$(awk 'NF {sub(/\r/, ""); printf "%s\\n", $0}' "$SCRT")
if [[ ${NUM} -eq 1 ]]; then
   DATA=$(jq -n --arg cert "${SCRTN}" --arg alias "${ALIAS}" '{members:[{certificateDetails:{base64Data:$cert,aliasName:$alias}}]}')
else
   DATA=$(jq --arg cert "${SCRTN}" --arg alias "${ALIAS}" '.members += [{certificateDetails:{base64Data:$cert,aliasName:$alias}}]' &amp;lt;&amp;lt;&amp;lt;"${DATA}")
fi
export DATA&lt;/LI-CODE&gt;&lt;P&gt;I then ran echo ${DATA} &amp;gt; chain.cer.&amp;nbsp; I wrote upload-ca-cert.sh to upload it:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
for VAR in OneView currentVersion sessionID DATA; do
   if [[ -z ${!VAR+x} ]]; then echo "${VAR} is not set!  You need to source the get-session-credentials.sh script.";return 1 2&amp;gt;/dev/null || exit 1;fi
done
OPTIND=1
OPTARG=
OPTERR=1
while getopts 'c::' flag; do
   case "${flag}" in
      c) SCRT=${OPTARG};;
   esac
done
CERTURI=$(curl --insecure --include --silent \
     --header "content-type: application/json" \
     --header "X-API-Version: ${currentVersion}" \
     --header "auth: ${sessionID}" \
     --data @SCRT \
     --request POST ${OneView}/rest/certificates/ca | grep '^Location:' | awk '{ print $2 }')
echo "Waiting 30 seconds for the process to complete"
sleep 29
echo "Checking the status of the upload process:"
curl --insecure --silent \
     --header "X-API-Version: ${currentVersion}" \
     --header "auth: ${sessionID}" \
     --request GET ${OneView}${CERTURI} | jq -r '.'
export CERTURI&lt;/LI-CODE&gt;&lt;P&gt;When I try to upload it, I get INVALID JSON MAPPING, JSON cannot be parsed.&amp;nbsp; Oh!&amp;nbsp; I think I might have one too many backslashes before n for the linefeeds.&amp;nbsp; I have:&amp;nbsp; \\n.&amp;nbsp; I think it is supposed to be \n.&amp;nbsp; Let me try to rectify that and see how it goes.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jan 2026 07:43:51 GMT</pubDate>
    <dc:creator>bradawk1</dc:creator>
    <dc:date>2026-01-23T07:43:51Z</dc:date>
    <item>
      <title>REST API upload CA chain</title>
      <link>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7260078#M10537</link>
      <description>&lt;P&gt;I recently updated the server certificate for one of our OneView instances.&amp;nbsp; When I tried to upload the signed certificate via the REST API it was rejected because the intermdiate certificate it was signed by was not in OneView.&amp;nbsp; So, I tried to upload that intermediate certificate, but it was rejected because the root certificate it was signed by was not in OneView.&amp;nbsp; We have an internal CA with several intermediate and root certificates.&amp;nbsp; So, I downloaded all of those.&amp;nbsp; I read that I can upload the entire chain to&amp;nbsp;/rest/certificates/ca.&amp;nbsp; So, I wrote build-cert-chain.sh to build the cert chain.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
for VAR in OneView currentVersion sessionID DATA; do
   if [[ -z ${!VAR+x} ]]; then echo "${VAR} is not set!  You need to source the get-session-credentials.sh script.";return 1 2&amp;gt;/dev/null || exit 1;fi
done
declare -i NUM=2
OPTIND=1
OPTARG=
OPTERR=1
while getopts 'c:a:n:' flag; do
   case "${flag}" in
      a) ALIAS=${OPTARG};;
      c) SCRT=${OPTARG};;
      n) NUM=${OPTARG};if ! [[ "${NUM}" =~ ^[0-9]+$ ]]; then echo "The value for -n must be a number." &amp;gt;&amp;amp;2;return 2 || exit 2;fi;;
   esac
done
if [[ "${NUM}" == "" ]]; then echo "NUM was not set.  Setting it to 1";NUM=1;fi
SCRTN=$(awk 'NF {sub(/\r/, ""); printf "%s\\n", $0}' "$SCRT")
if [[ ${NUM} -eq 1 ]]; then
   DATA=$(jq -n --arg cert "${SCRTN}" --arg alias "${ALIAS}" '{members:[{certificateDetails:{base64Data:$cert,aliasName:$alias}}]}')
else
   DATA=$(jq --arg cert "${SCRTN}" --arg alias "${ALIAS}" '.members += [{certificateDetails:{base64Data:$cert,aliasName:$alias}}]' &amp;lt;&amp;lt;&amp;lt;"${DATA}")
fi
export DATA&lt;/LI-CODE&gt;&lt;P&gt;I then ran echo ${DATA} &amp;gt; chain.cer.&amp;nbsp; I wrote upload-ca-cert.sh to upload it:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
for VAR in OneView currentVersion sessionID DATA; do
   if [[ -z ${!VAR+x} ]]; then echo "${VAR} is not set!  You need to source the get-session-credentials.sh script.";return 1 2&amp;gt;/dev/null || exit 1;fi
done
OPTIND=1
OPTARG=
OPTERR=1
while getopts 'c::' flag; do
   case "${flag}" in
      c) SCRT=${OPTARG};;
   esac
done
CERTURI=$(curl --insecure --include --silent \
     --header "content-type: application/json" \
     --header "X-API-Version: ${currentVersion}" \
     --header "auth: ${sessionID}" \
     --data @SCRT \
     --request POST ${OneView}/rest/certificates/ca | grep '^Location:' | awk '{ print $2 }')
echo "Waiting 30 seconds for the process to complete"
sleep 29
echo "Checking the status of the upload process:"
curl --insecure --silent \
     --header "X-API-Version: ${currentVersion}" \
     --header "auth: ${sessionID}" \
     --request GET ${OneView}${CERTURI} | jq -r '.'
export CERTURI&lt;/LI-CODE&gt;&lt;P&gt;When I try to upload it, I get INVALID JSON MAPPING, JSON cannot be parsed.&amp;nbsp; Oh!&amp;nbsp; I think I might have one too many backslashes before n for the linefeeds.&amp;nbsp; I have:&amp;nbsp; \\n.&amp;nbsp; I think it is supposed to be \n.&amp;nbsp; Let me try to rectify that and see how it goes.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2026 07:43:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7260078#M10537</guid>
      <dc:creator>bradawk1</dc:creator>
      <dc:date>2026-01-23T07:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: REST API upload CA chain</title>
      <link>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7260085#M10538</link>
      <description>&lt;P&gt;Unfortunately removing that extra backslash did not do it.&amp;nbsp; Any ideas?&amp;nbsp; My JSON looks just like the example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "members": [
      {
        "certificateDetails": {
            "base64Data": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----",
            "aliasName": "ca Alias Name1"
        }
      },
      {
        "certificateDetails":{
            "base64Data":"-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----",
            "aliasName":"ca Alias Name2"
        }
      }
   ]
}&lt;/LI-CODE&gt;&lt;P&gt;The alias names have spaces in them.&amp;nbsp; Does that matter?&lt;BR /&gt;Just FYI, I also tried just uploading a single intermediate certificate and got the same response.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2025 13:11:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7260085#M10538</guid>
      <dc:creator>bradawk1</dc:creator>
      <dc:date>2025-12-18T13:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: REST API upload CA chain</title>
      <link>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7260343#M10547</link>
      <description>&lt;P&gt;No one has uploaded a CA chain using the REST API?&amp;nbsp; Either I am missing someting, or the documentation is incorrect.&amp;nbsp; I have a single CA certificate formatted as depicted in the REST API reference and saved to chain.cer.&amp;nbsp; I then ran:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;jq -r '.members[].certificateDetails.base64Data' chain.cer | openssl x509 -text -nout&lt;/LI-CODE&gt;&lt;P&gt;and received the properly decoded certificate details.&amp;nbsp; So, I think my format should be good.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 12:36:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7260343#M10547</guid>
      <dc:creator>bradawk1</dc:creator>
      <dc:date>2025-12-29T12:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: REST API upload CA chain</title>
      <link>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7261000#M10562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P dir="auto" style="margin: 0;"&gt;Hi Bradawk1,&lt;BR /&gt;Thank you for choosing HPE.&amp;nbsp;&lt;BR /&gt;From the looks of the query, the maximum chain can be uploaded in 10.&amp;nbsp;&lt;/P&gt;
&lt;P dir="auto" style="margin: 0;"&gt;&lt;BR /&gt;The user guide does share the informatoin perfect steps to add:&amp;nbsp;&lt;BR /&gt;&lt;A href="https://support.hpe.com/docs/display/public/dp00006389en_us/index.html#rest/certificates/ca?ref=POST%20%2Frest%2Fcertificates%2Fca&amp;amp;query=POST%20%2Frest%2Fcertificates%2Fca" target="_blank"&gt;https://support.hpe.com/docs/display/public/dp00006389en_us/index.html#rest/certificates/ca?ref=POST%20%2Frest%2Fcertificates%2Fca&amp;amp;query=POST%20%2Frest%2Fcertificates%2Fca&lt;/A&gt;&lt;/P&gt;
&lt;P dir="auto" style="margin: 0;"&gt;It is best to validate the certificate before adding to store with the below command.&amp;nbsp;&lt;BR /&gt;POST/rest/certificates/ca/validator&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jan 2026 05:28:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-oneview/rest-api-upload-ca-chain/m-p/7261000#M10562</guid>
      <dc:creator>Rakesh0404</dc:creator>
      <dc:date>2026-01-20T05:28:21Z</dc:date>
    </item>
  </channel>
</rss>

