• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java X509AttributeCertificate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: convertCerts

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private static Collection convertCerts(Collection collection)
    throws IOException
{
    List list = new ArrayList(collection.size());

    for (Iterator it = collection.iterator(); it.hasNext();)
    {
        Object o = it.next();

        if (o instanceof X509AttributeCertificate)
        {
            X509AttributeCertificate cert = (X509AttributeCertificate)o;

            list.add(new JcaX509AttributeCertificateHolder(cert));
        }
        else
        {
            list.add(o);
        }
    }

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


示例2: readDERCertificate

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private X509AttributeCertificate readDERCertificate(
    InputStream in)
    throws IOException
{
    ASN1InputStream dIn = new ASN1InputStream(in);
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

    if (seq.size() > 1
            && seq.getObjectAt(0) instanceof DERObjectIdentifier)
    {
        if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
        {
            sData = new SignedData(ASN1Sequence.getInstance(
                            (ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();

            return getCertificate();
        }
    }

    return new X509V2AttributeCertificate(seq.getEncoded());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:X509AttrCertParser.java


示例3: getCertificate

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private X509AttributeCertificate getCertificate()
    throws IOException
{
    if (sData != null)
    {
        while (sDataObjectCount < sData.size())
        {
            Object obj = sData.getObjectAt(sDataObjectCount++);

            if (obj instanceof ASN1TaggedObject && ((ASN1TaggedObject)obj).getTagNo() == 2)
            {
               return new X509V2AttributeCertificate(
                      ASN1Sequence.getInstance((ASN1TaggedObject)obj, false).getEncoded());
            }
        }
    }

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


示例4: readDERCertificate

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private X509AttributeCertificate readDERCertificate(
    InputStream in)
    throws IOException
{
    ASN1InputStream dIn = new ASN1InputStream(in);
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

    if (seq.size() > 1
            && seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
    {
        if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
        {
            sData = new SignedData(ASN1Sequence.getInstance(
                            (ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();

            return getCertificate();
        }
    }

    return new X509V2AttributeCertificate(seq.getEncoded());
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:22,代码来源:X509AttrCertParser.java


示例5: checkCRLsNotEmpty

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
static void checkCRLsNotEmpty(Set crls, Object cert)
    throws AnnotatedException
{
    if (crls.isEmpty())
    {
        if (cert instanceof X509AttributeCertificate)
        {
            X509AttributeCertificate aCert = (X509AttributeCertificate)cert;

            throw new AnnotatedException("No CRLs found for issuer \"" + aCert.getIssuer().getPrincipals()[0] + "\"");
        }
        else
        {
            X509Certificate xCert = (X509Certificate)cert;

            throw new AnnotatedException("No CRLs found for issuer \"" + RFC4519Style.INSTANCE.toString(PrincipalUtils.getIssuerPrincipal(xCert)) + "\"");
        }
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:20,代码来源:CertPathValidatorUtilities.java


示例6: getEncodedIssuerPrincipal

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
/**
     * Returns the issuer of an attribute certificate or certificate.
     *
     * @param cert The attribute certificate or certificate.
     * @return The issuer as <code>X509Principal</code>.
     */
    protected static X509Principal getEncodedIssuerPrincipal(
        Object cert)
    {
        if (cert instanceof X509Certificate)
        {
try
{
            return PrincipalUtil.getIssuerX509Principal((X509Certificate)cert);
}
catch (Exception e)
{
throw new IllegalStateException(e.toString());
}
        }
        else
        {
            return (X509Principal)((X509AttributeCertificate)cert).getIssuer().getPrincipals()[0];
        }
    }
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:26,代码来源:CertPathValidatorUtilities.java


示例7: createAttributeCertificates

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private Set createAttributeCertificates(List list,
                                        X509AttributeCertStoreSelector xselector) throws StoreException
{
    Set certSet = new HashSet();

    Iterator it = list.iterator();
    X509AttrCertParser parser = new X509AttrCertParser();
    while (it.hasNext())
    {
        try
        {
            parser.engineInit(new ByteArrayInputStream((byte[])it
                .next()));
            X509AttributeCertificate cert = (X509AttributeCertificate)parser
                .engineRead();
            if (xselector.match((Object)cert))
            {
                certSet.add(cert);
            }
        }
        catch (StreamParsingException e)
        {

        }
    }

    return certSet;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:29,代码来源:LDAPStoreHelper.java


示例8: readPEMCertificate

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private X509AttributeCertificate readPEMCertificate(
    InputStream  in)
    throws IOException
{
    ASN1Sequence seq = PEM_PARSER.readPEMObject(in);

    if (seq != null)
    {
        return new X509V2AttributeCertificate(seq.getEncoded());
    }

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


示例9: engineReadAll

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
public Collection engineReadAll()
    throws StreamParsingException
{
    X509AttributeCertificate cert;
    List certs = new ArrayList();

    while ((cert = (X509AttributeCertificate)engineRead()) != null)
    {
        certs.add(cert);
    }

    return certs;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:14,代码来源:X509AttrCertParser.java


示例10: getEncodedIssuerPrincipal

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
/**
 * Returns the issuer of an attribute certificate or certificate.
 *
 * @param cert The attribute certificate or certificate.
 * @return The issuer as <code>X500Principal</code>.
 */
protected static X500Principal getEncodedIssuerPrincipal(
    Object cert)
{
    if (cert instanceof X509Certificate)
    {
        return ((X509Certificate)cert).getIssuerX500Principal();
    }
    else
    {
        return (X500Principal)((X509AttributeCertificate)cert).getIssuer().getPrincipals()[0];
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:CertPathValidatorUtilities.java


示例11: getSerialNumber

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private static BigInteger getSerialNumber(
    Object cert)
{
    if (cert instanceof X509Certificate)
    {
        return ((X509Certificate)cert).getSerialNumber();
    }
    else
    {
        return ((X509AttributeCertificate)cert).getSerialNumber();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:CertPathValidatorUtilities.java


示例12: VOMSAttribute

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
/**
 * Parses the contents of an attribute certificate.<br>
 * <b>NOTE:</b> Cryptographic signatures, time stamps etc. will <b>not</b> be checked.
 *
 * @param ac the attribute certificate to parse for VOMS attributes
 */
public VOMSAttribute(X509AttributeCertificate ac) 
{
    if (ac == null) 
    {
        throw new IllegalArgumentException("VOMSAttribute: AttributeCertificate is NULL");
    }

    myAC = ac;

    X509Attribute[] l = ac.getAttributes(VOMS_ATTR_OID);

    if (l == null) 
    {
        return;
    }

    try 
    {
        for (int i = 0; i != l.length; i++) 
        {
            IetfAttrSyntax attr = IetfAttrSyntax.getInstance(l[i].getValues()[0]);

            // policyAuthority is on the format <vo>/<host>:<port>
            String url = ((DERIA5String)attr.getPolicyAuthority().getNames()[0].getName()).getString();
            int idx = url.indexOf("://");

            if ((idx < 0) || (idx == (url.length() - 1)))
            {
                throw new IllegalArgumentException("Bad encoding of VOMS policyAuthority : [" + url + "]");
            }

            myVo = url.substring(0, idx);
            myHostPort = url.substring(idx + 3);

            if (attr.getValueType() != IetfAttrSyntax.VALUE_OCTETS)
            {
                throw new IllegalArgumentException(
                    "VOMS attribute values are not encoded as octet strings, policyAuthority = " + url);
            }

            ASN1OctetString[]   values = (ASN1OctetString[])attr.getValues();
            for (int j = 0; j != values.length; j++)        
            {
                String fqan = new String(values[j].getOctets());
                FQAN f = new FQAN(fqan);

                if (!myStringList.contains(fqan) && fqan.startsWith("/" + myVo + "/"))
           {
                    myStringList.add(fqan);
                    myFQANs.add(f);
                }
            }
        }
    }
    catch (IllegalArgumentException ie) 
    {
        throw ie;
    }
    catch (Exception e) 
    {
        throw new IllegalArgumentException("Badly encoded VOMS extension in AC issued by " +
            ac.getIssuer());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:71,代码来源:VOMSAttribute.java


示例13: readAttributeCertificate

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
/**
 * Reads in a X509 Attribute Certificate.
 *
 * @return the X509 Attribute Certificate
 * @throws IOException if an I/O error occured
 */
private X509AttributeCertificate readAttributeCertificate(
    String  endMarker)
    throws IOException
{
    return new X509V2AttributeCertificate(readBytes(endMarker));
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:13,代码来源:PEMReader.java


示例14: getEncodedIssuerPrincipal

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
/**
 * Returns the issuer of an attribute certificate or certificate.
 *
 * @param cert The attribute certificate or certificate.
 * @return The issuer as <code>X500Principal</code>.
 */
static X500Name getEncodedIssuerPrincipal(
    Object cert)
{
    if (cert instanceof X509Certificate)
    {
        return getIssuerPrincipal((X509Certificate)cert);
    }
    else
    {
        return X500Name.getInstance(((X500Principal)((X509AttributeCertificate)cert).getIssuer().getPrincipals()[0]).getEncoded());
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:19,代码来源:PrincipalUtils.java


示例15: testCertWithBaseCertificateID

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private void testCertWithBaseCertificateID()
    throws Exception
{
    X509AttributeCertificate attrCert = new X509V2AttributeCertificate(certWithBaseCertificateID);
    CertificateFactory       fact = CertificateFactory.getInstance("X.509", "BC");   
    X509Certificate          cert = (X509Certificate)fact.generateCertificate(new ByteArrayInputStream(holderCertWithBaseCertificateID));
    
    AttributeCertificateHolder holder = attrCert.getHolder();
    
    if (holder.getEntityNames() != null)
    {
        fail("entity names set when none expected");
    }
    
    if (!holder.getSerialNumber().equals(cert.getSerialNumber()))
    {
        fail("holder serial number doesn't match");
    }

    if (!holder.getIssuer()[0].equals(cert.getIssuerX500Principal()))
    {
        fail("holder issuer doesn't match");
    }
    
    if (!holder.match(cert))
    {
        fail("holder not matching holder certificate");
    }

    if (!holder.equals(holder.clone()))
    {
        fail("holder clone test failed");
    }

    if (!attrCert.getIssuer().equals(attrCert.getIssuer().clone()))
    {
        fail("issuer clone test failed");
    }
    
    //equalityAndHashCodeTest(attrCert, certWithBaseCertificateID);
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:42,代码来源:AttrCertTest.java


示例16: convertCert

import org.bouncycastle.x509.X509AttributeCertificate; //导入依赖的package包/类
private static Collection convertCert(X509AttributeCertificate attrCert)
    throws IOException
{
    List tmp = new ArrayList();

    tmp.add(attrCert);

    return convertCerts(tmp);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:10,代码来源:JcaAttrCertStore.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Utils类代码示例发布时间:2022-05-23
下一篇:
Java Query类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap