/// <summary>
        /// 解密算法
        /// </summary>
        /// <param name="encyptionType"></param>
        /// <param name="OriginalData"></param>
        /// <returns></returns>
        public static string Decrypt(EnumEncyptionType encyptionType, string cipherText, string strKey)
        {
            switch (encyptionType)
            {
            case EnumEncyptionType.None:
                return(cipherText);

            case EnumEncyptionType.AES:
                return(AESDecrypt(cipherText, strKey));

            case EnumEncyptionType.DES:
                return(DESDecrypt(cipherText, strKey));

            case EnumEncyptionType.TripleDES:
                return(TripleDESDecrypt(cipherText, strKey));

            default:
                return(cipherText);
            }
        }
        /// <summary>
        /// 加密算法
        /// </summary>
        /// <param name="encyptionType"></param>
        /// <param name="plainText"></param>
        /// <param name="strKey"></param>
        /// <returns></returns>
        public static string Encrypt(EnumEncyptionType encyptionType, string plainText, string strKey)
        {
            switch (encyptionType)
            {
            case EnumEncyptionType.None:
                return(plainText);

            case EnumEncyptionType.AES:
                return(AESEncrypt(plainText, strKey));

            case EnumEncyptionType.DES:
                return(DESEncrypt(plainText, strKey));

            case EnumEncyptionType.TripleDES:
                return(TripleDESEncrypt(plainText, strKey));

            default:
                return(plainText);
            }
        }
Example #3
0
 /// <summary>
 /// 初始化对象
 /// </summary>
 /// <param name="requestId"></param>
 /// <param name="serviceId"></param>
 /// <param name="userId"></param>
 /// <param name="timeOut"></param>
 /// <param name="compressType"></param>
 /// <param name="encyptionType"></param>
 public RequestEntity(string requestId,
                      string serviceId, int userId, int timeOut, EnumCompressType compressType, EnumEncyptionType encyptionType)
 {
     RequestId     = requestId;
     ServiceId     = serviceId;
     UserId        = userId;
     TimeOut       = timeOut;
     CompressType  = (int)compressType;
     EncyptionType = (int)encyptionType;
 }