Closed JonathanDaSilva closed 8 years ago
Once you generate a key at the server side you can transform it into asmCrypto-capable format with the following code snippet:
$ openssl rsa -pubin -in your.key -noout -text
Public-Key: (1024 bit)
Modulus:
00:db:e0:3b:5f:40:ba:bc:fd:17:eb:ee:0a:fe:6f:
ae:64:0c:15:82:66:5e:56:d6:1f:16:0b:81:d4:b0:
4c:da:de:1b:ed:9c:a8:b6:b1:5f:6d:87:21:ed:48:
b6:ca:9e:c6:4a:e2:33:32:ca:e1:05:60:3d:01:b7:
65:be:f3:de:33:6e:38:37:b7:74:be:42:5d:93:ab:
e3:bb:4c:ab:37:1d:85:3c:dc:94:89:e8:b3:8c:e6:
a1:d7:42:d2:08:58:6c:88:3d:36:13:b6:4b:50:3a:
e8:62:1f:27:06:06:2a:7b:95:24:dd:b7:e4:e7:9b:
7b:f2:1f:88:82:a2:dd:75:45
Exponent: 65537 (0x10001)
You'll get something like this. Stripe :
character from the Modulus and 0x
from the Exponent and convert both into binaries.
Another way, when you retrieve the key from user input and don't want to disclose it to your server side You have to use ASN.1 parsing library. I tried asn1js for my purposes and it just works.
Thank you so much, I will try with ASN1js and I will come back if I have any trouble.
I keep this issue open for the moment, hope you doesn't mind.
Thanks again :)
Hi. First off, thank for this beautiful lib and sorry to bother you.
I currently start to use you library for a project that involve a nodejs server. I have currently a big problem for transforming the
openssl format key
to a tuple like the generateKey return for using your libs.I have seen #90, and I'm in a worker which doesn't allow me to use the WebCrypto API.
I would like to understand how I could achieve that.
PS: I am not realy advanced in any crypto things.