public static String getHeaderString(String line, List<EncryptionRule> rules, String delimiter) throws InvalidKeyException {
        List<Integer> columns = EncryptionManager.getColumnIds(rules);

        StringBuffer sb = new StringBuffer();
        int tokenNum = 0;
        
        String[] tokenArray = line.split(delimiter, -1);
        //make sure that line has sufficient tokens 
        validateTokenCount(tokenArray, columns);

        for(tokenNum = 0; tokenNum < tokenArray.length; tokenNum++){    
            String tokenStr = tokenArray[tokenNum];
            tokenStr = removeDoubleQuotes(tokenStr);
            //System.out.println("#" + tokenNum + ": " + tokenStr);
            if(columns.contains(new Integer(tokenNum))){
                EncryptionRule rule = getRule(tokenNum, rules);
                
                if(rule.getEncryptions().size() > 0){
                    //apply encryptions
                    List<Integer> encryptions = rule.getEncryptions();
                    for(Integer encryption : encryptions){
                        if(tokenStr != null && tokenStr.trim().length() > 0){
                            if(encryption == EncryptionRule.SHA1){
                                sb.append(tokenStr+PiiConstants.SHA1_SUFFIX).append(delimiter);
                                //System.out.println("    Encrypt #" + tokenNum + " SHA1 , Token: " + tokenStr+" hashed: "+getSHA1Enc(tokenStr));
                            }else if(encryption == EncryptionRule.SHA256){
                                sb.append(tokenStr+PiiConstants.SHA256_SUFFIX).append(delimiter);
                                //System.out.println("    Encrypt #" + tokenNum + " SHA256 , Token: " + tokenStr+" hashed: "+getSHA256Enc(tokenStr));
                            }
                        }else{
                            //String was blank - just leave blank instead of encrypting
                            sb.append("").append(delimiter);
                        }
                        
                    }
                }else{
                    //no encryptions to apply
                    sb.append(tokenStr).append(delimiter);
                    //System.out.println("Token #" + tokenNum + ", Token: " + tokenStr);
                }
                
            }else{
                //TODO APPEND TOKEN AS_IS
                sb.append(tokenStr).append(delimiter);
            }
            
        }
        
        //remove the last comma if end reached
        String result = sb.toString();
        result = result.substring(0, result.lastIndexOf(delimiter));
        
        return result;
    }