Click here to Skip to main content
16,020,114 members

Comments by normalsoft (Top 52 by date)

normalsoft 24-Jan-17 3:59am View    
Thanks for the reply. I'll check with them regarding this.
normalsoft 18-May-15 8:19am View    
Thank u for the quick reponse.
I'm new in wcf. They have given the certificate and I have written code for trying to bypass the certificate using following code. it was working. But i think it may be problem of web.config file.

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }
normalsoft 22-Jun-14 10:26am View    
Please help.
normalsoft 22-Jun-14 7:16am View    
private String _encrypt(String message, String secretKey) throws Exception {

MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] digestOfPassword = md.digest(secretKey.getBytes("utf-8"));
byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);

SecretKey key = new SecretKeySpec(keyBytes, "DESede");
Cipher cipher = Cipher.getInstance("DESede");
cipher.init(Cipher.ENCRYPT_MODE, key);

byte[] plainTextBytes = message.getBytes("utf-8");
byte[] buf = cipher.doFinal(plainTextBytes);
byte[] base64Bytes = Base64.encodeBase64(buf);
// byte [] base64Bytes = Base64.;
String base64EncryptedString = new String(base64Bytes);

return base64EncryptedString;
}

private String _decrypt(String encryptedText, String secretKey) throws Exception {

byte[] message = Base64.decodeBase64(encryptedText.getBytes("utf-8"));

MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] digestOfPassword = md.digest(secretKey.getBytes("utf-8"));
byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
SecretKey key = new SecretKeySpec(keyBytes, "DESede");

Cipher decipher = Cipher.getInstance("DESede");
decipher.init(Cipher.DECRYPT_MODE, key);

byte[] plainText = decipher.doFinal(message);

return new String(plainText, "UTF-8");
}
normalsoft 22-Jun-14 6:55am View    
Thanks bro. I do the same. jar file added to project and build. Now showing
"can not find symbol." Method encodeBase64(..)