當前位置: 首頁>>代碼示例>>Java>>正文


Java X509Extensions.getExtension方法代碼示例

本文整理匯總了Java中org.bouncycastle.asn1.x509.X509Extensions.getExtension方法的典型用法代碼示例。如果您正苦於以下問題:Java X509Extensions.getExtension方法的具體用法?Java X509Extensions.getExtension怎麽用?Java X509Extensions.getExtension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bouncycastle.asn1.x509.X509Extensions的用法示例。


在下文中一共展示了X509Extensions.getExtension方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例2: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例3: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例4: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例5: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例6: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例7: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例8: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例9: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例10: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例11: getExtensionOIDs

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例12: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的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

示例13: validateKeyUsage

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的package包/類
private void validateKeyUsage(X509CertificateStructure c, int keyUsageBits) throws IOException
{
    X509Extensions exts = c.getTBSCertificate().getExtensions();
    if (exts != null)
    {
        X509Extension ext = exts.getExtension(X509Extensions.KeyUsage);
        if (ext != null)
        {
            KeyUsage ku = KeyUsage.getInstance(ext);
            int bits = ku.getBytes()[0] & 0xff;
            if ((bits & keyUsageBits) != keyUsageBits)
            {
                handler.failWithError(TlsProtocolHandler.AL_fatal,
                    TlsProtocolHandler.AP_certificate_unknown);
            }
        }
    }
}
 
開發者ID:coova,項目名稱:jradius,代碼行數:19,代碼來源:TlsSRPKeyExchange.java

示例14: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的package包/類
public byte[] getExtensionValue(String oid) 
{
    X509Extensions  extensions = cert.getAcinfo().getExtensions();

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

        if (ext != null)
        {
            ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
            DEROutputStream            dOut = new DEROutputStream(bOut);
            
            try
            {
                dOut.writeObject(ext.getValue());

                return bOut.toByteArray();
            }
            catch (Exception e)
            {
                throw new RuntimeException("error encoding " + e.toString());
            }
        }
    }

    return null;
}
 
開發者ID:thangbn,項目名稱:Direct-File-Downloader,代碼行數:29,代碼來源:X509V2AttributeCertificate.java

示例15: getExtensionValue

import org.bouncycastle.asn1.x509.X509Extensions; //導入方法依賴的package包/類
public byte[] getExtensionValue(String oid)
{
	X509Extensions exts = c.getTBSCertList().getExtensions();

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

		if (ext != null)
		{
               ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
               DEROutputStream dOut = new DEROutputStream(bOut);

               try
               {
                   dOut.writeObject(ext.getValue());

                   return bOut.toByteArray();
               }
               catch (Exception e)
               {
                   throw new RuntimeException("error encoding " + e.toString());
               }
		}
	}

	return null;
}
 
開發者ID:thangbn,項目名稱:Direct-File-Downloader,代碼行數:29,代碼來源:X509CRLObject.java


注:本文中的org.bouncycastle.asn1.x509.X509Extensions.getExtension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。