HTML5技术

【原创分享支付宝支付】HBuilder打包APP调用支付宝客户端支付 - 南宫萧尘(15)

字号+ 作者:H5之家 来源:H5之家 2017-01-06 11:00 我要评论( )

private static RSAParameters ConvertFromPrivateKey( string pemFileConent) { byte []keyData= Convert .FromBase64String(pemFileConent); if (keyData.Length609) { throw new ArgumentException ( "pemfileco

        private static RSAParameters ConvertFromPrivateKey(string pemFileConent)

        {

            byte[] keyData = Convert.FromBase64String(pemFileConent);

            if (keyData.Length < 609)

            {

                throw new ArgumentException("pem file content is incorrect.");

            }

 

            int index = 11;

            byte[] pemModulus = new byte[128];

            Array.Copy(keyData, index, pemModulus, 0, 128);

 

            index += 128;

            index += 2;//141

            byte[] pemPublicExponent = new byte[3];

            Array.Copy(keyData, index, pemPublicExponent, 0, 3);

 

            index += 3;

            index += 4;//148

            byte[] pemPrivateExponent = new byte[128];

            Array.Copy(keyData, index, pemPrivateExponent, 0, 128);

 

            index += 128;

            index += ((int)keyData[index + 1] == 64 ? 2 : 3);//279

            byte[] pemPrime1 = new byte[64];

            Array.Copy(keyData, index, pemPrime1, 0, 64);

 

            index += 64;

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • 【干货分享】通用工具类 - Orson

    【干货分享】通用工具类 - Orson

    2016-12-23 13:00

  • 如何开发一款堪比APP的微信小程序(腾讯内部团队分享) - 腾讯攻城师lee

    如何开发一款堪比APP的微信小程序(腾讯内部团队分享) - 腾讯攻城师

    2016-12-22 17:01

  • 【原创】React实例入门教程(1)基础API,JSX语法--hello world - 毛绒猫猫

    【原创】React实例入门教程(1)基础API,JSX语法--hello world - 毛绒

    2016-11-08 13:00

  • 《WePayUI组件设计的秘密》——2016年第一届前端体验大会分享 - 白树

    《WePayUI组件设计的秘密》——2016年第一届前端体验大会分享 - 白树

    2016-09-27 16:00

网友点评
P