<?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: How to RSA-OAEP encrypt credentials using Node js (not c# or PowerShell) in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2036241#M31327</link>
    <description>&lt;P&gt;node-forge?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/55525628/rsa-encryption-with-oaep-between-java-and-javascript" target="_blank"&gt;RSA Encryption with OAEP between Java and JavaScript - Stack Overflow&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Aug 2021 00:57:21 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2021-08-25T00:57:21Z</dc:date>
    <item>
      <title>How to RSA-OAEP encrypt credentials using Node js (not c# or PowerShell)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2031578#M31271</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I need to &lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/create-datasource" target="_self"&gt;create a data source&lt;/A&gt;&amp;nbsp;on a gateway that connects to an on-premises SQL Server.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have understood that I need to&amp;nbsp;RSA-OAEP encrypt the credentials (Basic username/password), for which I've found &lt;A href="https://endjin.com/blog/2020/12/how-to-update-credentials-for-an-on-prem-power-bi-data-source-using-powershell.html" target="_self"&gt;examples in Power shell&lt;/A&gt; and in c# (&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/automation/configure-credentials?tabs=sdk3" target="_self"&gt;Configure credentials programmatically for Power BI&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to encrypt the credentials with Node or using an API-based third-party service?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 08:21:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2031578#M31271</guid>
      <dc:creator>dpiret</dc:creator>
      <dc:date>2021-08-23T08:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to RSA-OAEP encrypt credentials using Node js (not c# or PowerShell)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2036241#M31327</link>
      <description>&lt;P&gt;node-forge?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/55525628/rsa-encryption-with-oaep-between-java-and-javascript" target="_blank"&gt;RSA Encryption with OAEP between Java and JavaScript - Stack Overflow&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 00:57:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2036241#M31327</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-08-25T00:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to RSA-OAEP encrypt credentials using Node js (not c# or PowerShell)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2042444#M31389</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/70763"&gt;@dpiret&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please check the content of the following documents and we hope they will help you to achieve your needs.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/sohamkamani/b14a9053551dbe59c39f83e25c829ea7" target="_self"&gt;&lt;STRONG&gt;An example of RSA Encryption implemented in Node.js&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sohamkamani.com/nodejs/rsa-encryption/" target="_self"&gt;&lt;STRONG&gt;Implementing RSA Encryption and Signing in Node.js (With Examples)&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.example-code.com/nodejs/rsa_oaep_sha256.asp" target="_self"&gt;&lt;STRONG&gt;(Node.js) RSA-OAEP with SHA256 hashing&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 09:10:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2042444#M31389</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-27T09:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to RSA-OAEP encrypt credentials using Node js (not c# or PowerShell)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2046422#M31435</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;I already tried but none worked for me.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 14:09:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2046422#M31435</guid>
      <dc:creator>dpiret</dc:creator>
      <dc:date>2021-08-30T14:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to RSA-OAEP encrypt credentials using Node js (not c# or PowerShell)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2046435#M31436</link>
      <description>&lt;P&gt;In case this helps anyone seekeing a solution for the sale problem, here's what I did.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used a PowerShell script as described here&amp;nbsp;&lt;A href="https://endjin.com/blog/2020/12/how-to-update-credentials-for-an-on-prem-power-bi-data-source-using-powershell.html" target="_blank"&gt;https://endjin.com/blog/2020/12/how-to-update-credentials-for-an-on-prem-power-bi-data-source-using-powershell.html&lt;/A&gt;&amp;nbsp; then executed ith with Node, retrieving the resulting JSON. The Node code looks like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;```javascript
const { exec } = require('child_process');
const PShellScriptFile = './rsa-oeap-encrypt-credentials.ps1'
const datasourceCredentialsEncryptedFile = "./datasourceCredentialsEncryptedFile.json"
var username = "useNameHere"
var password = "passwordHere"
// WARNING. Gateway module is fixed and should go as param
exec(`${PShellScriptFile} -username ${username} -password ${password} -outputFile ${datasourceCredentialsEncryptedFile}`, {'shell':'powershell.exe'}, (error, stdout, stderr)=&amp;gt; {
    // you can use stdout but I choose getting the JSON file already generated by the script
})
```&lt;/LI-CODE&gt;&lt;P&gt;The outcome looks like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "credentialDetails":  {
                              "encryptedConnection":  "Encrypted",
                              "credentialType":  "Basic",
                              "credentials":  "oCvURzaedv3WNvV...lRQZ",
                              "privacyLevel":  "Private",
                              "encryptionAlgorithm":  "RSA-OAEP"
                          }
}&lt;/LI-CODE&gt;&lt;P&gt;Which you can then use in&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/create-datasource" target="_blank"&gt;Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 14:22:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-RSA-OAEP-encrypt-credentials-using-Node-js-not-c-or/m-p/2046435#M31436</guid>
      <dc:creator>dpiret</dc:creator>
      <dc:date>2021-08-30T14:22:20Z</dc:date>
    </item>
  </channel>
</rss>

