square/js-jose

Javascript runtime error: 'Jose' is undefined in IE

Rajeshkumar123 opened this issue · 3 comments

Hi,

I am using Jose to encrypt the json data purpose. I have referred the following plugins in my code

<script src="@Url.Content("~/Content/External/Scripts/joseEncryption/promiz.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Content/External/Scripts/joseEncryption/webcrypto-shim.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Content/External/Scripts/joseEncryption/jose.js")" type="text/javascript"></script>

My code is:

crypto = new Jose.WebCryptographer();
            crypto.setKeyEncryptionAlgorithm("RSA-OAEP-256");
            crypto.setContentEncryptionAlgorithm("A128CBC-HS256");
            rsa_key = Jose.Utils.importRsaPublicKey(rsa_key, "RSA-OAEP-256");
            encrypt = new JoseJWE.Encrypter(crypto , rsa_key);

The above code is working fine in chrome browser but I am getting this error Javascript runtime error: 'Jose' is undefined in IE 11 browser.

Am I missing anything or do I need to include any additional script reference to overcome this issue.

Thanks in advance

I'm having the same issue. Would adding a polyfill to the WebCrypto API fix this?

@Rajeshkumar123 did you ever find a workaround this?

After adding webcrypto-shim I don't get this error anymore.

@wfortin Thank you so much for your work around. Let me give a try on this...