Exemple #1
0
        /// <summary>
        /// 采用RAS和DES一起进行解密操作,私钥解析出来Key/IV,然后用Key/Iv解密业务数据
        /// </summary>
        /// <param name="xmlPrivateKey"></param>
        /// <param name="encryptResult"></param>
        /// <returns></returns>
        public static RSADESDecryptResult DecryptByRSADES(string xmlPrivateKey, RSADESEncryptResult encryptResult)
        {
            string[] encryptedKeyIv = EncryptUtility.DecryptByRSA(encryptResult.EncryptedDesKeyIV, Encoding.Unicode, xmlPrivateKey).Split('.');
            var      result         = new RSADESDecryptResult();

            result.DecryptedDesKey = encryptedKeyIv[0];
            result.DecryptedDesIv  = encryptedKeyIv[1];
            var keyIv = new DesKeyIVEntity()
            {
                KeyString = result.DecryptedDesKey, IVString = result.DecryptedDesIv
            };

            result.DecryptedSourceData = EncryptUtility.DecryptByDES(encryptResult.EncryptedSourceData, Encoding.Unicode, keyIv.KeyBytes, keyIv.IVBytes);
            return(result);
        }