Re: Importing ECDSA public key from javascript/subtlecrypto
| From: | Martijn van Duren | Date: | Mon, 12 Jun 2017 09:46:07 +0000 |
| Subject: | Re: Importing ECDSA public key from javascript/subtlecrypto | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326111@lists.php.net to get a copy of this message | ||
Hello Adam,
Thanks for your reply.
There are two issues with the pem-jwk package:
1) It's an npm-package and using browserify didn't seem to produce a usable
file.
2) When you look into the code you see that it uses RSAPublicKey.encode,
while I need ECDSA keys.
I also looked into generating a crt from within PHP, but the standard is
complex and I don't have the time nor skills at this time to build something
like that myself.
On 06/09/17 19:20, Adam Jon Richardson wrote:
> On Fri, Jun 9, 2017 at 4:38 AM, Martijn van Duren <php@list.imperialat.at>
> wrote:
>>
>>
>> For a project I'm working on I need to import an ECDSA public key into
>> the openssl extension to verify data/signatures send by the client. The
>> key has been verified, so that's no problem.
>>
>> The problem is the fact that subtlecrypto exports the key as raw, spki,
>> or jwk, while non of these can be imported into the openssl extension.
>>
>> Can anyone inform me on a way to make the key compatible with the
>> openssl interface, be it on the javascript side or the php side.
>>
>> Martijn van Duren
>
>
> Well, you could fiddle with trying to base64 the raw output and create a
> pem-formatted crt file of your own using PHP, but this npm package looks
> easier if you export as a jwk and then use the package to convert to a pem:
> https://www.npmjs.com/package/pem-jwk
>
> Adam
>