Announcement

Collapse
No announcement yet.

JSON Web Token (JWT) and SHA384 encryption

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    JSON Web Token (JWT) and SHA384 encryption

    Hello,

    We have an internal medical API project requiring usage of JSON Web Tokens (JWT). Has anyone had any experience with creating JWT with Mivascript? One of the needs when creating JWT is to use SHA384 encryption. Does Miva have any plans to add SHA384 encryption? We would prefer to stay within Mivascript.

    Thanks for any comments, suggestions or feedback.

    -mike

    #2
    I believe you can use crypto_evp_digest to generate a sha384 sum
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      Thank you David! This should get us sliding in the right direction!

      -mike

      Comment


        #4
        Any code examples on doing this?
        I need to generate a JWT. I have the key name and the secret and the data to be encoded..
        B
        William Gilligan - Orange Marmalade, Inc.
        www.OrangeMarmaladeinc.com

        Comment


          #5
          Something like this should work

          Code:
          <MvASSIGN NAME = "l.buffer" VALUE = "{ crypto_base64_encode( l.header ) $ '.' $ crypto_base64_encode( l.header ) }">
          
          <MvIF NOT EXPR = "{ crypto_evp_hmac( 'sha256', 'supersecretkey', l.buffer, l.signature ) }">
              <error here>
          </MvIF>
          
          <MvASSIGN NAME = "l.jwt" VALUE = "{ l.buffer $ '.' $ crypto_base64_encode( l.signature ) }">
          David Carver
          Miva, Inc. | Software Developer

          Comment


            #6
            Hey Bill,

            I've attached a .txt file of our function that creates the JWT. The l.signedToken toward the bottom is the JWT.

            -mike

            JwtFunction.txt

            Comment

            Working...
            X