Russian  English  All projects

Writing an analogue feature on a php that is on JS in a working project



Good afternoon, theres such a feature on JS:
function encryptNumber(g)
{var f=$("#publicKey").val()
var a=forge.util.decode64(f)
var b=forge.asn1.fromDer(a)
var e=forge.pki.publicKeyFromAsn1(b)
var d=e.encrypt(g)
return forge.util.encode64(d)}

Apparently, the library is digitalbazaar.github.io/f...

At the same time, the publicKey variable is known. You should write the same function on PHP so that the results of the function on PHP and JS would be the same.
P.S. Function encodes a long number (usually 16 to 18 digits in it)
23.06.2021 13:19



 Answers freelancers