Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unsupported algorithm 'hmac' -- Safari #40

Open
lightninglu10 opened this issue Sep 6, 2017 · 4 comments
Open

Error: Unsupported algorithm 'hmac' -- Safari #40

lightninglu10 opened this issue Sep 6, 2017 · 4 comments

Comments

@lightninglu10
Copy link

lightninglu10 commented Sep 6, 2017

Hey guys, I'm trying to use this package or webcrypto-shim to fix Safari's webcrypto package.

I'm getting this error though:

Error: Unsupported algorithm 'hmac'

I've included asymcrypto and elliptic in my html:

    <script src="%PUBLIC_URL%/webcrypto-liner.shim.js"></script>
    <script src="%PUBLIC_URL%/asmcrypto.min.js"></script>
    <script src="%PUBLIC_URL%/elliptic.min.js"></script>

Any advice here?

@rmhrisk
Copy link
Contributor

rmhrisk commented Sep 6, 2017

We did not add HMAC to liner yet.

You can see the algorithms we did add support for in the README.

asymcrypto.js does support HMAC so you could easily do a PR that added it to liner.

You would basically use the SHA2 logic as the prototype

@lightninglu10
Copy link
Author

lightninglu10 commented Sep 6, 2017

For hmac, asymcrypto supports

HMAC-SHA1
HMAC-SHA256
HMAC-SHA512

but in webcryptocore, there's only algorithm name Hmac.

Looking at what you guys did for sha2, how would it know which one to use?

Or can I use any of the sha schemes?

@rmhrisk
Copy link
Contributor

rmhrisk commented Sep 6, 2017

Webcrypto core is a generic layer we use for input validation in our various WebCrypto libraries.

You would need to add support for HMAC-SHA256 (and maybe HMAC-SHA512) to liner for it to work.

You can use the existing SHA256 code as a guide.

@microshine is busy with another work right now so we cant commit to doing it ourselves in the near term but if you or someone else wanted to add these we would be open to a solid PR.

@microshine
Copy link
Contributor

It'll be helpful if somebody wants to make PR

HMAC examples
W3 HMAC specification - webcrypto-core checks incoming data

  1. Create HmacCryptoKey and HmacCrypto, similar to RSA implementation
  2. Add HmacCrypto to SubtleCrypto
  3. Make tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants