How do I integrate HSM encryption with JAVA?

13,461

Solution 1

In JAVA you can just use JCE/JCA. Ask your provider for the implementation, you will need some jar files, and you're ready.

Solution 2

All HSM should support common API interfaces, such as PKCS11, JCE or MSCAPI. For Java integration, they would offers JCE CSP provider as well. Simply configure the provider, and they you can use the Keystore/KeyGenerator as per normal.

Share:
13,461

Related videos on Youtube

Armin
Author by

Armin

Updated on September 15, 2022

Comments

  • Armin
    Armin over 1 year

    How do i integrate Hardware Security Module encryption with a java application? I'm looking for code samples to connect to HSMs, generate keys(asymmetric, symmetric), encrypt and decrypt data (asymmetric, symmetric) and store keys.

  • Armin
    Armin over 11 years
    would you tell me how to connect to HSM ?
  • Frank
    Frank over 11 years
    that will depend on your provider, but in my case it was all configuration done on the WAS server.
  • Armin
    Armin over 11 years
    so i just need to add provider jar file to project and call Security.addProvider(provider) and start coding like follow codes ? SecureRandom random = new SecureRandom(); KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "BC"); generator.initialize(256, random); pair = generator.generateKeyPair();
  • Frank
    Frank over 11 years
    be careful to always use the correct provider code/string in all your calls and your safe
  • Rafael Membrives
    Rafael Membrives about 8 years
    To use a Luna HSM for example you must add a LunaProvider, login with an LunaSlotManager and then you can get a KeyStore connected to the HSM KeyStore.getInstance("Luna") or get a KeyPairGenerator KeyPairGenerator.getInstance("RSA", "LunaProvider") cloudhsm-safenet-docs-5.3.s3-website-us-east-1.amazonaws.com‌​/…