Setting a HMAC key

IMPORT xml

MAIN
  DEFINE key xml.CryptoKey
  LET key = xml.CryptoKey.Create("http://www.w3.org/2000/09/xmldsig#hmac-sha1")
  TRY
    CALL key.setKey("secretpassword")
    # displays 112 (size of secretpassword in bits)
    DISPLAY "Key size (in bits) : ",key.getSize()
    DISPLAY "Key type : ",key.getType() # displays HMAC
    DISPLAY "Key usage : ",key.getUsage() # displays SIGNATURE
  CATCH
    DISPLAY "Unable to set key :",status
  END TRY
END MAIN
Note:

All keys in PEM or DER format were created with the OpenSSL tool.