Convert java code into c# code

Last Reply 10 days ago By dharmendr

Posted 10 days ago

i have a encryption code in java and i want to convert it into c# source code.

plesae help!!

public String encrypt(String instaReq)
			throws ApplicationException
	{
		String encrInstaResp = null;
		try
		{
			String lKey = "#g%t8&(k$^";
			SecretKeySpec lKeySpec = new SecretKeySpec(lKey.getBytes("UTF8"), "Blowfish");
			Cipher lCipher = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
			lCipher.init(1, lKeySpec);
			byte[] lPassword = instaReq.getBytes("UTF8");
			byte[] lEncryptPassword = lCipher.doFinal(lPassword);
			encrInstaResp = DatatypeConverter.printBase64Binary(lEncryptPassword);
			StringBuilder nString = new StringBuilder();
			for (int i = 0; i < encrInstaResp.length(); i++)
			{
				int a = encrInstaResp.charAt(i);
				if ((a != 13) && (a != 10) && (!" ".equals(encrInstaResp.substring(i, i + 1)))) {
					nString.append(encrInstaResp.charAt(i));
					System.out.println("nString.append(encrInstaResp.charAt(i))" + encrInstaResp);
				}
			}
			System.out.println("nString.toString() = "+nString.toString());
			return nString.toString();
		}
		catch (Exception lException)
		{
			//     LOGGER.info("PGI Exception : ", lException);
			throw new ApplicationException(ApplicationErrorCodes.BUSINESS_EXCEPTION);
		}
	}

 

You are viewing reply posted by: dharmendr 10 days ago.