I have a problem in loading the private key of my J2EE Engine into an EJB for generation of signatures.
InitialContext context = new InitialContext();
KeyStoreManager manager = (KeystoreManager) context.lookup("keystore");
KeyStore keyStore = manager.getKeystore(keyStoreView);
SsfProfileKeyStore profile = new SsfProfileKeyStore(keyStore, alias, null);
PrivateKey key = profile.getPrivateKey();
java.security.Signature sig = Signature.getInstance("SHA1withRSA");
So as I said, I have to do this within an EJB for security reasons. My problem is at the point where the private key is derived from the profile. the getPrivateKey method always returns null.
But if I add a main method to the EJB (senceless I know) and derive the InitialContext remote, it returns the private key and the signature is created.
I also tested to do this with: SsfDataXML and its sign method. If I do this remote, the signature is created. But deploayed as EJB, I get the message:
Private key of signer not available
I checked the permissions within the Security Provider --> XiRuntimePermission and within the Key Storage --> tab Security and gave my deployed EJB the permissions.