How to derive a key with JCA/JCE and with an HSM
问题 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? (I have seen a post on that topic, but I didn't seem an HSM was used.) Thanks. 回答1: You can derive key using: password-based derivation (PKCS#5) as described in