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

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

?? pseconfigadv.java

?? jxta平臺的開發包
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * Copyright (c) 2001 Sun Microsystems, Inc.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. * * 3. The end-user documentation included with the redistribution, *    if any, must include the following acknowledgment: *       "This product includes software developed by the *       Sun Microsystems, Inc. for Project JXTA." *    Alternately, this acknowledgment may appear in the software itself, *    if and wherever such third-party acknowledgments normally appear. * * 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA" must *    not be used to endorse or promote products derived from this *    software without prior written permission. For written *    permission, please contact Project JXTA at http://www.jxta.org. * * 5. Products derived from this software may not be called "JXTA", *    nor may "JXTA" appear in their name, without prior written *    permission of Sun. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED.  IN NO EVENT SHALL SUN MICROSYSTEMS OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of Project JXTA.  For more * information on Project JXTA, please see * <http://www.jxta.org/>. * * This license is based on the BSD license adopted by the Apache Foundation. * * $Id: PSEConfigAdv.java,v 1.9 2006/05/30 20:53:51 hamada Exp $ */package net.jxta.impl.protocol;import java.io.ByteArrayInputStream;import java.io.InputStream;import java.io.StringReader;import java.net.URI;import java.net.URL;import java.security.PrivateKey;import java.security.AlgorithmParameters;import java.security.cert.X509Certificate;import java.security.cert.CertificateFactory;import java.util.Collections;import java.util.Enumeration;import java.util.Arrays;import java.util.ArrayList;import java.util.List;import java.util.Map;import java.util.Iterator;import javax.crypto.EncryptedPrivateKeyInfo;import java.security.KeyFactory;import java.security.spec.PKCS8EncodedKeySpec;import java.security.spec.KeySpec;import java.io.IOException;import java.lang.reflect.UndeclaredThrowableException;import java.net.MalformedURLException;import java.net.UnknownServiceException;import java.net.URISyntaxException;import org.apache.log4j.Level;import org.apache.log4j.Logger;import net.jxta.document.Advertisement;import net.jxta.document.ExtendableAdvertisement;import net.jxta.document.AdvertisementFactory;import net.jxta.document.Attributable;import net.jxta.document.Attribute;import net.jxta.document.Document;import net.jxta.document.Element;import net.jxta.document.MimeMediaType;import net.jxta.document.StructuredDocument;import net.jxta.document.StructuredDocumentFactory;import net.jxta.document.StructuredDocumentUtils;import net.jxta.document.StructuredTextDocument;import net.jxta.document.TextElement;import net.jxta.document.XMLElement;import net.jxta.document.AdvertisementFactory.Instantiator;import net.jxta.id.ID;import net.jxta.id.IDFactory;import net.jxta.impl.membership.pse.PSEUtils;import net.jxta.peer.PeerID;import net.jxta.peergroup.PeerGroupID;import net.jxta.platform.ModuleClassID;import net.jxta.protocol.ConfigParams;/** *  Contains parameters for configuration of the PSE Membership Service. * *  <p/>The configuration advertisement can include an optional seed certificate *  chain and encrypted private key. If this seed information is present the PSE  *  Membership Service will require an initial authentication to unlock the  *  encrypted prviate key before creating the PSE keystore. The newly created  *  PSE keystore will be "seeded" with the certificate chain and the private key. * *  <p/>This mechanism allows for out-of-band distribution of JXTA identity *  information and avoids the need for remote authentication. * *  <p/>Note: This implementation contemplates multiple root certs in its *  schema, but the API has not yet been extended to include this functionality. */public final class PSEConfigAdv extends ExtendableAdvertisement {    /**    *   Log4J Logger    */    private final static transient Logger LOG = Logger.getLogger(PSEConfigAdv.class.getName());    /**     *  Our DOCTYPE     */    private final static String advType =  "jxta:PSEConfig";    /**     *  Instantiator for PSEConfigAdv     */    public static class Instantiator implements AdvertisementFactory.Instantiator {        /**         * {@inheritDoc}         */        public String getAdvertisementType() {            return advType;        }        /**         * {@inheritDoc}         */        public Advertisement newInstance() {            return new PSEConfigAdv();        }        /**         * {@inheritDoc}         */        public Advertisement newInstance(Element root) {            return new PSEConfigAdv(root);        }    };    private final static String ROOT_CERT_TAG = "RootCert" ;    private final static String CERT_TAG = "Certificate" ;    private final static String ENCRYPTED_PRIVATE_KEY_TAG = "EncryptedPrivateKey";    private final static String KEY_STORE_TYPE_ATTR = "KeyStoreType" ;    private final static String KEY_STORE_PROVIDER_ATTR = "KeyStoreProvider";    private final static String KEY_STORE_LOCATION_TAG = "KeyStoreLocation";    private final static String [] INDEX_FIELDS = { };    private final List<X509Certificate> certs = new ArrayList<X509Certificate>();    private EncryptedPrivateKeyInfo encryptedPrivateKey = null;    private String privAlgorithm = null;    private String keyStoreType = null;    private String keyStoreProvider = null;    private URI keyStoreLocation = null;    /**     *  Returns the identifying type of this Advertisement.     *     *  <p/><b>Note:</b> This is a static method. It cannot be used to determine     *  the runtime type of an advertisment. ie.     *  </p><code><pre>     *      Advertisement adv = module.getSomeAdv();     *      String advType = adv.getAdvertisementType();     *  </pre></code>     *     *  <p/><b>This is wrong and does not work the way you might expect.</b>     *  This call is not polymorphic and calls     *  {@code Advertisement.getAdvertisementType()} no matter what the real      *  type of the advertisment.     *     * @return String the type of advertisement     */    public static String getAdvertisementType() {        return advType ;    }    /**     *  Use the Instantiator through the factory     */    private PSEConfigAdv() {}    /**     *  Use the Instantiator through the factory     *     *  @param root The XMLElement which is the root element of the PSEConfigAdv.     */    private PSEConfigAdv(Element root) {        if(!XMLElement.class.isInstance(root))            throw new IllegalArgumentException(getClass().getName() + " only supports XLMElement");        XMLElement doc = (XMLElement) root;        String doctype = doc.getName();        String typedoctype = "";        Attribute itsType = doc.getAttribute("type");        if(null != itsType)            typedoctype = itsType.getValue();        if(!doctype.equals(getAdvertisementType()) && !getAdvertisementType().equals(typedoctype)) {            throw new IllegalArgumentException("Could not construct : "                                               + getClass().getName() + "from doc containing a " + doc.getName());        }        Enumeration eachAttr = doc.getAttributes();        while (eachAttr.hasMoreElements()) {            Attribute anAttr = (Attribute) eachAttr.nextElement();            if(KEY_STORE_TYPE_ATTR.equals(anAttr.getName())) {                keyStoreType = anAttr.getValue().trim();            } else if(KEY_STORE_PROVIDER_ATTR.equals(anAttr.getName())) {                keyStoreProvider = anAttr.getValue().trim();            } else if ("type".equals(anAttr.getName())) {                ;            } else if ("xmlns:jxta".equals(anAttr.getName())) {                ;            } else {                if (LOG.isEnabledFor(Level.WARN)) {                    LOG.warn("Unhandled Attribute: " + anAttr.getName());                }            }        }        certs.clear();        Enumeration elements = doc.getChildren();        while (elements.hasMoreElements()) {            XMLElement elem = (XMLElement) elements.nextElement();            if(!handleElement(elem)) {                if (LOG.isEnabledFor(Level.DEBUG))                    LOG.debug("Unhandled Element: " + elem.toString());            }        }        // Sanity Check!!!    }    /**     * Make a safe clone of this PSEConfigAdv.     *     * @return Object A copy of this PSEConfigAdv     */    public Object clone() {        PSEConfigAdv result = new PSEConfigAdv();        result.setKeyStoreLocation(getKeyStoreLocation());        result.setKeyStoreType(getKeyStoreType());        result.setKeyStoreProvider(getKeyStoreProvider());        result.setEncryptedPrivateKey(getEncryptedPrivateKey(), getEncryptedPrivateKeyAlgo());        result.setCertificateChain(getCertificateChain());        return result;    }    /**     * {@inheritDoc}     */    public String getAdvType() {        return getAdvertisementType();    }    /**     * {@inheritDoc}     */    public final String getBaseAdvType() {        return getAdvertisementType();    }    /**     *  {@inheritDoc}     */    public ID getID() {        InputStream data = new ByteArrayInputStream(getCert().getBytes());        try {            return IDFactory.newCodatID(PeerGroupID.worldPeerGroupID, new byte [16], data);        } catch (IOException failed) {            throw new UndeclaredThrowableException(failed, "Could not generate id");        }    }    /**     *  Returns the seed certificate. If present, this certificate will be used     *  to initialize the PSE keystore and will be stored using the peer id of     *  the authenticating peer.     *     *  @return The seed certificate or {@code null} if there is no seed     *  certificate defined.     */    public X509Certificate getCertificate() {        if(certs.isEmpty()) {            return null;        } else {            return (X509Certificate) certs.get(0);        }    }    /**     *  Returns the seed certificate chain. If present, this certificate chain      *  will be used to initialize the PSE keystore and will be stored using the      *  peer id of the authenticating peer.     *     *  @return the seed certificate chain for this peer or {@code null} if      *  there is no seed certificate chain defined.     */    public X509Certificate[] getCertificateChain() {        return (X509Certificate[]) certs.toArray(new X509Certificate[certs.size()]);    }    /**     *  Returns the seed ceritficate encoded as a BASE64 String.     *     *  @return the seed certificate encoded as a BASE64 String.     */    public String getCert() {        X509Certificate rootCert = getCertificate();        if(null != rootCert) {            try {                return PSEUtils.base64Encode(getCertificate().getEncoded());            } catch(Throwable failed) {                throw new IllegalStateException("Failed to process seed cert");            }        } else {            return null;        }    }    /**     *  Sets the seed certificate for this peer from a BASE64 String.     *     *  @param newCert The seed certificate for this peer as a BASE64 String.     */    public void setCert(String newCert) {        try {            byte [] cert_der = PSEUtils.base64Decode(new StringReader(newCert));            CertificateFactory cf = CertificateFactory.getInstance("X509");            setCertificate((X509Certificate) cf.generateCertificate(new ByteArrayInputStream(cert_der)));        } catch(Exception failed) {            if (LOG.isEnabledFor(Level.ERROR)) {                LOG.error("Failed to process seed cert", failed);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一卡二卡三卡四卡| 欧美大片在线观看一区| 欧美一区二区精品| 亚洲欧洲精品一区二区精品久久久| 亚洲一二三四久久| 国产成人在线观看| 日韩一区二区三| 亚洲精品视频免费看| 国产一区在线不卡| 欧美一区二区三区免费视频| 亚洲欧洲三级电影| 国产成人精品一区二区三区四区 | 在线日韩一区二区| 国产人伦精品一区二区| 秋霞电影一区二区| 欧美综合久久久| 中文字幕一区二区三区精华液| 精品影视av免费| 日韩欧美一级在线播放| 日韩影视精彩在线| 欧美午夜精品久久久久久孕妇| 国产精品电影一区二区三区| 国产另类ts人妖一区二区| 欧美成人艳星乳罩| 毛片av一区二区| 日韩天堂在线观看| 三级精品在线观看| 欧美乱妇20p| 天堂一区二区在线| 91精品国产欧美一区二区18| 亚洲bdsm女犯bdsm网站| 欧美视频你懂的| 亚洲第一激情av| 欧美日韩在线免费视频| 国产精品理论片在线观看| 美女一区二区三区在线观看| 韩国av一区二区| 国产欧美一区二区三区在线看蜜臀| 亚洲成人动漫在线免费观看| 91在线你懂得| 日本一区二区三区久久久久久久久不 | 国产伦精品一区二区三区在线观看| 色一区在线观看| 最近日韩中文字幕| 国产精品一区二区三区网站| 欧美一区二区三区系列电影| 亚洲在线视频免费观看| 色综合久久中文字幕| 国产精品另类一区| 成人一区在线观看| 国产视频一区二区在线观看| 国产精品亚洲一区二区三区妖精| 精品日本一线二线三线不卡| 奇米综合一区二区三区精品视频| 欧美精品aⅴ在线视频| 一区二区三区在线视频播放| 91丝袜美腿高跟国产极品老师 | 亚洲一区二区三区在线| av午夜一区麻豆| 国产精品第一页第二页第三页| 成人av网站在线观看| 国产精品免费网站在线观看| 成人av免费在线播放| 国产精品私人影院| 99re这里都是精品| 中文字幕精品一区二区三区精品| 福利电影一区二区| 1000精品久久久久久久久| 91视频在线看| 天天综合天天做天天综合| 日韩三级高清在线| 国内久久精品视频| 精品国产乱码久久久久久老虎| 久久成人麻豆午夜电影| 日韩午夜av电影| 97久久超碰国产精品电影| 一区二区三区资源| 欧美久久一区二区| 国产自产视频一区二区三区 | 另类小说视频一区二区| 久久久久久久久免费| 国产成a人亚洲精品| 亚洲人成网站在线| 7777精品伊人久久久大香线蕉的 | 久久这里只有精品6| 成人黄色网址在线观看| 亚洲黄色小说网站| 欧美日韩国产天堂| 国产精品影视网| 亚洲综合在线免费观看| 日韩欧美精品在线视频| 粉嫩欧美一区二区三区高清影视| 一区二区三区在线免费观看| 久久久久久免费| 91美女片黄在线观看91美女| 亚洲大尺度视频在线观看| 久久午夜羞羞影院免费观看| 欧美在线啊v一区| 国产乱一区二区| 亚洲自拍偷拍欧美| 日韩午夜激情视频| 色哟哟国产精品免费观看| 麻豆成人av在线| 亚洲一区二区精品视频| 国产午夜精品久久久久久久| 欧美三级视频在线播放| 成人福利在线看| 久久国产成人午夜av影院| 一区二区三区在线观看视频| 久久综合九色综合欧美98| 欧美三级乱人伦电影| 成人av电影在线播放| 看片网站欧美日韩| 天天影视涩香欲综合网| 亚洲综合视频在线观看| 国产亚洲午夜高清国产拍精品| 91精品在线一区二区| 欧美亚洲一区二区在线观看| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 日韩视频一区二区三区在线播放 | 亚洲欧美色图小说| 久久综合色天天久久综合图片| 精品视频一区 二区 三区| 成人短视频下载| 国产二区国产一区在线观看| 美女免费视频一区二区| 亚洲国产日韩综合久久精品| 亚洲黄色av一区| 亚洲色图欧美激情| 亚洲视频免费在线观看| 欧美经典三级视频一区二区三区| 日韩久久久久久| 欧美电视剧在线看免费| 欧美一区二区三区白人| 色老综合老女人久久久| 国产99久久久国产精品潘金网站| 精品一区二区三区av| 美女性感视频久久| 久久国产生活片100| 免费在线看成人av| 免费国产亚洲视频| 久久狠狠亚洲综合| 国产乱码精品一区二区三区av| 精品亚洲免费视频| 国产精品一区二区x88av| 国产一区二区三区在线观看精品| 国产乱人伦偷精品视频免下载 | 午夜伊人狠狠久久| 午夜欧美电影在线观看| 日本sm残虐另类| 精品影院一区二区久久久| 国产一区二区三区电影在线观看| 国产一区二区在线看| 成人一级片在线观看| 99久久精品国产毛片| 一本大道综合伊人精品热热| 在线亚洲一区二区| 91精品国产综合久久婷婷香蕉| 欧美一级淫片007| 久久久久久99精品| 日韩一区欧美小说| 最近中文字幕一区二区三区| 亚洲一区二区影院| 免费观看久久久4p| 国产美女av一区二区三区| 国产一区二区三区观看| 成人av在线一区二区| 欧美色欧美亚洲另类二区| 欧美无人高清视频在线观看| 91精品国产91久久久久久一区二区 | 国产亚洲午夜高清国产拍精品| 国产精品久久久久精k8| 亚洲福利视频三区| 久久精品99久久久| 91麻豆产精品久久久久久 | 欧美日韩精品一区二区三区蜜桃| 精品国产制服丝袜高跟| 久久久久久99久久久精品网站| 中文天堂在线一区| 日韩美女啊v在线免费观看| 国产在线一区观看| 欧美性受xxxx| 国产精品丝袜久久久久久app| 亚洲制服丝袜一区| 国产成人亚洲综合a∨婷婷图片| 欧美午夜精品理论片a级按摩| 久久久久久久精| 日韩高清不卡一区二区三区| 成人看片黄a免费看在线| 欧美狂野另类xxxxoooo| 综合久久国产九一剧情麻豆| 久久精品国内一区二区三区| 色老汉av一区二区三区| 精品国产凹凸成av人导航| 椎名由奈av一区二区三区| 麻豆成人综合网| 7777女厕盗摄久久久| 一区二区在线观看免费视频播放 | 一区二区三区四区视频精品免费| 久久狠狠亚洲综合|