Tuesday, December 29, 2015

How to Set Proxy in Command Prompt?

For http/https proxy with authentication, run the following commands in cmd.exe

set http_proxy=http://username:password@your_proxy:your_port
set https_proxy=https://username:password@your_proxy:your_port

For http/https proxy without authentication, run the following commands in cmd.exe

set http_proxy=http://your_proxy:your_port
set https_proxy=https://your_proxy:your_port

Implementation of Certification Authentication in WebMethods Integration Server

In order to implement certification authentication in WebMethods Integration Server, follow the following steps:

Step 1: Map client to a user

    To have a mapping between certificate and IS user, go to Security->Certificates->Configure client       certificates and assign the values as follow:

    Certificate Path: Path for client's signer certificate
    User: <<username>>
    Usage: SSL Authentication

Step 2: Enable the HTTPS port and set it to REQUIRE a client certificate

    Where the port number is <<port number>> and package name is <<your package>>

Step 3: Import client side's signer certificate and assign it to <<port number>>

Monday, June 29, 2015

DB Table Grants


For each table under DB schema must be next granting clause, so in USER can access and modify data inside that table:

 

GRANT SELECT ON <TABLE_NAME> TO QUERY_ROLE;

 

GRANT DELETE, INSERT, SELECT, UPDATE ON < TABLE_NAME> TO UPDATE_ROLE;

 

Friday, June 12, 2015

Error itms-90035 - Xcode

I have developed an Objective C application which is running absolutely fine on iPhone. Now, I want to submit the app to the App Store. Following is the steps to submit the app:
  1. Open Xcode and archive the project
  2. Click on validate (which is successful)
  3. Click on Submit to App Store
enter image description here

Solution:
remove .sh files from target.
The problem appears to be due to including files named "upload-dsym.sh" or other "*.sh" in the app bundle. Here are the steps to get past this error: 
Go to the project settings in Xcode and select the "Target" app icon
Select the Build Phases tab and click on "Copy Bundle Resources"
Look for files named "upload-dsym.sh" or other "*.sh"
Remove those files
Upload fine

Friday, May 15, 2015

Ignore Self-signed Certificate in Node.js

Issues: 

Error : self-signed certificate using npm or jasmine-node

Solution:

ADD process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0" before the request is sent.

Generate HamcMD5 Hashcode

public class TokenUtil {


public static String HMAC_MD5_encode(String key, String message) {

if (key != null && message != null){
   SecretKeySpec keySpec = new SecretKeySpec(
           key.getBytes(),
           "HmacMD5");
   Mac mac;
   byte[] rawHmac = null;
try {
mac = Mac.getInstance("HmacMD5");
mac.init(keySpec);
   rawHmac = mac.doFinal(message.getBytes());
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
            if (rawHmac.length > 0) {
       return Hex.encodeHexString(rawHmac);
            } else {
            return null;
            }
   } else {
return null;
}
}

}

Encrypt and Decrypt String with Key

public class EncryptorUtil {

private static String paramKey = "1234567890123456";
public static String encrypt(String key, String value) {
   try {
       IvParameterSpec iv = new IvParameterSpec(paramKey.getBytes("UTF-8"));

       SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"),
                   "AES");
       Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
       cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
       byte[] encrypted = cipher.doFinal(value.getBytes());
           return Base64.encodeBase64String(encrypted);
       } catch (Exception ex) {
           ex.printStackTrace();
       }
       return null;
   }

public static String decrypt(String key, String encrypted) {
   try {
       IvParameterSpec iv = new IvParameterSpec(paramKey.getBytes("UTF-8"));

       SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"),
                   "AES");
       Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
       cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
       byte[] original = cipher.doFinal(Base64.decodeBase64(encrypted));

       return new String(original);
   } catch (Exception ex) {
       ex.printStackTrace();
   }
       return null;
}

public static void main(String[] args) {

   String key = "9876543210123456"; // 256 bit key
       
   System.out.println(encrypt(key, "djkhflasdjdf"));
   System.out.println(decrypt(key, "iUoMmTT9n/NEA5mXhgDnn0/SM8fvpMTKyJcFQU=="));
}
}