Create the SRI(Sub Resource Integrity for Javascript Library/CDN URL)

  1. For CDN JavaScript URL , you can directly visit on this URL(https://www.srihash.org/) and paste your CDN URL(e.g.https://example.keycdn.com/path/example.js ), It will generate the Hash Key. Need to put the Hash key with append the algo key e.g. integrity=”sha384-xnSV7Ujm6p40d9oLBjPsEZVraTaUO5LOWBOcat4SO3W8JI/jp7QXU5Be9/iy5bfE” crossorigin=”anonymous”, “sha384” is SRI hash key.
  2. For those which is not serving from CDN, in that case you need to download the openssl.
    • a) Open CMD as administrator mode and come to the path where openssl .exe is placed.
    • b) Download the required the JS file from that path or create the file.
    • c) Execute the command :
    • openssl dgst -sha384 -binary FILENAME.js | openssl base64 -A
    • Into the cmd at the place where the openssl .exe exist.
  3. For more reference you can visit mentioned url: https://www.keycdn.com/support/subresource-integrity