javascript - RSA Encryption (softAP setup of microcontroller) in C# -


i'm trying configure wifi credentials particle photon (wifi microcontroller cloud support).

there existing methods java / ios / android / javascript.

however, need in c# (for desktop , xamarin multiplatform app).

i succesfully managed connect device, retreive it's id, retreive public key , nearby wifi access points (using webrequests , deserialized json objects)

however, stuck rsa encryption of wifi password need pass through.

i'm trying use rsacryptoserviceprovider encrypt need pass xml string , key in different (base64?) format. there seems kind of splicing needs happen.

this retreived public key (in hex):

30819f300d06092a864886f70d010101050003818d00308189028181009885dc94e34a23a2942bb9eb6721c4233e9edcc9a967f587cea527e1d447f48319ca6c4178dff739c0ab079e02467dd4d3ad3214416f0983c3967ea71378d7d93a885f1575d71d009990bffc0882fc721f4dc98a0d80b4ccf12e51066d69055e9a3c95e247beb9dc16176a083de7fa93c23449a3870d599da9d507964f7fc4b90203010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

this function in github softap-js:

softap.prototype.publickey = function publickey(cb) {  is(cb); var sock = this.__sendcommand('public-key', response.bind(this)); function response(err, dat) {      if(err) { return cb(err); }     if(!dat) { return cb(new error('no data received')); }     if(dat.r !== 0) {         return cb(new error('received non-zero response code'));     }     var buff = new buffer(dat.b, 'hex');     this.__publickey = new rsa(buff.slice(22), 'pkcs1-public-der', {         encryptionscheme: 'pkcs1'     })     cb(null, this.__publickey.exportkey('pkcs8-public')); }; return sock; 

};

which appears handle public key. guess need somehow convert .net appreciate or hint since i'm not familiar @ encryption.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -