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

Java Attribute类代码示例

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

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



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

示例1: getAttributes

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的package包/类
/**
 * Return an  array of attributes matching the passed in type OID.
 *
 * @param type the type of the attribute being looked for.
 * @return an array of Attribute of the requested type, zero length if none present.
 */
public Attribute[] getAttributes(ASN1ObjectIdentifier type)
{
    ASN1Sequence    seq = attrCert.getAcinfo().getAttributes();
    List            list = new ArrayList();

    for (int i = 0; i != seq.size(); i++)
    {
        Attribute attr = Attribute.getInstance(seq.getObjectAt(i));
        if (attr.getAttrType().equals(type))
        {
            list.add(attr);
        }
    }

    if (list.size() == 0)
    {
        return EMPTY_ARRAY;
    }

    return (Attribute[])list.toArray(new Attribute[list.size()]);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:28,代码来源:X509AttributeCertificateHolder.java


示例2: toASN1Primitive

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的package包/类
/**
 *
 * <pre>
 *  SignerAttribute ::= SEQUENCE OF CHOICE {
 *      claimedAttributes   [0] ClaimedAttributes,
 *      certifiedAttributes [1] CertifiedAttributes }
 *
 *  ClaimedAttributes ::= SEQUENCE OF Attribute
 *  CertifiedAttributes ::= AttributeCertificate -- as defined in RFC 3281: see clause 4.1.
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    for (int i = 0; i != values.length; i++)
    {
        if (values[i] instanceof Attribute[])
        {
            v.add(new DERTaggedObject(0, new DERSequence((Attribute[])values[i])));
        }
        else
        {
            v.add(new DERTaggedObject(1, (AttributeCertificate)values[i]));
        }
    }

    return new DERSequence(v);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:30,代码来源:SignerAttribute.java


示例3: SignerAttribute

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的package包/类
private SignerAttribute(
    ASN1Sequence seq)
{
    int index = 0;
    values = new Object[seq.size()];

    for (Enumeration e = seq.getObjects(); e.hasMoreElements();)
    {
        ASN1TaggedObject taggedObject = ASN1TaggedObject.getInstance(e.nextElement());

        if (taggedObject.getTagNo() == 0)
        {
            ASN1Sequence attrs = ASN1Sequence.getInstance(taggedObject, true);
            Attribute[]  attributes = new Attribute[attrs.size()];

            for (int i = 0; i != attributes.length; i++)
            {
                attributes[i] = Attribute.getInstance(attrs.getObjectAt(i));
            }
            values[index] = attributes;
        }
        else if (taggedObject.getTagNo() == 1)
        {
            values[index] = AttributeCertificate.getInstance(ASN1Sequence.getInstance(taggedObject, true));
        }
        else
        {
            throw new IllegalArgumentException("illegal tag: " + taggedObject.getTagNo());
        }
        index++;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:33,代码来源:SignerAttribute.java


示例4: getSubjectDirectoryAttributesStringValue

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的package包/类
private String getSubjectDirectoryAttributesStringValue(byte[] value) throws IOException {
	// @formatter:off

	/*
	 * SubjectDirectoryAttributes ::= ASN1Sequence SIZE (1..MAX) OF Attribute
	 *
	 * Attribute ::= ASN1Sequence
	 * {
	 *      type AttributeType,
	 *      values SET OF AttributeValue
	 * }
	 */

	// @formatter:on

	StringBuilder sb = new StringBuilder();

	SubjectDirectoryAttributes subjectDirectoryAttributes = SubjectDirectoryAttributes.getInstance(value);

	for (Object attribute : subjectDirectoryAttributes.getAttributes()) {

		ASN1ObjectIdentifier attributeType = ((Attribute) attribute).getAttrType();
		String attributeTypeStr = attributeType.getId();

		ASN1Encodable[] attributeValues = ((Attribute) attribute).getAttributeValues();

		for (ASN1Encodable attributeValue : attributeValues) {

			String attributeValueStr = getAttributeValueString(attributeType, attributeValue);

			sb.append(MessageFormat.format("{0}={1}", attributeTypeStr, attributeValueStr));
			sb.append(NEWLINE);
		}
	}

	return sb.toString();
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:38,代码来源:X509Ext.java


示例5: X509Attribute

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的package包/类
/**
 * @param at an object representing an attribute.
 */
X509Attribute(
    ASN1Encodable   at)
{
    this.attr = Attribute.getInstance(at);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:9,代码来源:X509Attribute.java


示例6: addAttribute

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的package包/类
/**
 * add an attribute
 */
public void addAttribute(
    X509Attribute       attribute)
{
    acInfoGen.addAttribute(Attribute.getInstance(attribute.toASN1Object()));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:9,代码来源:X509V2AttributeCertificateGenerator.java


示例7: VOMSAttribute

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的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(X509AttributeCertificateHolder ac)
{
    if (ac == null) 
    {
        throw new IllegalArgumentException("VOMSAttribute: AttributeCertificate is NULL");
    }

    myAC = ac;

    Attribute[] l = ac.getAttributes(new ASN1ObjectIdentifier(VOMS_ATTR_OID));

    if (l == null) 
    {
        return;
    }

    try 
    {
        for (int i = 0; i != l.length; i++) 
        {
            IetfAttrSyntax attr = IetfAttrSyntax.getInstance(l[i].getAttributeValues()[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:thedrummeraki,项目名称:Aki-SSL,代码行数:71,代码来源:VOMSAttribute.java


示例8: getVeriSignNonVerified

import org.bouncycastle.asn1.x509.Attribute; //导入依赖的package包/类
private String getVeriSignNonVerified(byte[] octets) throws IOException {

		/*
		    NonVerified ::= SET OF ATTRIBUTE
		 */

		StringBuilder sb = new StringBuilder();

		ASN1Set asn1Set = ASN1Set.getInstance(octets);
		for (ASN1Encodable attribute : asn1Set.toArray()) {

			ASN1ObjectIdentifier attributeId = ((Attribute) attribute).getAttrType();
			ASN1Set attributeValues = ((Attribute) attribute).getAttrValues();

			for (ASN1Encodable attributeValue : attributeValues.toArray()) {

				String attributeValueStr = getAttributeValueString(attributeId, attributeValue);

				sb.append(MessageFormat.format("{0}={1}", attributeId.getId(), attributeValueStr));
				sb.append(NEWLINE);
			}
		}

		return sb.toString();
	}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:26,代码来源:X509Ext.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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