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

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

?? x509v3certificategenerator.java

?? 內容:基于jdk1.4的加密算法的具體實現
?? JAVA
字號:
package org.bouncycastle.x509;import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.math.BigInteger;import java.security.InvalidKeyException;import java.security.NoSuchAlgorithmException;import java.security.NoSuchProviderException;import java.security.PrivateKey;import java.security.PublicKey;import java.security.SecureRandom;import java.security.Signature;import java.security.SignatureException;import java.security.cert.CertificateParsingException;import java.security.cert.X509Certificate;import java.util.Date;import java.util.Hashtable;import java.util.Iterator;import java.util.Vector;import javax.security.auth.x500.X500Principal;import org.bouncycastle.asn1.*;import org.bouncycastle.asn1.x509.AlgorithmIdentifier;import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;import org.bouncycastle.asn1.x509.TBSCertificateStructure;import org.bouncycastle.asn1.x509.Time;import org.bouncycastle.asn1.x509.V3TBSCertificateGenerator;import org.bouncycastle.asn1.x509.X509CertificateStructure;import org.bouncycastle.asn1.x509.X509Extension;import org.bouncycastle.asn1.x509.X509Extensions;import org.bouncycastle.asn1.x509.X509Name;import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;import org.bouncycastle.jce.X509Principal;import org.bouncycastle.jce.provider.X509CertificateObject;import org.bouncycastle.x509.extension.X509ExtensionUtil;/** * class to produce an X.509 Version 3 certificate. */public class X509V3CertificateGenerator{    private V3TBSCertificateGenerator   tbsGen;    private DERObjectIdentifier         sigOID;    private AlgorithmIdentifier         sigAlgId;    private String                      signatureAlgorithm;    private Hashtable                   extensions = null;    private Vector                      extOrdering = null;    public X509V3CertificateGenerator()    {        tbsGen = new V3TBSCertificateGenerator();    }    /**     * reset the generator     */    public void reset()    {        tbsGen = new V3TBSCertificateGenerator();        extensions = null;        extOrdering = null;    }    /**     * set the serial number for the certificate.     */    public void setSerialNumber(        BigInteger      serialNumber)    {        if (serialNumber.compareTo(BigInteger.ZERO) <= 0)        {            throw new IllegalArgumentException("serial number must be a positive integer");        }                tbsGen.setSerialNumber(new DERInteger(serialNumber));    }    /**     * Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the     * certificate.     */    public void setIssuerDN(        X500Principal   issuer)    {        try        {            tbsGen.setIssuer(new X509Principal(issuer.getEncoded()));        }        catch (IOException e)        {            throw new IllegalArgumentException("can't process principal: " + e);        }    }        /**     * Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the     * certificate.     */    public void setIssuerDN(        X509Name   issuer)    {        tbsGen.setIssuer(issuer);    }    public void setNotBefore(        Date    date)    {        tbsGen.setStartDate(new Time(date));    }    public void setNotAfter(        Date    date)    {        tbsGen.setEndDate(new Time(date));    }    /**     * Set the subject distinguished name. The subject describes the entity associated with the public key.     */    public void setSubjectDN(        X500Principal   subject)    {        try        {            tbsGen.setSubject(new X509Principal(subject.getEncoded()));        }        catch (IOException e)        {            throw new IllegalArgumentException("can't process principal: " + e);        }    }        /**     * Set the subject distinguished name. The subject describes the entity associated with the public key.     */    public void setSubjectDN(        X509Name   subject)    {        tbsGen.setSubject(subject);    }    public void setPublicKey(        PublicKey       key)    {        try        {            tbsGen.setSubjectPublicKeyInfo(new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(                                new ByteArrayInputStream(key.getEncoded())).readObject()));        }        catch (Exception e)        {            throw new IllegalArgumentException("unable to process key - " + e.toString());        }    }    /**     * Set the signature algorithm. This can be either a name or an OID, names     * are treated as case insensitive.     *      * @param signatureAlgorithm string representation of the algorithm name.     */    public void setSignatureAlgorithm(        String  signatureAlgorithm)    {        this.signatureAlgorithm = signatureAlgorithm;        try        {            sigOID = X509Util.getAlgorithmOID(signatureAlgorithm);        }        catch (Exception e)        {            throw new IllegalArgumentException("Unknown signature type requested: " + signatureAlgorithm);        }        sigAlgId = X509Util.getSigAlgID(sigOID);        tbsGen.setSignature(sigAlgId);    }    /**     * add a given extension field for the standard extensions tag (tag 3)     */    public void addExtension(        String          oid,        boolean         critical,        DEREncodable    value)    {        this.addExtension(new DERObjectIdentifier(oid), critical, value);    }    /**     * add a given extension field for the standard extensions tag (tag 3)     */    public void addExtension(        DERObjectIdentifier oid,        boolean             critical,        DEREncodable        value)    {        if (extensions == null)        {            extensions = new Hashtable();            extOrdering = new Vector();        }        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();        DEROutputStream         dOut = new DEROutputStream(bOut);        try        {            dOut.writeObject(value);        }        catch (IOException e)        {            throw new IllegalArgumentException("error encoding value: " + e);        }        this.addExtension(oid, critical, bOut.toByteArray());    }    /**     * add a given extension field for the standard extensions tag (tag 3)     * The value parameter becomes the contents of the octet string associated     * with the extension.     */    public void addExtension(        String          oid,        boolean         critical,        byte[]          value)    {        this.addExtension(new DERObjectIdentifier(oid), critical, value);    }    /**     * add a given extension field for the standard extensions tag (tag 3)     */    public void addExtension(        DERObjectIdentifier oid,        boolean             critical,        byte[]              value)    {        if (extensions == null)        {            extensions = new Hashtable();            extOrdering = new Vector();        }        extensions.put(oid, new X509Extension(critical, new DEROctetString(value)));        extOrdering.addElement(oid);    }    /**     * add a given extension field for the standard extensions tag (tag 3)     * copying the extension value from another certificate.     * @throws CertificateParsingException if the extension cannot be extracted.     */    public void copyAndAddExtension(        String          oid,        boolean         critical,        X509Certificate cert)         throws CertificateParsingException    {        byte[] extValue = cert.getExtensionValue(oid);                if (extValue == null)        {            throw new CertificateParsingException("extension " + oid + " not present");        }                try        {            ASN1Encodable value = X509ExtensionUtil.fromExtensionValue(extValue);                this.addExtension(oid, critical, value);        }        catch (IOException e)        {            throw new CertificateParsingException(e.toString());        }    }    /**     * add a given extension field for the standard extensions tag (tag 3)     * copying the extension value from another certificate.     * @throws CertificateParsingException if the extension cannot be extracted.     */    public void copyAndAddExtension(        DERObjectIdentifier oid,        boolean             critical,        X509Certificate     cert)        throws CertificateParsingException    {        this.copyAndAddExtension(oid.getId(), critical, cert);    }    /**     * generate an X509 certificate, based on the current issuer and subject     * using the default provider "BC".     */    public X509Certificate generateX509Certificate(        PrivateKey      key)        throws SecurityException, SignatureException, InvalidKeyException    {        try        {            return generateX509Certificate(key, "BC", null);        }        catch (NoSuchProviderException e)        {            throw new SecurityException("BC provider not installed!");        }    }    /**     * generate an X509 certificate, based on the current issuer and subject     * using the default provider "BC", and the passed in source of randomness     * (if required).     */    public X509Certificate generateX509Certificate(        PrivateKey      key,        SecureRandom    random)        throws SecurityException, SignatureException, InvalidKeyException    {        try        {            return generateX509Certificate(key, "BC", random);        }        catch (NoSuchProviderException e)        {            throw new SecurityException("BC provider not installed!");        }    }    /**     * generate an X509 certificate, based on the current issuer and subject,     * using the passed in provider for the signing.     */    public X509Certificate generateX509Certificate(        PrivateKey      key,        String          provider)        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException    {        return generateX509Certificate(key, provider, null);    }    /**     * generate an X509 certificate, based on the current issuer and subject,     * using the passed in provider for the signing and the supplied source     * of randomness, if required.     */    public X509Certificate generateX509Certificate(        PrivateKey      key,        String          provider,        SecureRandom    random)        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException    {        Signature sig = null;        if (sigOID == null)        {            throw new IllegalStateException("no signature algorithm specified");        }        try        {            sig = Signature.getInstance(sigOID.getId(), provider);        }        catch (NoSuchAlgorithmException ex)        {            try            {                sig = Signature.getInstance(signatureAlgorithm, provider);            }            catch (NoSuchAlgorithmException e)            {                throw new SecurityException("exception creating signature: " + e.toString());            }        }        if (random != null)        {            sig.initSign(key, random);        }        else        {            sig.initSign(key);        }        if (extensions != null)        {            tbsGen.setExtensions(new X509Extensions(extOrdering, extensions));        }        TBSCertificateStructure tbsCert = tbsGen.generateTBSCertificate();        try        {            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();            DEROutputStream         dOut = new DEROutputStream(bOut);            dOut.writeObject(tbsCert);            sig.update(bOut.toByteArray());        }        catch (Exception e)        {            throw new SecurityException("exception encoding TBS cert - " + e);        }        ASN1EncodableVector  v = new ASN1EncodableVector();        v.add(tbsCert);        v.add(sigAlgId);        v.add(new DERBitString(sig.sign()));        return new X509CertificateObject(new X509CertificateStructure(new DERSequence(v)));    }        /**     * Return an iterator of the signature names supported by the generator.     *      * @return an iterator containing recognised names.     */    public Iterator getSignatureAlgNames()    {        return X509Util.getAlgNames();    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区二区三区四区| 国产婷婷色一区二区三区在线| 欧美精品一区二区久久久| 亚洲人成影院在线观看| 狠狠狠色丁香婷婷综合久久五月| 91社区在线播放| 久久色.com| 麻豆精品一区二区av白丝在线| 99久久国产免费看| 久久综合网色—综合色88| 亚洲动漫第一页| 色综合久久88色综合天天 | 中文字幕一区免费在线观看| 人禽交欧美网站| 欧美日韩aaaaaa| 亚洲免费在线观看视频| 国产99久久久国产精品潘金| 欧美成人一区二区三区片免费 | 亚洲精品精品亚洲| 成人精品一区二区三区中文字幕 | 在线观看91精品国产麻豆| 亚洲欧美在线观看| 成人av午夜电影| 国产欧美精品一区二区色综合 | 欧美日韩一区二区在线观看 | 国产综合久久久久久鬼色| 7777精品伊人久久久大香线蕉经典版下载| 亚洲激情在线激情| 在线看国产一区| 亚洲黄色av一区| 日本高清不卡在线观看| 亚洲人精品午夜| 欧美综合亚洲图片综合区| 玉足女爽爽91| 欧美日韩在线三级| 亚洲伊人色欲综合网| 欧美偷拍一区二区| 日韩精品国产欧美| 91精品国产手机| 精品亚洲成a人在线观看| 日韩欧美在线观看一区二区三区| 紧缚捆绑精品一区二区| 国产亚洲成av人在线观看导航| 国产aⅴ综合色| 亚洲欧美另类图片小说| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 一区二区国产盗摄色噜噜| 欧美亚洲国产一区二区三区va | 国产一区二区美女诱惑| 国产亚洲一二三区| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 丰满放荡岳乱妇91ww| 国产精品超碰97尤物18| 欧美三级三级三级爽爽爽| 天天av天天翘天天综合网色鬼国产| 在线成人午夜影院| 国产伦精品一区二区三区免费迷| 日本一二三四高清不卡| 色综合久久88色综合天天| 日韩电影在线看| 国产欧美精品在线观看| 欧美日韩亚洲综合一区二区三区| 麻豆成人91精品二区三区| 日本一区二区动态图| 欧美日韩激情一区二区| 国产美女av一区二区三区| 亚洲日本一区二区三区| 欧美剧情片在线观看| 国产精品主播直播| 亚洲午夜成aⅴ人片| 欧美精品一区二区三区高清aⅴ | 亚洲一区视频在线| 精品剧情在线观看| 91豆麻精品91久久久久久| 免费观看一级欧美片| 亚洲视频一区二区在线观看| 日韩一区二区三区视频| 91在线视频网址| 国产乱子伦视频一区二区三区| 亚洲一区在线观看网站| 国产日本一区二区| 日韩欧美123| 欧美日韩激情一区| 99精品视频在线免费观看| 激情五月婷婷综合网| 日韩国产精品91| 亚洲精品日韩综合观看成人91| 久久色成人在线| 欧美不卡一区二区三区| 欧美性猛交xxxx黑人交| av电影天堂一区二区在线观看| 激情五月婷婷综合| 青青草原综合久久大伊人精品 | 亚洲欧美日韩在线播放| 久久蜜桃av一区二区天堂| 4438亚洲最大| 欧美日韩电影在线| 91免费看`日韩一区二区| 粉嫩av一区二区三区粉嫩| 韩国精品在线观看| 久久99精品久久久久久久久久久久 | 综合电影一区二区三区| 国产精品久久久久一区二区三区 | 亚洲女同一区二区| 中文字幕在线不卡一区二区三区| 精品久久久久一区二区国产| 在线播放国产精品二区一二区四区| 色婷婷国产精品| 一本到不卡精品视频在线观看| 99这里只有久久精品视频| 懂色av噜噜一区二区三区av| 国产乱码精品一区二区三区五月婷| 蜜臀精品一区二区三区在线观看| 天堂va蜜桃一区二区三区漫画版| 亚洲777理论| 免费在线成人网| 久久精品99国产国产精| 美女视频黄 久久| 黑人精品欧美一区二区蜜桃| 国产综合色视频| 国产成人精品亚洲日本在线桃色 | 激情综合一区二区三区| 国产在线精品一区二区三区不卡 | 国产精品私人影院| 中文字幕不卡一区| 亚洲免费观看高清完整版在线观看 | 久久综合av免费| 国产偷v国产偷v亚洲高清| 国产精品高潮呻吟久久| 亚洲伦在线观看| 午夜精品福利一区二区三区av | 97国产一区二区| 欧美在线观看视频一区二区三区| 欧美吻胸吃奶大尺度电影| 91精品国产麻豆国产自产在线| 26uuu久久天堂性欧美| 国产欧美精品区一区二区三区 | 久久99精品国产麻豆不卡| 国产iv一区二区三区| 色综合天天性综合| 欧美日韩国产天堂| 久久久久久久综合狠狠综合| 成人免费视频在线观看| 亚洲成人中文在线| 激情综合一区二区三区| 91农村精品一区二区在线| 91精品国产一区二区三区| 欧美激情一区二区三区全黄 | 在线不卡a资源高清| 久久久久国产精品麻豆| 一区二区欧美在线观看| 国产综合一区二区| 欧美在线观看禁18| 久久精品一区二区三区不卡牛牛| 亚洲天堂精品视频| 极品少妇一区二区| 91电影在线观看| 国产日韩亚洲欧美综合| 亚洲香蕉伊在人在线观| 国产91丝袜在线播放| 欧美日韩不卡一区二区| 国产精品国产三级国产有无不卡| 青青草国产精品97视觉盛宴| 99国产精品久久久久久久久久久| 日韩一级二级三级| 一区二区激情视频| 成人黄色大片在线观看| 日韩亚洲国产中文字幕欧美| 亚洲女性喷水在线观看一区| 国产精品911| 欧美久久久久久久久中文字幕| 国产精品视频麻豆| 九九**精品视频免费播放| 在线观看免费一区| 国产精品女人毛片| 黑人巨大精品欧美黑白配亚洲| 欧美另类变人与禽xxxxx| 亚洲欧美精品午睡沙发| 成人黄色免费短视频| 26uuu另类欧美亚洲曰本| 蜜桃av一区二区在线观看 | 亚洲综合色成人| kk眼镜猥琐国模调教系列一区二区| 精品国产乱码久久| 精品一区二区在线看| 欧美美女直播网站| 一区二区三区在线免费| gogogo免费视频观看亚洲一| 欧美激情一区在线观看| 国产一本一道久久香蕉| 2019国产精品| 国产精品一区免费在线观看| 欧美一区二区在线免费观看| 日韩黄色小视频| 欧美日韩国产一级| 青青青伊人色综合久久| 日韩欧美成人激情| 韩国欧美国产1区| 久久老女人爱爱| 国产一区91精品张津瑜|