资源简介
新浪微博通过账户和密码获取cookie
代码片段和文件信息
package com.sdhsie.essos.tyrosh.weibo.util;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.RSAPublicKeySpec;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import org.apache.commons.codec.binary.Hex;
/**
* Created by zcx on 2016/7/6.
*/
public class BigIntegerRSA {
public String rsaCrypt(String modeHex String exponentHex String messageg)
throws IllegalBlockSizeException BadPaddingException
NoSuchAlgorithmException InvalidKeySpecException
NoSuchPaddingException InvalidKeyException
UnsupportedEncodingException {
KeyFactory factory = KeyFactory.getInstance(“RSA“);
BigInteger m = new BigInteger(modeHex 16); /* public exponent */
BigInteger e = new BigInteger(exponentHex 16); /* modulus */
RSAPublicKeySpec spec = new RSAPublicKeySpec(m e);
RSAPublicKey pub = (RSAPublicKey) factory.generatePublic(spec);
Cipher enc = Cipher.getInstance(“RSA“);
enc.init(Cipher.ENCRYPT_MODE pub);
byte[] encryptedContentKey = enc.doFinal(messageg.getBytes(“GB2312“));
return new String(Hex.encodeHex(encryptedContentKey));
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1581 2016-07-07 09:07 新浪微博模拟登陆\BigIntegerRSA.java
文件 10159 2016-07-08 14:55 新浪微博模拟登陆\SinaLogonDog.java
文件 3174 2016-07-08 09:29 新浪微博模拟登陆\SinaSSOEncoder.java
目录 0 2016-07-08 14:55 新浪微博模拟登陆
----------- --------- ---------- ----- ----
14914 4
评论
共有 条评论