資源簡介
新浪微博通過賬戶和密碼獲取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
評論
共有 條評論