Hi,
I am trying to implement setting the wifi connection (as explained here).
I am doing this in Ionic 4.
While trying to do what is suggested for nodeJs in that great article written by @rickkas7, I get into a lot of trouble.
This is what I am trying to do in Ionic 4 (which is based in Angular 8):
var keyBuf = new Buffer(key, 'hex');
var rsa = new NodeRSA(keyBuf.slice(22), 'pkcs1-public-der', {
encryptionScheme: 'pkcs1'
});
console.log("encrypted password: " + rsa.encrypt(password, 'hex'));
that is code from wifipass.js here.
For a number of reasons, I can’t make this work today in Ionic 4 (I was able to make it work with Ionic 3, for instance).
Ionic devs are suggesting me to try to implement this using another library: WebCrypto.
What I wanted to know is this:
What are the requirements for encrypting the wifi password?
Yes, I need to use the public key provided by the Photon.
Yes, I need to encrypt it somehow before sending it to the photon.
Yes, I could reverse engineer the code above and perhaps get lucky with WebCrypto.
But what I would love to know is what are the ways I could encrypt the wifi password so it gets accepted by the photon.
Where can I find that info? Perhaps one of you or @rickkas7 know by any chance?
Thank you!
Gustavo.