Hi,
I'm testing with X.509 on SAP PI 7.4 SP08 , I could sign, verify, encrypt and decrypt values in a UDF.
I have copied and pasted the code in a module ( EJB 3.0 ) and is not working, below is the code to encrypt:
public byte[] encrypt(byte[] inpBytes, String keyStorageView, String keyStorageEntry,String SubjectDN) throws Exception { KeyStore keyStore = null; boolean res = false; ByteArrayInputStream is = null; SsfDataPKCS7 data = null; byte[] result = null; InitialContext ctx = null; ctx = new InitialContext(); Object o = null; o = ctx.lookup("keystore"); KeystoreManager manager = (KeystoreManager)o; keyStore = manager.getKeystore(keyStorageView);//in debugging mode I see no certificates! is = new ByteArrayInputStream(inpBytes); data = new SsfDataPKCS7((InputStream)is); SsfPabKeyStore profile; profile = new SsfPabKeyStore(keyStore); SsfSigRcpList test = new SsfSigRcpList(); test.add(new SsfSigRcpInfo(profile.getCertificateBySubjectDN(SubjectDN)));//null value in "profile.getCertificateBySubjectDN(SubjectDN)" res = data.encrypt(test,(ISsfPab)profile); if (res) { result = (byte[])data.getDataPKCS7(); } return result; }Any ideas?.(I think it's a bug).
Best regards.