我还没有解决这个问题。这是一个正在进行的工作。我积极学习,并且随时随地发布我的进度。对不起,这件事情是如此令人讨厌,其主要是错误记录。
编辑:2014年4月4日:我正在修补铬片,我注意到了一个很酷的选择"保存日志"而在"检查元素"。这很酷,因为它允许我看到服务器的隐藏帖子。这篇文章对我没什么帮助,但是我必须在幕后发现其他事情。我看到的帖子看起来像这样:
HttpPost post = new HttpPost(
"https://ssb.sunydutchess.edu/pls/prod/bwskfshd.P_CrseSchdDetl");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("term_in:","201401"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse postResponse=client.execute(post,context);
我在登录我的学校后发帖。我仍然得到一个错误,但它是一个不同的错误,这通常是好的。这是我的错误:
javax.net.ssl.SSLException: Server selected improper ciphersuite SSL_RSA_WITH_DES_CBC_SHA
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverHello(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:533)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:401)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at login.schedule(login.java:188)
at login.<init>(login.java:49)
at launch.main(launch.java:4)
我试图只是登录我的学校网站,然后导航到需要用户登录的页面(查看计划)。我有一种感觉,在我登录后,我没有保持登录状态。
下面是一些突出我问题的代码:
HttpClient client=new DefaultHttpClient();
CookieStore cookies=new BasicCookieStore();//update here
HttpContext context=new BasicHttpContext();//update here
context.setAttribute(ClientContext.COOKIE_STORE, cookies);//update here
HttpPost post =new HttpPost("https://schoolwebsite.edu/login");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("pass", "password"));
nameValuePairs.add(new BasicNameValuePair("user",
"username"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse postResponse=client.execute(post,context);//update here
//the failed login page displays Error:failed login
//and im using Jsoup to scrape data off the site
Document doc= Jsoup.parse(postResponse.getEntity().getContent()
,null,"https://is-lump4-web.sunydutchess.edu/cp/home/next");
if(doc.toString().contains("Error: Failed Login")
||
doc.toString().contains("Error: System Error"))
{
System.out.println(doc.toString());
}
else{
System.out.println("i logged in");
}
这很好用,我登录。我有信心登录,因为我缓冲了欢迎页面,
没问题。
现在,当我尝试转到需要使用此代码登录的页面时:
/**these are not the correct paths,
im just highlighting what im trying to do**/
HttpGet request=new HttpGet("https://schoolwebsite.edu/mySchedule");
try {
HttpResponse response = client.execute(request,context);//CRASHES HERE
}catch (ClientProtocolException e) {
} catch (IOException ie) {}
我收到错误:
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
另外,我发现我的HttpClient没有接受一些cookie,我不明白为什么
Mar 19, 2014 4:57:13 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: WebCTTicket][value: ][domain: webct.cookie.domain][path: /][expiry: Wed Dec 31 19:00:10 EST 1969]". Illegal domain attribute "webct.cookie.domain". Domain of origin: "is-lump4-web.sunydutchess.edu"
Mar 19, 2014 4:57:13 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: WebCTTicket][value: ][domain: webct.cookie.domain][path: /][expiry: Wed Dec 31 19:00:10 EST 1969]". Illegal domain attribute "webct.cookie.domain". Domain of origin: "is-lump4-web.sunydutchess.edu"
Mar 19, 2014 4:57:13 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: WebCTTicket][value: ][domain: webct.cookie.domain][path: /][expiry: Wed Dec 31 19:00:10 EST 1969]". Illegal domain attribute "webct.cookie.domain". Domain of origin: "is-lump4-web.sunydutchess.edu"
Mar 19, 2014 4:57:14 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: WebCTTicket][value: ][domain: webct.cookie.domain][path: /][expiry: Wed Dec 31 19:00:10 EST 1969]". Illegal domain attribute "webct.cookie.domain". Domain of origin: "is-lump4-web.sunydutchess.edu"
编辑后,一些cookie不再被拒绝(我删除了那些没有给我错误的cookie)
我猜这可能是问题的根源?我已经阅读并看到了一些代码
SSL,但我觉得这可能是错误的方法。毕竟,我没有看到欢迎页面。正确方向上的一点是惊人的。
编辑:我尝试了一些cookiestore和本地上下文的东西,但我仍然得到相同的错误。编辑包含在代码中。
EDIT2:我正在使用httpClient V4.3 ......我试图连接学校网站。证书来自委托认证机构L1C ..其名称为ssb.sunydutchess.edu
EDIT3:好的,所以在我瞎逛之后我偶然发现了调试技术
System.setProperty("javax.net.debug", "ssl");
使用后我发现了一些有趣的东西:
i logged in
main, called close()
main, called closeInternal(true)
main, SEND TLSv1 ALERT: warning, description = close_notify
main, WRITE: TLSv1 Alert, length = 32
main, called closeSocket(selfInitiated)
main, called close()
main, called closeInternal(true)
Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256
Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
Ignoring unavailable cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
Ignoring unavailable cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_128_CBC_SHA256
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
main, setSoTimeout(0) called
%% No cached client session
*** ClientHello, TLSv1
RandomCookie: GMT: 1395348688 bytes = { 70, 23, 87, 62, 213, 199, 80, 63, 213, 254, 145, 204, 158, 60, 108, 63, 35, 111, 106, 222, 17, 230, 72, 198, 146, 202, 19, 87 }
Session ID: {}
Cipher Suites: [TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_RC4_128_SHA, TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS_ECDH_RSA_WITH_RC4_128_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_RC4_128_MD5, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
Compression Methods: { 0 }
Extension elliptic_curves, curve names: {secp256r1, sect163k1, sect163r2, secp192r1, secp224r1, sect233k1, sect233r1, sect283k1, sect283r1, secp384r1, sect409k1, sect409r1, secp521r1, sect571k1, sect571r1, secp160k1, secp160r1, secp160r2, sect163r1, secp192k1, sect193r1, sect193r2, secp224k1, sect239k1, secp256k1}
Extension ec_point_formats, formats: [uncompressed]
***
main, WRITE: TLSv1 Handshake, length = 149
main, READ: TLSv1 Handshake, length = 74
*** ServerHello, TLSv1
RandomCookie: GMT: -1811840364 bytes = { 227, 236, 190, 135, 95, 39, 232, 229, 21, 230, 238, 131, 216, 249, 98, 40, 196, 101, 185, 198, 154, 50, 113, 92, 184, 247, 227, 165 }
Session ID: {105, 218, 73, 202, 12, 94, 203, 197, 94, 188, 149, 223, 217, 67, 129, 194, 3, 236, 211, 3, 0, 96, 47, 48, 188, 75, 80, 47, 106, 226, 232, 178}
Cipher Suite: SSL_RSA_WITH_DES_CBC_SHA
Compression Method: 0
***
Warning: No renegotiation indication extension in ServerHello
main, SEND TLSv1 ALERT: fatal, description = illegal_parameter
main, WRITE: TLSv1 Alert, length = 2
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLException: Server selected improper ciphersuite SSL_RSA_WITH_DES_CBC_SHA
main, IOException in getSession(): javax.net.ssl.SSLException: Server selected improper ciphersuite SSL_RSA_WITH_DES_CBC_SHA
main, called close()
main, called closeInternal(true)
main, called close()
main, called closeInternal(true)
任何人都可以给我一些关于这一切意味着什么的余地?它为什么关闭?什么是不可用/不支持的密码套件?