当前位置: 首页>>代码示例>>Java>>正文


Java X509Extension类代码示例

本文整理汇总了Java中org.bouncycastle.asn1.x509.X509Extension的典型用法代码示例。如果您正苦于以下问题:Java X509Extension类的具体用法?Java X509Extension怎么用?Java X509Extension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


X509Extension类属于org.bouncycastle.asn1.x509包,在下文中一共展示了X509Extension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GenOcspReq

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public static OCSPReq GenOcspReq(X509Certificate nextCert,
		X509Certificate nextIssuer) throws OCSPException {

	OCSPReqGenerator ocspRequestGenerator = new OCSPReqGenerator();
	CertificateID certId = new CertificateID(CertificateID.HASH_SHA1,
			nextIssuer, nextCert.getSerialNumber());
	ocspRequestGenerator.addRequest(certId);

	BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis());
	Vector<DERObjectIdentifier> oids = new Vector<DERObjectIdentifier>();
	Vector<X509Extension> values = new Vector<X509Extension>();

	oids.add(OCSPObjectIdentifiers.id_pkix_ocsp_nonce);
	values.add(new X509Extension(false, new DEROctetString(nonce
			.toByteArray())));

	ocspRequestGenerator.setRequestExtensions(new X509Extensions(oids,
			values));
	return ocspRequestGenerator.generate();
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:21,代码来源:DerEncoder.java

示例2: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
private Set getExtensionOIDs(boolean critical)
{
    Set             set = new HashSet();
    X509Extensions  extensions = this.getResponseExtensions();
    
    if (extensions != null)
    {
        Enumeration     e = extensions.oids();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
            X509Extension       ext = extensions.getExtension(oid);

            if (critical == ext.isCritical())
            {
                set.add(oid.getId());
            }
        }
    }

    return set;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:RespData.java

