Ejemplo n.º 1
0
        public IActionResult RsaEncrypt(string hexKey, string val, string sign)
        {
            string publicXml = "<RSAKeyValue><Modulus>{0}</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";

            publicXml = string.Format(publicXml, Base64Helper.Base64String(HexHelper.ToByte(hexKey)));
            var res = SecurityHelper.RsaEncrypt(128, val, publicXml, sign);

            //var res = SecurityUtils.RsaEncryptToByte(val, RsaSecurity.RSAPublicKeyJava2DotNet(HexUtils.ToByte(hexKey)));
            return(new JsonResult(new { en = res }));
        }
Ejemplo n.º 2
0
 public IActionResult HexToString(string key)
 {
     return(new JsonResult(new { key = Encoding.UTF8.GetString(HexHelper.ToByte(key)) }));
 }
Ejemplo n.º 3
0
 public IActionResult HexToBase64(string key)
 {
     return(new JsonResult(new { key = Base64Helper.Base64String(HexHelper.ToByte(key)) }));
 }