login into sms gateway

1.login into telecom sms gateway
java
   int len = 42;
        buf = new byte[len];
        TypeConvert.int2byte(len, buf, 0); //00 00 00 2a
        TypeConvert.int2byte(1, buf, 4); //00 00 00 2a
        System.arraycopy(clientId.getBytes(), 0, buf, 12, clientId.length());
        if(shared_Secret != null)
            len = clientId.length() + 17 + shared_Secret.length();
        else
            len = clientId.length() + 17;
        byte tmpbuf[] = new byte[len];
        int tmploc = 0;
        System.arraycopy(clientId.getBytes(), 0, tmpbuf, 0, clientId.length());
        tmploc = clientId.length() + 7;
        if(shared_Secret != null)
        {
            System.arraycopy(shared_Secret.getBytes(), 0, tmpbuf, tmploc, shared_Secret.length());
            tmploc += shared_Secret.length();
        }
        String tmptime = "0008080808";
        System.arraycopy(tmptime.getBytes(), 0, tmpbuf, tmploc, 10);

        SecurityTools.md5(tmpbuf, 0, len, buf, 20);//20-35 md5=16位
        buf[36] = (byte)loginMode; //36
        TypeConvert.int2byte(0x7b4da8, buf, 37);//37 38 39 40
        buf[41] = (byte)version;//41
c++
      seqnoIndex++;
        int msglen = 42;
         bb = new byte[msglen];
         memset(bb,0,42);
        bb_putInt(msglen);//00 00 00 2a
        bb_putInt(1);//00 00 00 01
        bb_putInt(seqnoIndex);//00 00 00 01
        //8位账户
        bb_put(StringtoBytes(new byte[8],8, user),8);
        //16位加密密码
        char buftemp[42]="";
         int tmploc=0;
         strcpy(buftemp,user);tmploc+=strlen(user)+7;
         strcpy(buftemp+tmploc,passwd);tmploc+=strlen(passwd);
         //"0008080808"
         strcpy(buftemp+tmploc,"0008080808");tmploc+=10;
         
        char bufout[42]="";
         MD5Calc((unsigned char *)bufout,(unsigned char *)buftemp,tmploc);
         
        bb_put(StringtoBytes(new byte[16],16, bufout),16);


         bb_put((byte)3);//loginMode //36
         bb_putInt(0x7b4da8);//37 38 39 40
         bb_put((byte)32);//version
2.login into  china mobile's sms gateway
c++
 int msglen = 29;
         bb = new byte[msglen];
         memset(bb,0,29);
        bb_putInt(msglen);
        bb_putInt(0);
        bb_putInt(seqnoIndex++);
        bb_put((byte)0);
        bb_put(StringtoBytes(new byte[8],8, user),8);
        bb_put(StringtoBytes(new byte[8],8, passwd),8);
     
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值