示例3: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public byte[] getExtensionValue(String oid)
{
    X509Extensions exts = this.getResponseExtensions();

    if (exts != null)
    {
        X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));

        if (ext != null)
        {
            try
            {
                return ext.getValue().getEncoded(ASN1Encoding.DER);
            }
            catch (Exception e)
            {
                throw new RuntimeException("error encoding " + e.toString());
            }
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:RespData.java

示例4: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
private Set getExtensionOIDs(boolean critical)
{
    Set             set = new HashSet();
    X509Extensions  extensions = this.getRequestExtensions();
    
    if (extensions != null)
    {
        Enumeration     e = extensions.oids();

        while (e.hasMoreElements())
        {
            ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
            X509Extension       ext = extensions.getExtension(oid);

            if (critical == ext.isCritical())
            {
                set.add(oid.getId());
            }
        }
    }

    return set;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:OCSPReq.java

示例5: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public byte[] getExtensionValue(String oid)
{
    X509Extensions exts = this.getRequestExtensions();

    if (exts != null)
    {
        X509Extension   ext = exts.getExtension(new ASN1ObjectIdentifier(oid));

        if (ext != null)
        {
            try
            {
                return ext.getValue().getEncoded(ASN1Encoding.DER);
            }
            catch (Exception e)
            {
                throw new RuntimeException("error encoding " + e.toString());
            }
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:OCSPReq.java

示例6: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
private Set getExtensionOIDs(boolean critical)
{
    Set             set = new HashSet();
    X509Extensions  extensions = this.getSingleRequestExtensions();
    
    if (extensions != null)
    {
        Enumeration     e = extensions.oids();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
            X509Extension       ext = extensions.getExtension(oid);

            if (critical == ext.isCritical())
            {
                set.add(oid.getId());
            }
        }
    }

    return set;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:Req.java

示例7: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public byte[] getExtensionValue(String oid)
{
    X509Extensions exts = this.getSingleRequestExtensions();

    if (exts != null)
    {
        X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));

        if (ext != null)
        {
            try
            {
                return ext.getValue().getEncoded(ASN1Encoding.DER);
            }
            catch (Exception e)
            {
                throw new RuntimeException("error encoding " + e.toString());
            }
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:Req.java

示例8: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
private Set getExtensionOIDs(boolean critical)
{
    Set             set = new HashSet();
    X509Extensions  extensions = this.getSingleExtensions();
    
    if (extensions != null)
    {
        Enumeration     e = extensions.oids();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
            X509Extension       ext = extensions.getExtension(oid);

            if (critical == ext.isCritical())
            {
                set.add(oid.getId());
            }
        }
    }

    return set;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:SingleResp.java

示例9: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public byte[] getExtensionValue(String oid)
{
    X509Extensions exts = this.getSingleExtensions();

    if (exts != null)
    {
        X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));

        if (ext != null)
        {
            try
            {
                return ext.getValue().getEncoded(ASN1Encoding.DER);
            }
            catch (Exception e)
            {
                throw new RuntimeException("error encoding " + e.toString());
            }
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:SingleResp.java

示例10: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
private Set getExtensionOIDs(
    boolean critical) 
{
    X509Extensions  extensions = cert.getAcinfo().getExtensions();

    if (extensions != null)
    {
        Set             set = new HashSet();
        Enumeration     e = extensions.oids();

        while (e.hasMoreElements())
        {
            DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
            X509Extension       ext = extensions.getExtension(oid);

            if (ext.isCritical() == critical)
            {
                set.add(oid.getId());
            }
        }

        return set;
    }

    return null;
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:27,代码来源:X509V2AttributeCertificate.java

示例11: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
private Set getExtensionOIDs(boolean critical)
{
	if (this.getVersion() == 2)
	{
		HashSet         set = new HashSet();
		X509Extensions  extensions = c.getTBSCertList().getExtensions();
		Enumeration     e = extensions.oids();

		while (e.hasMoreElements())
		{
			DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
			X509Extension       ext = extensions.getExtension(oid);

			if (critical == ext.isCritical())
			{
				set.add(oid.getId());
			}
		}

		return set;
	}

	return null;
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:25,代码来源:X509CRLObject.java

示例12: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
private Set getExtensionOIDs(boolean critical)
{
	X509Extensions extensions = c.getExtensions();

	if ( extensions != null )
	{
		HashSet			set = new HashSet();
		Enumeration		e = extensions.oids();

		while (e.hasMoreElements())
		{
			DERObjectIdentifier	oid = (DERObjectIdentifier)e.nextElement();
			X509Extension		ext = extensions.getExtension(oid);

			if (critical == ext.isCritical())
			{
				set.add(oid.getId());
			}
		}

		return set;
	}

	return null;
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:26,代码来源:X509CRLEntryObject.java

示例13: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public byte[] getExtensionValue(String oid)
{
	X509Extensions exts = c.getExtensions();

	if (exts != null)
	{
		X509Extension ext = exts.getExtension(new DERObjectIdentifier(oid));

		if (ext != null)
		{
			return ext.getValue().getOctets();
		}
	}

	return null;
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:17,代码来源:X509CRLEntryObject.java

示例14: makeCertificate

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public static X509CertificateHolder makeCertificate(AsymmetricCipherKeyPair subKP, String _subDN, AsymmetricCipherKeyPair issKP, String _issDN, boolean _ca)
    throws IOException, OperatorCreationException
{
    RSAKeyParameters lwPubKey = (RSAKeyParameters)subKP.getPublic();

    X509v3CertificateBuilder v3CertGen = new X509v3CertificateBuilder(
        new X500Name(_issDN),
        allocateSerialNumber(),
        new Date(System.currentTimeMillis()),
        new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 100)),
        new X500Name(_subDN),
        new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE), new RSAPublicKey(lwPubKey.getModulus(), lwPubKey.getExponent()))
    );

    AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find("SHA1WithRSAEncryption");
    AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);

    ContentSigner sigGen = new BcRSAContentSignerBuilder(sigAlgId, digAlgId).build((AsymmetricKeyParameter)issKP.getPrivate());

    v3CertGen.addExtension(
        X509Extension.basicConstraints,
        false,
        new BasicConstraints(_ca));

    return v3CertGen.build(sigGen);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:27,代码来源:CMSTestUtil.java

示例15: generateCertificate

import org.bouncycastle.asn1.x509.X509Extension; //导入依赖的package包/类
public static X509Certificate generateCertificate(Credential credential, String entityId) throws Exception {
    X500Name issuer = new X500Name("o=keymanager, ou=oiosaml-sp");
    BigInteger serialNumber = BigInteger.valueOf(System.currentTimeMillis());
    Date notBefore = new Date();
    Date notAfter = new Date(System.currentTimeMillis() + 1000L * 60L * 60L * 24L * 365L * 10L);
    X500Name subject = new X500Name("cn=" + entityId + ", ou=oiosaml-sp");

    ByteArrayInputStream bIn = new ByteArrayInputStream(credential.getPublicKey().getEncoded());
    SubjectPublicKeyInfo publicKeyInfo = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(bIn).readObject());

    X509v3CertificateBuilder gen = new X509v3CertificateBuilder(issuer, serialNumber, notBefore, notAfter, subject, publicKeyInfo);

	gen.addExtension(X509Extension.subjectKeyIdentifier, false, new JcaX509ExtensionUtils().createSubjectKeyIdentifier(credential.getPublicKey()));
	gen.addExtension(X509Extension.authorityKeyIdentifier, false, new JcaX509ExtensionUtils().createAuthorityKeyIdentifier(credential.getPublicKey()));

    ContentSigner sigGen = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(credential.getPrivateKey());
    X509CertificateHolder certificateHolder = gen.build(sigGen);

    X509Certificate x509Certificate = new JcaX509CertificateConverter().setProvider("BC").getCertificate(certificateHolder);
	return x509Certificate;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:22,代码来源:SecurityHelper.java


注:本文中的org.bouncycastle.asn1.x509.X509Extension类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。