on 09-23-2016 7:28 AM
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
What channel are you using to send the data?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.