cancel
Showing results for 
Search instead for 
Did you mean: 

Keystore security + User exception

Former Member
0 Kudos

Hi Experts,

We are having the scenario to sign the content and send it to bank using our private key.

We are in SAP PO 7.4 and trying the sign the partial content of the data using the following.

Following libraries are used.

import com.sap.engine.interfaces.keystore.KeystoreManager;

import com.sap.security.core.server.ssf.SsfDataPKCS7;

import com.sap.security.core.server.ssf.SsfProfileKeyStore;

                

                                                                 InitialContext ctx = new InitialContext();

                                                                 Object o = (Object) ctx.lookup("keystore");

                                                                

                                                                // KeystoreManager manager = (KeystoreManager) o;

                                                                 KeystoreManager manager = (KeystoreManager)ctx.lookup("keystore");

                               

                                                                 KeyStore ks = manager.getKeystore("TrustedCAs");

                                                                 String alias = "test";

                                                                // ISsfProfile profile = null;

                                                                

                                                                  profile = new SsfProfileKeyStore(keyStore, alias, null);

                                                                 

                               

//                            Encrypting XMLData in Base64 format   

                                                                  String strXMLData =  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Message>" + n2.toString() + FormattedSign.toString().trim();

                                                                  strEncrXmlData = base1.encode( strXMLData.getBytes());

                                                

                                                          

                                                                 res = data1.sign(profile, data1.ALG_SHA , data1.INC_CERT_CHAIN_ROOT, false);

                                                                                                                                 byte b[] = data1.getDataPKCS7();

                                                                 String value = new String(b);

//                            Encrypting the data in Base 64 format

                                                                 String strSignature =  value.trim();

                                                                 //DatatypeConverter.printBase64Binary(strSignature.getBytes());

                                                                 strEncrSign = base1.encode(strSignature.getBytes());

                               

                                                                String FlatData = "strXmldata=" + strXMLData + "<Signature><SignatureValue>" + strEncrSign + "</SignatureValue></Signature></Message>";

                                                                out.getOutputPayload().getOutputStream().write(FlatData.getBytes());

I am getting User authorization error.  java.lang.SecurityException: User not authorized.

Request your kind inputs to resolve this . This is urgent . Kindly help.

Best Regards,

Suresh S

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member187587
Contributor
0 Kudos

What channel are you using to send the data?

Former Member
0 Kudos

Hi Gisis,

we are using HTTP_AAE Channel, we have resolved it with change in JAVA mapping logic.

Best Regards,

Suresh S