<?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 Re: Creating user a certificate via API in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/101234#M5288</link>
    <description>&lt;P&gt;Thanks for the update! Hopefully this results in some clarification for all that helps improve the usability of this already awesome API!&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2020 15:25:00 GMT</pubDate>
    <dc:creator>Nick10</dc:creator>
    <dc:date>2020-11-05T15:25:00Z</dc:date>
    <item>
      <title>Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/99996#M5256</link>
      <description>&lt;P&gt;Hello! I'm trying to automate the process of creating a user and their .p12 certificate for vpn access using the API&lt;BR /&gt;&lt;BR /&gt;My code's process is the following&lt;BR /&gt;&lt;BR /&gt;Create user&lt;BR /&gt;publish&lt;BR /&gt;Create cert&lt;BR /&gt;publish&lt;BR /&gt;install&lt;BR /&gt;&lt;BR /&gt;Now the api says it returns&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="blue"&gt;base64-certificate&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;string&lt;/TD&gt;&lt;TD&gt;&lt;SPAN class="description to_check_for_rewrite"&gt;Certificate file encoded in base64.&lt;BR /&gt;File format: .P12.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I'm not sure what to do with the base64 returned by the API. I've tried converting it to binary and saving it as a .p12, but that file doesn't work, and I've also tried just taking the base64 string and saving it as a .p12, but that also isn't working.&lt;BR /&gt;&lt;BR /&gt;I feel like I'm missing something pretty simple here. Could someone help me out?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nicholas&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 18:59:16 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/99996#M5256</guid>
      <dc:creator>Nick10</dc:creator>
      <dc:date>2020-10-23T18:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100015#M5257</link>
      <description>&lt;P&gt;Hi Nicholas&lt;/P&gt;&lt;P&gt;Have you tried to base64 decode the string and save the output in a p12 file?&lt;/P&gt;&lt;P&gt;There is a more fancy way where you can just pick the value from the JSON collection using jq, but you can use below line as a simple test.&lt;/P&gt;&lt;P&gt;echo&amp;nbsp;base64-certificate-string |&amp;nbsp;base64 --decode -i &amp;gt; mycert.p12&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 21:35:17 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100015#M5257</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2020-10-23T21:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100017#M5258</link>
      <description>&lt;P&gt;Hello! Thanks for your response&lt;BR /&gt;&lt;BR /&gt;I've tried your suggestion but had a result similar to other attempts. When I tried to use the resulting cert it did not work when attempting to connect to the VPN, and when I tried to check it out with openssl the decrypt failed(Although it let me enter the password)&lt;/P&gt;&lt;P&gt;Here is my attempt to view it with openssl&lt;BR /&gt;&lt;BR /&gt;openssl pkcs12 -info -in mycert.p12&lt;/P&gt;&lt;P&gt;Enter Import Password:&lt;BR /&gt;MAC: sha1, Iteration 100000&lt;BR /&gt;MAC length: 20, salt length: 20&lt;BR /&gt;PKCS7 Data&lt;BR /&gt;Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 1&lt;BR /&gt;Bag Attributes&lt;BR /&gt;friendlyName: coanbase64&lt;BR /&gt;localKeyID: &lt;EM&gt;(Not sure if this value is significant security wise so redacting it)&lt;/EM&gt;&lt;BR /&gt;1.3.18.0.2.28.24: IBM_SDK_JAVA_8_PKCS12&lt;BR /&gt;Error outputting keys and certificates&lt;BR /&gt;140042861278528:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:../crypto/evp/evp_enc.c:583:&lt;BR /&gt;140042861278528:error:23077074:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 cipherfinal error:../crypto/pkcs12/p12_decr.c:62:&lt;BR /&gt;140042861278528:error:2306A075:PKCS12 routines:PKCS12_item_decrypt_d2i:pkcs12 pbe crypt error:../crypto/pkcs12/p12_decr.c:93:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems to have some of the correct info: coanbase64 is the name of the user I created to test this&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 22:03:44 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100017#M5258</guid>
      <dc:creator>Nick10</dc:creator>
      <dc:date>2020-10-23T22:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100241#M5265</link>
      <description>&lt;P&gt;Hi Nicholas,&lt;BR /&gt;&lt;BR /&gt;I just want to update you. I tried it and are getting the same result as you. I have reached out to R&amp;amp;D and asked them share the inform on how to correctly convert the base64-certificate string into a p12 certificate file. I will update this thread once I have more information.&lt;BR /&gt;&lt;BR /&gt;Kind Regards&lt;BR /&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 12:11:48 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100241#M5265</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2020-10-27T12:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100925#M5285</link>
      <description>&lt;P&gt;Thanks, I appreciate you looking into it!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 16:23:09 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/100925#M5285</guid>
      <dc:creator>Nick10</dc:creator>
      <dc:date>2020-11-02T16:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/101035#M5286</link>
      <description>&lt;P&gt;Just to update, R&amp;amp;D is still investigating.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 14:50:20 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/101035#M5286</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2020-11-03T14:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/101234#M5288</link>
      <description>&lt;P&gt;Thanks for the update! Hopefully this results in some clarification for all that helps improve the usability of this already awesome API!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 15:25:00 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/101234#M5288</guid>
      <dc:creator>Nick10</dc:creator>
      <dc:date>2020-11-05T15:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/102181#M5323</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Nicholas,&lt;/P&gt;
