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


Java ASN1Set类代码示例

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


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

示例1: getCertificates

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
/**
 * Return the certificates stored in the underlying OriginatorInfo object.
 *
 * @return a Store of X509CertificateHolder objects.
 */
public Store getCertificates()
{
    ASN1Set certSet = originatorInfo.getCertificates();

    if (certSet != null)
    {
        List certList = new ArrayList(certSet.size());

        for (Enumeration en = certSet.getObjects(); en.hasMoreElements();)
        {
            ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();

            if (obj instanceof ASN1Sequence)
            {
                certList.add(new X509CertificateHolder(Certificate.getInstance(obj)));
            }
        }

        return new CollectionStore(certList);
    }

    return new CollectionStore(new ArrayList());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:29,代码来源:OriginatorInformation.java

示例2: getAuthAttrSet

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
private ASN1Set getAuthAttrSet()
    throws IOException
{
    if (authAttrs == null && authAttrNotRead)
    {
        ASN1SetParser set = authData.getAuthAttrs();

        if (set != null)
        {
            authAttrSet = (ASN1Set)set.toASN1Primitive();
        }

        authAttrNotRead = false;
    }

    return authAttrSet;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:CMSAuthenticatedDataParser.java

示例3: getAttributes

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
public Attribute[] getAttributes()
{
    ASN1Set attrs = safeBag.getBagAttributes();

    if (attrs == null)
    {
        return null;
    }

    Attribute[] attributes = new Attribute[attrs.size()];
    for (int i = 0; i != attrs.size(); i++)
    {
        attributes[i] = Attribute.getInstance(attrs.getObjectAt(i));
    }

    return attributes;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:PKCS12SafeBag.java

示例4: getAttributes

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
/**
 * Return the attributes, if any associated with this request.
 *
 * @return an array of Attribute, zero length if none present.
 */
public Attribute[] getAttributes()
{
    ASN1Set attrSet = certificationRequest.getCertificationRequestInfo().getAttributes();

    if (attrSet == null)
    {
        return EMPTY_ARRAY;
    }

    Attribute[] attrs = new Attribute[attrSet.size()];

    for (int i = 0; i != attrSet.size(); i++)
    {
        attrs[i] = Attribute.getInstance(attrSet.getObjectAt(i));
    }

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

示例5: CscaMasterList

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
private CscaMasterList(
    ASN1Sequence seq)
{
    if (seq == null || seq.size() == 0)
    {
        throw new IllegalArgumentException(
            "null or empty sequence passed.");
    }
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException(
            "Incorrect sequence size: " + seq.size());
    }

    version = ASN1Integer.getInstance(seq.getObjectAt(0));
    ASN1Set certSet = ASN1Set.getInstance(seq.getObjectAt(1));
    certList = new Certificate[certSet.size()];
    for (int i = 0; i < certList.length; i++)
    {
        certList[i]
            = Certificate.getInstance(certSet.getObjectAt(i));
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:CscaMasterList.java

示例6: SignerInfo

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
public SignerInfo(
    ASN1Integer              version,
    IssuerAndSerialNumber   issuerAndSerialNumber,
    AlgorithmIdentifier     digAlgorithm,
    ASN1Set                 authenticatedAttributes,
    AlgorithmIdentifier     digEncryptionAlgorithm,
    ASN1OctetString         encryptedDigest,
    ASN1Set                 unauthenticatedAttributes)
{
    this.version = version;
    this.issuerAndSerialNumber = issuerAndSerialNumber;
    this.digAlgorithm = digAlgorithm;
    this.authenticatedAttributes = authenticatedAttributes;
    this.digEncryptionAlgorithm = digEncryptionAlgorithm;
    this.encryptedDigest = encryptedDigest;
    this.unauthenticatedAttributes = unauthenticatedAttributes;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:SignerInfo.java

示例7: CertificationRequestInfo

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
/**
 * @deprecated use getInstance().
 */
public CertificationRequestInfo(
    ASN1Sequence  seq)
{
    version = (ASN1Integer)seq.getObjectAt(0);

    subject = X500Name.getInstance(seq.getObjectAt(1));
    subjectPKInfo = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(2));

    //
    // some CertificationRequestInfo objects seem to treat this field
    // as optional.
    //
    if (seq.size() > 3)
    {
        DERTaggedObject tagobj = (DERTaggedObject)seq.getObjectAt(3);
        attributes = ASN1Set.getInstance(tagobj, false);
    }

    if ((subject == null) || (version == null) || (subjectPKInfo == null))
    {
        throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:CertificationRequestInfo.java

示例8: close

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
public void close()
    throws IOException
{
    _out.close();
    _eiGen.close();

    if (unprotectedAttributeGenerator != null)
    {
        AttributeTable attrTable = unprotectedAttributeGenerator.getAttributes(new HashMap());
      
        ASN1Set unprotectedAttrs = new BERSet(attrTable.toASN1EncodableVector());

        _envGen.addObject(new DERTaggedObject(false, 1, unprotectedAttrs));
    }
    
    _envGen.close();
    _cGen.close();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:CMSEnvelopedDataStreamGenerator.java

示例9: PrivateKeyInfo

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
/**
 * @deprectaed use PrivateKeyInfo.getInstance()
 * @param seq
 */
public PrivateKeyInfo(
    ASN1Sequence  seq)
{
    Enumeration e = seq.getObjects();

    BigInteger  version = ((ASN1Integer)e.nextElement()).getValue();
    if (version.intValue() != 0)
    {
        throw new IllegalArgumentException("wrong version for private key info");
    }

    algId = AlgorithmIdentifier.getInstance(e.nextElement());
    privKey = ASN1OctetString.getInstance(e.nextElement());
    
    if (e.hasMoreElements())
    {
       attributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:PrivateKeyInfo.java

示例10: SignerInfo

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
public SignerInfo(
    SignerIdentifier        sid,
    AlgorithmIdentifier     digAlgorithm,
    ASN1Set                 authenticatedAttributes,
    AlgorithmIdentifier     digEncryptionAlgorithm,
    ASN1OctetString         encryptedDigest,
    ASN1Set                 unauthenticatedAttributes)
{
    if (sid.isTagged())
    {
        this.version = new ASN1Integer(3);
    }
    else
    {
        this.version = new ASN1Integer(1);
    }

    this.sid = sid;
    this.digAlgorithm = digAlgorithm;
    this.authenticatedAttributes = authenticatedAttributes;
    this.digEncryptionAlgorithm = digEncryptionAlgorithm;
    this.encryptedDigest = encryptedDigest;
    this.unauthenticatedAttributes = unauthenticatedAttributes;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:SignerInfo.java

示例11: EnvelopedData

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
/**
 * @deprecated use getInstance()
 */
public EnvelopedData(
    ASN1Sequence seq)
{
    int     index = 0;
    
    version = (ASN1Integer)seq.getObjectAt(index++);
    
    Object  tmp = seq.getObjectAt(index++);

    if (tmp instanceof ASN1TaggedObject)
    {
        originatorInfo = OriginatorInfo.getInstance((ASN1TaggedObject)tmp, false);
        tmp = seq.getObjectAt(index++);
    }

    recipientInfos = ASN1Set.getInstance(tmp);
    
    encryptedContentInfo = EncryptedContentInfo.getInstance(seq.getObjectAt(index++));
    
    if(seq.size() > index)
    {
        unprotectedAttrs = ASN1Set.getInstance((ASN1TaggedObject)seq.getObjectAt(index), false);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:28,代码来源:EnvelopedData.java

示例12: SignedData

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
public SignedData(
    ASN1Set     digestAlgorithms,
    ContentInfo contentInfo,
    ASN1Set     certificates,
    ASN1Set     crls,
    ASN1Set     signerInfos)
{
    this.version = calculateVersion(contentInfo.getContentType(), certificates, crls, signerInfos);
    this.digestAlgorithms = digestAlgorithms;
    this.contentInfo = contentInfo;
    this.certificates = certificates;
    this.crls = crls;
    this.signerInfos = signerInfos;
    this.crlsBer = crls instanceof BERSet;
    this.certsBer = certificates instanceof BERSet;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:SignedData.java

示例13: buildSignedAttributes

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
private static ASN1Set buildSignedAttributes(byte[] hash, Date dateTime, X509Certificate cert) throws Exception {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(new Attribute(CMSAttributes.contentType, new DERSet(PKCSObjectIdentifiers.data)));
    if (dateTime != null)
        v.add(new Attribute(CMSAttributes.signingTime, new DERSet(new Time(dateTime))));
    v.add(new Attribute(CMSAttributes.messageDigest, new DERSet(new DEROctetString(hash))));

    // CADES support section
    ASN1EncodableVector aaV2 = new ASN1EncodableVector();
    AlgorithmIdentifier algoId = new AlgorithmIdentifier(new ASN1ObjectIdentifier(CMSSignedDataGenerator.DIGEST_SHA256), null);
    aaV2.add(algoId);
    byte[] dig = SignUtils.calculateHASH(CMSSignedDataGenerator.DIGEST_SHA256, cert.getEncoded());
    aaV2.add(new DEROctetString(dig));
    Attribute cades = new Attribute(PKCSObjectIdentifiers.id_aa_signingCertificateV2, new DERSet(new DERSequence(new DERSequence(new DERSequence(aaV2)))));
    v.add(cades);

    ASN1Set signedAttributes = new DERSet(v);
    return signedAttributes;
}
 
开发者ID:damianofalcioni,项目名称:Websocket-Smart-Card-Signer,代码行数:20,代码来源:CMSSignedDataWrapper.java

示例14: getCertificates

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
Store getCertificates(ASN1Set certSet)
{
    if (certSet != null)
    {
        List certList = new ArrayList(certSet.size());

        for (Enumeration en = certSet.getObjects(); en.hasMoreElements();)
        {
            ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();

            if (obj instanceof ASN1Sequence)
            {
                certList.add(new X509CertificateHolder(Certificate.getInstance(obj)));
            }
        }

        return new CollectionStore(certList);
    }

    return new CollectionStore(new ArrayList());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:CMSSignedHelper.java

示例15: getAttributeCertificates

import org.bouncycastle.asn1.ASN1Set; //导入依赖的package包/类
Store getAttributeCertificates(ASN1Set certSet)
{
    if (certSet != null)
    {
        List certList = new ArrayList(certSet.size());

        for (Enumeration en = certSet.getObjects(); en.hasMoreElements();)
        {
            ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();

            if (obj instanceof ASN1TaggedObject)
            {
                certList.add(new X509AttributeCertificateHolder(AttributeCertificate.getInstance(((ASN1TaggedObject)obj).getObject())));
            }
        }

        return new CollectionStore(certList);
    }

    return new CollectionStore(new ArrayList());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:CMSSignedHelper.java


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