private static string getSecure(byte[] secureBody, byte[] pinKey, byte[] macKey)
        {
            byte[] secureBytes        = new byte[64];
            byte[] headerBytes        = new byte[1];
            byte[] formatVersionBytes = new byte[1];
            byte[] macVersionBytes    = new byte[1];
            byte[] pinDesKey          = new byte[16];
            byte[] macDesKey          = new byte[16];
            byte[] secureBodyBytes    = new byte[28];
            byte[] footerBytes        = new byte[1];

            headerBytes        = AppUtils.hexConverter(Constants.SECURE_HEADER);
            formatVersionBytes = AppUtils.hexConverter(Constants.SECURE_FORMAT_VERSION);
            macVersionBytes    = AppUtils.hexConverter(Constants.SECURE_MAC_VERSION);
            pinDesKey          = pinKey;
            macDesKey          = macKey;
            secureBodyBytes    = secureBody;
            footerBytes        = AppUtils.hexConverter(Constants.SECURE_FOOTER);

            Array.Copy(headerBytes, headerBytes.GetLowerBound(0), secureBytes, 0, 1);
            Array.Copy(formatVersionBytes, 0, secureBytes, 1, 1);
            Array.Copy(macVersionBytes, 0, secureBytes, 2, 1);
            Array.Copy(pinDesKey, 0, secureBytes, 3, 16);
            Array.Copy(macDesKey, 0, secureBytes, 19, 16);
            Array.Copy(secureBodyBytes, 0, secureBytes, 35, 28);
            Array.Copy(footerBytes, 0, secureBytes, 63, 1);
            String encrytedSecure = Encoding.Default.GetString(RSAUtils.rsaEncrypt(publicKeyModulus, publicKeyExponent, secureBytes));

            AppUtils.zeroise(secureBytes);

            return(encrytedSecure);
        }
        public static String getGenericSecure(string pan, string msisdn, string ttId, string amt, byte[] pinKey, byte[] macKey)
        {
            byte[] secureBytes        = new byte[64];
            byte[] headerBytes        = new byte[1];
            byte[] formatVersionBytes = new byte[1];
            byte[] macVersionBytes    = new byte[1];
            byte[] pinDesKey          = new byte[16];
            byte[] macDesKey          = new byte[16];
            byte[] customerIdBytes    = new byte[10];
            byte[] macBytes           = new byte[4];
            byte[] otherHexBytes      = new byte[14];
            byte[] footerBytes        = new byte[1];

            headerBytes        = AppUtils.hexConverter(Constants.SECURE_HEADER);
            formatVersionBytes = AppUtils.hexConverter(Constants.SECURE_FORMAT_VERSION);
            macVersionBytes    = AppUtils.hexConverter(Constants.SECURE_MAC_VERSION);
            pinDesKey          = pinKey;
            macDesKey          = macKey;
            footerBytes        = AppUtils.hexConverter(Constants.SECURE_FOOTER);

            Array.Copy(headerBytes, headerBytes.GetLowerBound(0), secureBytes, 0, 1);
            Array.Copy(formatVersionBytes, 0, secureBytes, 1, 1);
            Array.Copy(macVersionBytes, 0, secureBytes, 2, 1);
            Array.Copy(pinDesKey, 0, secureBytes, 3, 16);
            Array.Copy(macDesKey, 0, secureBytes, 19, 16);

            string customerIdLen      = pan == null ? "" : pan.Length.ToString();
            string customerIdLenLen   = customerIdLen.Length.ToString();
            string customerIdBlock    = customerIdLenLen + customerIdLen + pan;
            int    customerIdBlockLen = customerIdBlock.Length;

            int maxLen  = 20;
            int pandiff = maxLen - customerIdBlockLen;

            for (int i = 0; i < pandiff; i++)
            {
                customerIdBlock = customerIdBlock + "F";
            }
            customerIdBytes = AppUtils.hexConverter(customerIdBlock);
            Array.Copy(customerIdBytes, 0, secureBytes, 35, 10);

            string macData = getMacCipherText(msisdn, ttId, amt);
            string mac     = MACUtils.getMacValueUsingHMAC(macData, pinKey);

            mac      = mac.Substring(0, 8);
            macBytes = AppUtils.hexConverter(mac);
            Array.Copy(macBytes, 0, secureBytes, 45, 4);

            string otherHex = "0000000000000000000000000000";

            otherHexBytes = AppUtils.hexConverter(otherHex);
            Array.Copy(otherHexBytes, 0, secureBytes, 49, 14);

            Array.Copy(footerBytes, 0, secureBytes, 63, 1);
            var sb = new StringBuilder("new byte[] { ");

            foreach (var b in secureBytes)
            {
                sb.Append(b + ", ");
            }
            sb.Append("}");
            Console.WriteLine(sb.ToString());
            String encrytedSecure = Encoding.Default.GetString(RSAUtils.rsaEncrypt(publicKeyModulus, publicKeyExponent, secureBytes));

            AppUtils.zeroise(secureBytes);

            return(encrytedSecure);
        }