title: How to derive a key with JCA/JCE and with an HSM
body: <p>I have a master key in an HSM and I want to derive it with a given diversifier.
  I am quite new to JCA/JCE, and a bit lost with KeyGenerator, SecretKeyFactory, ... especially since all parameters are strings.
  I want to use AES or HmacSha1.
  It seems I need to use a SecretKeyFactory, and provide a KeySpecs.  But which type of KeySpecs?</p>
  
  <p>(I have seen a post on that topic, but I didn't seem an HSM was used.)</p>
  
  <p>Thanks.</p>