Commit f6e02bd8 authored by steurwadkar's avatar steurwadkar

F17ABAS001 source code commit


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106085 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 563301d8
...@@ -17,5 +17,5 @@ public interface GSTDataSubmitWizEJBLocal extends ValidatorLocal ...@@ -17,5 +17,5 @@ public interface GSTDataSubmitWizEJBLocal extends ValidatorLocal
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext,String editFlag, String xtraParams) throws RemoteException, ITMException; public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext,String editFlag, String xtraParams) throws RemoteException, ITMException;
public String wfValData(Document currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException; public String wfValData(Document currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String handleRequest(HashMap<String, String> reqParamMap); public String handleRequest(HashMap<String, String> reqParamMap) throws ITMException;
} }
...@@ -17,5 +17,5 @@ public interface GSTDataSubmitWizEJBRemote extends ValidatorRemote ...@@ -17,5 +17,5 @@ public interface GSTDataSubmitWizEJBRemote extends ValidatorRemote
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext,String editFlag, String xtraParams) throws RemoteException, ITMException; public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext,String editFlag, String xtraParams) throws RemoteException, ITMException;
public String wfValData(Document currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException; public String wfValData(Document currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String handleRequest(HashMap<String, String> reqParamMap); public String handleRequest(HashMap<String, String> reqParamMap) throws ITMException;
} }
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDAgsfg1BtqUKuA
VA0fNgVdkAK8osu+RrdgypJIrwdrYPm2MR1HqnwgbnUbNBZdX+kvW8VtM0QEwUvp
kllEmx6+oPgARo57V/man/BpdcftBqlKRTNR8d5CIiHvSkY7Hgf7WteuiSQ5d7WA
4mwnILmCgaPBGgvZikUev+ZJeXWVxtyOk/MYZRwJ0Tznz8BuD2xNz5MAI6Inv71A
ygUzy3gh0AdLGaRtqZTnZ/2jTfehvg/+A/ticiy74bc49jBdjSpEUpuSWckpEIFr
Ey1vj+fvVHSoOiogGtiuRifsC33mLb9TK1xpZYDPbM8UN8I2vB64QtpigoOEL/J+
IzKXooj9AgMBAAECggEAFZTTuYWtyR5gC5PgoLYapeGGHQWXF66v0h8DhThx+Xy2
odEhui4Hmk8nu7P8Kd2ds5xzJonPv0S4MOgiL8nACZjcFJPUV0mGhuoVNo1oq07K
3bOiTDZ0Ny/CZCQMeYYlWO1XLo7bS8H6zAcWHtDRWysTY4t69plEpGzY8TW3k+G0
g1xwgXBr/S5WGZBpU/dHNA7ubAnI/zy27ez5YahgQHeWmwHnh4Ap0rcSjoNNauQX
QlfUJp6+Gt/IqWSlm5d6QeC1SZe+lDmbH4K7TRs3PtnF6o0kmyJZQFIzVNlcxZfX
9kxL1xN6n/EoZcuxvxTJDV2MDsq1bwogdt5PB1XDQQKBgQDf3xUqDVHviMUw12Ws
ZztUJfLxFnP/THi0Erl9z/1+xy8TNFIg37eOF+g4tx106n1lvVLTlyRcOtTHiX/W
+G3sHPu/ybVVau0N6S5sQHzSE0XS3blES50vp6laO9SnJSYrvVSs8hfEZNEOKXxB
M2Oqo5hBkA+Ebmpjd68QJkky0QKBgQDcI4cnDpjAXJa3kg046doU50p6ttdbdclY
4YzXlD8U0RHPp/UJV4eRAbaR0hicJTP5/vAi72f99Ei1zZd8Z7KRspPmVL/nQI2/
o0eCb2nnnnykow7QAgij4WIaadb2AsJSYw/KSHZFKkJDD7vVYOsbmy3FPI7LUL5L
JiKIepcGbQKBgQDKngp2s/WLeVsXmGvCPPB6eZpGz46O6vR37laJ4xxIiRg3JmyK
qlBkP4kDA+CaN7zkvxRewvW6r9hy/CSDOPer8pN7gqEnPQ5uP7SvbzJJo/3XGqwa
fuE2B2YEcBBIcxv4DHS9zqLqMmDvk2aNUGiNQWGFPVB+CL0rZ2A/mpc3cQKBgQCa
On3m3DAinPuu8rE2zYfPm1ev78ejuTrufV8qbh9f2zXqUVa4S82bxyJ8uUAqrVnj
7TuajjZCUtJaJQbbzt7per5p4bhtMOneeGuSM7Jz5rKWufKXwsUA49fSf5Jt2vL/
u42FgAz0Wi4AQ9aqIPO27Jo9lDbKtPANQFNzYMfMZQKBgAF5I0HUF4taJ6/+lJot
0ELRZw2yuXSbxf0OYRW3LEgcTt7i+Gp9bY/AiBzEOcyL2lVZ8NWpK2aUMrUjWms8
4ZWEIS58FyvKjmWe7k7IVY0Bd9bOVMZsbjqRB42EyrXWyIHwroSEufSANTdl8UiW
RbN/8Jo2oRwiL5s9tSeON5Oa
-----END PRIVATE KEY-----
package ibase.webitm.util.gst;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
import javax.crypto.KeyGenerator;
import javax.xml.bind.DatatypeConverter;
import ibase.planner.utility.ITMException;
public class GSPSignature
{
private static KeyGenerator KEYGEN;
final String CHARACTER_ENCODING = "UTF-8";
final String AES_ALGORITHM = "AES";
final int ENC_BITS = 256;
public GSPSignature()
{
try
{
KEYGEN = KeyGenerator.getInstance(AES_ALGORITHM);
KEYGEN.init(ENC_BITS);
}
catch (Exception e)
{
System.out.println("GSPSignature.GSPSignature()["+e.getMessage()+"]");
e.printStackTrace();
}
}
public PrivateKey loadPrivateKey(InputStream privateKeyInputStream) throws IOException, GeneralSecurityException, ITMException
{
PrivateKey key = null;
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(privateKeyInputStream));
StringBuilder builder = new StringBuilder();
boolean inKey = false;
for (String line = br.readLine(); line != null; line = br.readLine())
{
if (!inKey)
{
if (line.startsWith("-----BEGIN ") && line.endsWith(" PRIVATE KEY-----"))
{
inKey = true;
}
continue;
}
else
{
if (line.startsWith("-----END ") && line.endsWith(" PRIVATE KEY-----"))
{
inKey = false;
break;
}
builder.append(line);
}
}
byte[] encoded = DatatypeConverter.parseBase64Binary(builder.toString());
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded);
KeyFactory kf = KeyFactory.getInstance("RSA");
key = kf.generatePrivate(keySpec);
}
catch (Exception e)
{
System.out.println("GSPSignature.loadPrivateKey()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
return key;
}
public String sign(String message, PrivateKey privateKey) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException
{
Signature sig = Signature.getInstance("SHA1WithRSA");
sig.initSign(privateKey);
sig.update(message.getBytes());
byte[] signatureBytes = sig.sign();
String signature = Base64.getEncoder().encodeToString(signatureBytes);
System.out.println("Signature:" + signature);
return signature;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment