亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? authsslprotocolsocketfactory.java

?? Web-Harvest是一個Java開源Web數據抽取工具。它能夠收集指定的Web頁面并從這些頁面中提取有用的數據。Web-Harvest主要是運用了像XSLT,XQuery,正則表達式等這些技術來實
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/contrib/org/apache/commons/httpclient/contrib/ssl/AuthSSLProtocolSocketFactory.java,v 1.2 2004/06/10 18:25:24 olegk Exp $
 * $Revision$
 * $Date$
 *
 * ====================================================================
 *
 *  Copyright 2002-2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 */

package org.apache.commons.httpclient.contrib.ssl;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Enumeration;

import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.commons.httpclient.params.HttpConnectionParams;
import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory;

import javax.net.SocketFactory;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;

/**
 * <p>
 * AuthSSLProtocolSocketFactory can be used to validate the identity of the HTTPS 
 * server against a list of trusted certificates and to authenticate to the HTTPS 
 * server using a private key. 
 * </p>
 * 
 * <p>
 * AuthSSLProtocolSocketFactory will enable server authentication when supplied with
 * a {@link KeyStore truststore} file containg one or several trusted certificates. 
 * The client secure socket will reject the connection during the SSL session handshake 
 * if the target HTTPS server attempts to authenticate itself with a non-trusted 
 * certificate.
 * </p>
 * 
 * <p>
 * Use JDK keytool utility to import a trusted certificate and generate a truststore file:    
 *    <pre>
 *     keytool -import -alias "my server cert" -file server.crt -keystore my.truststore
 *    </pre>
 * </p>
 * 
 * <p>
 * AuthSSLProtocolSocketFactory will enable client authentication when supplied with
 * a {@link KeyStore keystore} file containg a private key/public certificate pair. 
 * The client secure socket will use the private key to authenticate itself to the target 
 * HTTPS server during the SSL session handshake if requested to do so by the server. 
 * The target HTTPS server will in its turn verify the certificate presented by the client
 * in order to establish client's authenticity
 * </p>
 * 
 * <p>
 * Use the following sequence of actions to generate a keystore file
 * </p>
 *   <ul>
 *     <li>
 *      <p>
 *      Use JDK keytool utility to generate a new key
 *      <pre>keytool -genkey -v -alias "my client key" -validity 365 -keystore my.keystore</pre>
 *      For simplicity use the same password for the key as that of the keystore
 *      </p>
 *     </li>
 *     <li>
 *      <p>
 *      Issue a certificate signing request (CSR)
 *      <pre>keytool -certreq -alias "my client key" -file mycertreq.csr -keystore my.keystore</pre>
 *     </p>
 *     </li>
 *     <li>
 *      <p>
 *      Send the certificate request to the trusted Certificate Authority for signature. 
 *      One may choose to act as her own CA and sign the certificate request using a PKI 
 *      tool, such as OpenSSL.
 *      </p>
 *     </li>
 *     <li>
 *      <p>
 *       Import the trusted CA root certificate
 *       <pre>keytool -import -alias "my trusted ca" -file caroot.crt -keystore my.keystore</pre> 
 *      </p>
 *     </li>
 *     <li>
 *      <p>
 *       Import the PKCS#7 file containg the complete certificate chain
 *       <pre>keytool -import -alias "my client key" -file mycert.p7 -keystore my.keystore</pre> 
 *      </p>
 *     </li>
 *     <li>
 *      <p>
 *       Verify the content the resultant keystore file
 *       <pre>keytool -list -v -keystore my.keystore</pre> 
 *      </p>
 *     </li>
 *   </ul>
 * <p>
 * Example of using custom protocol socket factory for a specific host:
 *     <pre>
 *     Protocol authhttps = new Protocol("https",  
 *          new AuthSSLProtocolSocketFactory(
 *              new URL("file:my.keystore"), "mypassword",
 *              new URL("file:my.truststore"), "mypassword"), 443); 
 *
 *     HttpClient client = new HttpClient();
 *     client.getHostConfiguration().setHost("localhost", 443, authhttps);
 *     // use relative url only
 *     GetMethod httpget = new GetMethod("/");
 *     client.executeMethod(httpget);
 *     </pre>
 * </p>
 * <p>
 * Example of using custom protocol socket factory per default instead of the standard one:
 *     <pre>
 *     Protocol authhttps = new Protocol("https",  
 *          new AuthSSLProtocolSocketFactory(
 *              new URL("file:my.keystore"), "mypassword",
 *              new URL("file:my.truststore"), "mypassword"), 443); 
 *     Protocol.registerProtocol("https", authhttps);
 *
 *     HttpClient client = new HttpClient();
 *     GetMethod httpget = new GetMethod("https://localhost/");
 *     client.executeMethod(httpget);
 *     </pre>
 * </p>
 * @author <a href="mailto:oleg -at- ural.ru">Oleg Kalnichevski</a>
 * 
 * <p>
 * DISCLAIMER: HttpClient developers DO NOT actively support this component.
 * The component is provided as a reference material, which may be inappropriate
 * for use without additional customization.
 * </p>
 */

public class AuthSSLProtocolSocketFactory implements SecureProtocolSocketFactory {

    /** Log object for this class. */
    private static final Log LOG = LogFactory.getLog(AuthSSLProtocolSocketFactory.class);

    private URL keystoreUrl = null;
    private String keystorePassword = null;
    private URL truststoreUrl = null;
    private String truststorePassword = null;
    private SSLContext sslcontext = null;

    /**
     * Constructor for AuthSSLProtocolSocketFactory. Either a keystore or truststore file
     * must be given. Otherwise SSL context initialization error will result.
     * 
     * @param keystoreUrl URL of the keystore file. May be <tt>null</tt> if HTTPS client
     *        authentication is not to be used.
     * @param keystorePassword Password to unlock the keystore. IMPORTANT: this implementation
     *        assumes that the same password is used to protect the key and the keystore itself.
     * @param truststoreUrl URL of the truststore file. May be <tt>null</tt> if HTTPS server
     *        authentication is not to be used.
     * @param truststorePassword Password to unlock the truststore.
     */
    public AuthSSLProtocolSocketFactory(
        final URL keystoreUrl, final String keystorePassword, 
        final URL truststoreUrl, final String truststorePassword)
    {
        super();
        this.keystoreUrl = keystoreUrl;
        this.keystorePassword = keystorePassword;
        this.truststoreUrl = truststoreUrl;
        this.truststorePassword = truststorePassword;
    }

    private static KeyStore createKeyStore(final URL url, final String password) 
        throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美视频一区二区在线观看| 亚洲男人天堂一区| 欧美日本在线看| 欧美在线看片a免费观看| caoporen国产精品视频| 懂色av一区二区夜夜嗨| 成人一区二区三区视频在线观看| 精品无码三级在线观看视频| 精品一区二区三区久久久| 麻豆成人免费电影| 久久不见久久见免费视频7| 久久国产视频网| 国产高清不卡一区二区| 成人午夜电影久久影院| 99在线热播精品免费| 91在线码无精品| 欧美专区日韩专区| 欧美理论在线播放| 日韩精品综合一本久道在线视频| 欧美一区二区成人| 日韩精品中文字幕在线不卡尤物| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 一本大道综合伊人精品热热 | 91网站最新地址| 欧洲一区二区三区免费视频| 欧美性受极品xxxx喷水| 91精品国产91久久综合桃花| 久久婷婷成人综合色| 中文字幕亚洲在| 日韩国产欧美三级| 国产精品一区二区无线| 色诱视频网站一区| 91精品国产一区二区三区| 久久影院午夜片一区| 亚洲丝袜制服诱惑| 麻豆91在线播放免费| 成人a级免费电影| 91精品国产色综合久久不卡蜜臀| 国产三级精品视频| 午夜精品久久久久久久久久 | 91国偷自产一区二区开放时间 | 欧美sm美女调教| 亚洲欧美日韩精品久久久久| 日本aⅴ亚洲精品中文乱码| 国产传媒欧美日韩成人| 欧美日韩久久不卡| 国产欧美一区在线| 亚洲一区视频在线| 成人午夜视频网站| 日韩一区二区在线看| 日韩午夜激情免费电影| 亚洲乱码中文字幕| 丰满放荡岳乱妇91ww| 91麻豆精品国产自产在线| 中文字幕亚洲欧美在线不卡| 久久精品国产99国产| 欧美日韩另类一区| 综合久久久久综合| 粉嫩13p一区二区三区| 日韩欧美中文字幕制服| 午夜精品久久久久久不卡8050| 成人网男人的天堂| xvideos.蜜桃一区二区| 欧美a一区二区| 欧美丰满高潮xxxx喷水动漫| 亚洲日本一区二区三区| www.久久精品| 中文字幕第一区综合| 国产馆精品极品| 欧美变态口味重另类| 蜜桃av一区二区三区电影| 欧美猛男gaygay网站| 亚洲妇熟xx妇色黄| 在线观看国产一区二区| 一区二区激情小说| 在线观看欧美黄色| 亚洲午夜久久久久久久久电影院 | 国内精品伊人久久久久av一坑 | 亚洲一区二区精品久久av| 91婷婷韩国欧美一区二区| 国产精品三级av| 99精品一区二区| 日韩理论片在线| 在线观看日韩毛片| 首页综合国产亚洲丝袜| 91精品黄色片免费大全| 久久超碰97人人做人人爱| 久久女同互慰一区二区三区| 国产精品99久久久久久久vr | 欧美一卡二卡在线观看| 青青草原综合久久大伊人精品| 欧美日韩一区二区三区在线| 婷婷丁香久久五月婷婷| 日韩欧美在线网站| 国产精华液一区二区三区| 中文字幕精品一区二区三区精品| 91网页版在线| 蜜臀a∨国产成人精品| 久久久精品免费免费| 99re这里只有精品6| 亚洲国产精品一区二区久久恐怖片 | 国产拍揄自揄精品视频麻豆| 成人免费观看视频| 一区二区三区四区不卡在线| 91精品欧美一区二区三区综合在| 日本女优在线视频一区二区 | 亚洲国产精品成人综合| 色香蕉成人二区免费| 天天色天天操综合| 精品国产99国产精品| 99精品欧美一区| 蜜芽一区二区三区| 国产精品青草久久| 69堂亚洲精品首页| 国产91在线观看丝袜| 亚洲第一av色| 国产欧美日韩不卡| 欧美精品v日韩精品v韩国精品v| 久久国产夜色精品鲁鲁99| 亚洲三级视频在线观看| 欧美精品一区二区久久婷婷| 91热门视频在线观看| 国精产品一区一区三区mba桃花 | 色呦呦网站一区| 激情深爱一区二区| 亚洲国产视频一区二区| 久久精品男人的天堂| 在线综合视频播放| 91美女在线看| 国产成人精品综合在线观看| 免费成人在线观看| 亚洲综合精品久久| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 亚洲精品高清视频在线观看| www成人在线观看| 欧美一区永久视频免费观看| 91看片淫黄大片一级在线观看| 激情综合色丁香一区二区| 亚洲一区二区中文在线| 亚洲欧美在线视频观看| 国产三级精品三级| 26uuu精品一区二区三区四区在线| 欧美人狂配大交3d怪物一区| 色狠狠综合天天综合综合| www.欧美.com| av一区二区三区| 成人综合婷婷国产精品久久蜜臀| 精品一区二区三区在线播放视频 | 精品不卡在线视频| 日韩欧美国产午夜精品| 91精品一区二区三区久久久久久 | 国产精品天美传媒沈樵| 久久婷婷久久一区二区三区| 精品国产一区二区三区忘忧草| 欧美精品v日韩精品v韩国精品v| 欧美日韩亚洲另类| 色系网站成人免费| 在线观看欧美黄色| 欧美性猛交xxxx乱大交退制版| 色菇凉天天综合网| 欧美写真视频网站| 欧美欧美午夜aⅴ在线观看| 7777精品伊人久久久大香线蕉的 | 国产曰批免费观看久久久| 久久99久久精品| 国产一级精品在线| 粉嫩一区二区三区性色av| 国产a视频精品免费观看| 成人黄色在线视频| 欧美中文字幕一区二区三区| 欧美日韩第一区日日骚| 欧美一区二区三区男人的天堂| 日韩欧美国产成人一区二区| 久久久无码精品亚洲日韩按摩| 国产日产亚洲精品系列| 亚洲人成电影网站色mp4| 亚洲成人av电影在线| 看片的网站亚洲| bt7086福利一区国产| 欧美日韩国产首页在线观看| 欧美一级一级性生活免费录像| 久久久国产一区二区三区四区小说 | 精品一区免费av| 久久精品72免费观看| 成人毛片老司机大片| 波波电影院一区二区三区| 欧美亚洲动漫另类| 欧美精品一区二区蜜臀亚洲| 亚洲同性gay激情无套| 舔着乳尖日韩一区| 国产成人av在线影院| 欧美亚洲高清一区| 久久久久久久久久久久电影 | 欧美亚洲国产一区二区三区va | 亚洲欧美另类小说| 肉肉av福利一精品导航| 成人精品亚洲人成在线| 欧美伦理视频网站| 99在线热播精品免费| 日韩一区二区三区电影在线观看|