Hi all,

I'm developing a part of a J5EE application which signs emails.

I have a PKCS12 keystore, which contains a keypair. I'm using Bouncy Castle's libraries to manage the keystore and so on...

I'm using Tomcat 5.5 as well.

I've edited java.security and added the BouncyCastle provider as follows:

security.provider.6=org.bouncycastle.jce.provider. BouncyCastleProvider

And also added the jars bcprov-jdk15-141.jar and bcprov-ext-jdk15-141.jar to %JAVA_HOME%/lib/ext

In my java class I load the keystore:

EncryptionUtils smimeUtils = EncryptionManager.getEncryptionUtils(EncryptionMan ager.SMIME);
EncryptionKeyManager smimeKeyMgr = smimeUtils.createKeyManager();
File keystoreFile = new File(keystoreLocation);
FileInputStream keystoreFIS = new FileInputStream(keystoreFile);
smimeKeyMgr.loadPrivateKeystore(keystoreFIS, smimePass);

the last sentence throws an exception that goes like:

java.io.IOException: error constructing MAC: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
at org.bouncycastle.jce.provider.JDKPKCS12KeyStore.en gineLoad(Unknown Source)
at java.security.KeyStore.load(KeyStore.java:1185)
at net.suberic.crypto.bouncycastle.BouncySMIMEEncrypt ionKeyManager.loadPrivateKeystore(BouncySMIMEEncry ptionKeyManager.java:107)

I have no idea why this is happening, I've googled the exception but I can't get an answer that fixes the problem for me, any ideas?