Exemple #1
0
        static void Main(string[] args)
        {
            string     publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDTT1ryGLfq5lucyHdzPLbjtcVsgurf5x4Y09U/cTiV85duIk0zQeRTXNyGcMAS92+xV/eGp7IjncwL8QE8JqlclLvuOU3zTdlAQ58lu/JcTcsF6eA6JXb8OJAhmDoug1J77M2GLoqAl0Cf34kavj/r9bAQpWqbk8JlJU3YqIePuwIDAQAB";
            RSAForJava rsa       = new RSAForJava();

            userInfo u = new userInfo();

            u.channelUserCode    = "e5d1a2ca4883474791ca91ce20c90014";
            u.userName           = "******";
            u.phone              = "15989287032";
            u.idName             = "银联";
            u.email              = "";
            u.channelCompanyCode = "";

            string input = Newtonsoft.Json.JsonConvert.SerializeObject(u);


            String encry = rsa.EncryptByPublicKey(input, publicKey);
        }
Exemple #2
0
        public static string GetSign(string channelUserCode, string userName, string phone, string idName = "", string email = "", string channelCompanyCode = "")
        {
            string     publicKey = ConfigurationManager.AppSettings["custom:YbPublicKey"];
            RSAForJava rsa       = new RSAForJava();

            userInfo u = new userInfo();

            u.channelUserCode    = channelUserCode;
            u.userName           = userName;
            u.phone              = phone;
            u.idName             = idName;
            u.email              = email;
            u.channelCompanyCode = channelCompanyCode;

            string input = Newtonsoft.Json.JsonConvert.SerializeObject(u);


            String encry = rsa.EncryptByPublicKey(input, publicKey);


            return(encry);
        }