0

I am trying to generate a KeyPair using the Bouncy Castle library by create a nCipherKM instance and the RSA algorithm.

This operation is failing, it seems to be caused due to an incorrect or incomplete configuration of the HSM and nCipher Tools because I can't see the RSA algorithm to be available to be used for Keypairs generation.

Can anybody help me on what I need to do or setup to have the RSA algorithm as one of the available for the HSM operations?

I am trying to generate a KeyPair using the Bouncy Castle library:

KeyPairGenerator.getInstance("RSA", "nCipherKM");

but I am receiving an error:

java.security.NoSuchAlgorithmException: no such algorithm: RSA for provider nCipherKM

If I run:

java -jar com.ncipher.provider.InstallationTest

It is supossed to get something like this:

nCipher JCE services:
Alg.Alias.AlgorithmParameters.DESede
Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.3.7
Alg.Alias.Cipher.1.2.840.113549.1.1.1
Alg.Alias.Cipher.1.2.840.113549.3.4
Alg.Alias.Cipher.1.2.840.113549.3.7
Alg.Alias.Cipher.AES
Alg.Alias.Cipher.CAST6
Alg.Alias.Cipher.DES3
...
KeyPairGenerator.RSA
KeyStore.JKS
KeyStore.nCipher.sworld
...

But I am getting:

nCipher JCE services:
Alg.Alias.SecureRandom.SHA1PRNG
AlgorithmParameters.IVParameters
KeyStore.JKS
KeyStore.nCipher.sworld
SecureRandom.RNG

And that's it. So I think this is the cause what I am not able to genereate keypairs with bouncy castle.

Any help will be great!!!

Mark
  • 1
  • Your code is not trying to use BouncyCastle at all. To use Bouncy you either call directly (their 'lightweight' API aka LWAPI) or use JCA and specify or default to the BC provider; you are doing neither. If you actually want to use Bouncy, you are doing it wrong. If you actually want to use nCipher (and not Bouncy) then I agree there appears to be something wrong with your HSM or connection to it, but I no longer work at the job that might have enabled me to help, sorry. – dave_thompson_085 Sep 05 '19 at 20:22
  • Thanks dave, you're right, my mistake, I am new on this cryptography world :(. What I sould to said was that using BC provider it workes fine for me, but using nCipherKM not. My question is what I need to configure to enable the RSA algorithm to generate KeyPairs with nCipherKM provider if it is not well configured. There is any documentation or clue of what could be happening? – Mark Sep 06 '19 at 15:42

0 Answers0