&lt;P&gt;After investigation this, R&amp;amp;D have concluded that there is an issue with the export of the certificate. They have found the root cause to the issue and will deliver a fix in a JHF for R80.30/R80.40/R81.&lt;/P&gt;
&lt;P&gt;If you would like to have a private HF before a JHF with the fix is released. Please open a Support Request (SR) with our TAC, for your convenience, you can use one of the following&amp;nbsp;PRJs as a reference to the issue:&lt;/P&gt;
&lt;P&gt;PRJ-19533 R80.30 JHF&lt;BR /&gt;PRJ-19534 R80.40 JHF&lt;BR /&gt;PRJ-19535 R81 JHF&lt;/P&gt;
&lt;P&gt;In the SR specify the PRJ that relevant for your version to get a private HF for your version.&lt;/P&gt;
&lt;P&gt;Please note that you will need to include a cpinfo of your management server when opening the SR to allow TAC and R&amp;amp;D to create a private HF specifically for your environment.&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 15:55:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/102181#M5323</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2020-11-16T15:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating user a certificate via API</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/118003#M5839</link>
      <description>&lt;P&gt;When you have the correct version/JHF applied, extracting the certificate can be done as follows (thanks&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/6593"&gt;@Ryan_Darst&lt;/a&gt;&amp;nbsp;:))&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[Expert@R81-Connect:0]# &lt;STRONG&gt;mgmt_cli -r true -f json add user name ryand&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[Expert@R81-Connect:0]# &lt;STRONG&gt;mgmt_cli -r true -f json set user name ryand certificates.add.certificate-file.password vpn123 certificates.add.certificate-file.comment certificate_1 | jq -r '.certificates[] | select(.comments == "certificate_1") | ."base64-certificate"' | base64 --decode -i &amp;gt; ryand.p12&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[Expert@R81-Connect:0]# &lt;STRONG&gt;cpopenssl pkcs12 -in ./ryand.p12 -info&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Enter Import Password:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MAC: sha1, Iteration 2048&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;MAC length: 20, salt length: 8&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;OUTPUT removed &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;udsEHtXCTPz3RGNALHEcIA==&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;-----END ENCRYPTED PRIVATE KEY-----&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 May 2021 23:47:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Creating-user-a-certificate-via-API/m-p/118003#M5839</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-05-09T23:47:03Z</dc:date>
    </item>
  </channel>
</rss>

