You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
I need to RSA-OAEP encrypt the following string "{\"credentialData\":[{\"name\":\"username\", \"value\":\"TenantTwo\"},{\"name\":\"password\", \"value\":\"moss1KLOH5pont-bah\"}]}"
constencryptCredentials=()=>{// using https://stackoverflow.com/questions/56961746/power-bi-api-post-datasource-errors-with-dmts-invalidencryptionalgorithmerrorconstnodeRSA=require("node-rsa");constcredentials="{\"credentialData\":[{\"name\":\"username\", \"value\":\"TenantTwo\"},{\"name\":\"password\", \"value\":\"moss1KLOH5pont-bah\"}]}";constexponentString='AQAB';constmodulusString='0R3Mmpn2LSnGiuFPMOldR/9hySiSsWKs01Oue+ecg0ZLKMepXArJ3gmCngBdQxcsocTXwyW725J/EDrIdgJ5DhMSVPevyvg3yiLKKFVFgG3q7Hbxf7NMgXHcXg3dgELO4TXHhRjrTzjlfnC2gaUHBGDteUJ0rc94zkvYUYPtAFJ8M4xSyoflRTeVxMgFAQRgo0C/pTZXh3Pr6YFBcQF2FoicpqT7jRUG0rQAJ7Cw1N61YXKU/ss+ofEywYXBKa/jrXxBhOOhTpgEkNbpxbDb4KAWxTv4CahMDsYIP6dH9+86pRfWisG9O5SYkUbHl+oUKdnwfW7SNvzYA1zcHXDSTQ==';constkey=newnodeRSA();// key.generateKeyPair(); // tried this to upgrade to 2048constmodulus=newBuffer(modulusString,'base64');constexponent=newBuffer(exponentString,'base64');constpubKey=key.importKey({n: modulus,e: exponent},'components-public');constencrypted=pubKey.encrypt(credentials,'base64');returnencrypted}console.log(encryptCredentials())
In several posts, they say it may be due to a 512-key rather than 2048, but couldn't find a way to fix it.
Any ideas?
The text was updated successfully, but these errors were encountered:
Hi there,
I need to RSA-OAEP encrypt the following string
"{\"credentialData\":[{\"name\":\"username\", \"value\":\"TenantTwo\"},{\"name\":\"password\", \"value\":\"moss1KLOH5pont-bah\"}]}"
using the following exponent/modulus
The goal is encrypting credentials to create a data source in a power bi gateway.
The correct result (obtained using a PowerShell script or C#) is this one
Now, what I get from node-rsa is quite different
This is the code I used
In several posts, they say it may be due to a 512-key rather than 2048, but couldn't find a way to fix it.
Any ideas?
The text was updated successfully, but these errors were encountered: