Java 类org.bouncycastle.asn1.x509.AttributeCertificate 实例源码

项目:ipack    文件:X509V2AttributeCertificate.java   
X509V2AttributeCertificate(
    AttributeCertificate    cert)
    throws IOException
{
    this.cert = cert;

    try
    {
        this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
        this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
    }
    catch (ParseException e)
    {
        throw new IOException("invalid data structure in certificate!");
    }
}
项目:ipack    文件:SignerAttribute.java   
/**
 *
 * <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);
}
项目:ipack    文件:CMPCertificate.java   
public static CMPCertificate getInstance(Object o)
{
    if (o == null || o instanceof CMPCertificate)
    {
        return (CMPCertificate)o;
    }

    if (o instanceof ASN1Sequence || o instanceof byte[])
    {
        return new CMPCertificate(Certificate.getInstance(o));
    }

    if (o instanceof ASN1TaggedObject)
    {
        return new CMPCertificate(AttributeCertificate.getInstance(((ASN1TaggedObject)o).getObject()));
    }

    throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
项目:ipack    文件:CMSSignedHelper.java   
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());
}
项目:Direct-File-Downloader    文件:X509V2AttributeCertificate.java   
X509V2AttributeCertificate(
    AttributeCertificate    cert)
    throws IOException
{
    this.cert = cert;

    try
    {
        this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
        this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
    }
    catch (ParseException e)
    {
        throw new IOException("invalid data structure in certificate!");
    }
}
项目:gwt-crypto    文件:SignerAttribute.java   
/**
 *
 * <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);
}
项目:gwt-crypto    文件:CMSSignedHelper.java   
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());
}
项目:Aki-SSL    文件:X509V2AttributeCertificate.java   
X509V2AttributeCertificate(
    AttributeCertificate    cert)
    throws IOException
{
    this.cert = cert;

    try
    {
        this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
        this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
    }
    catch (ParseException e)
    {
        throw new IOException("invalid data structure in certificate!");
    }
}
项目:Aki-SSL    文件:SignerAttribute.java   
/**
 *
 * <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);
}
项目:Aki-SSL    文件:CMSSignedHelper.java   
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());
}
项目:TinyTravelTracker    文件:SignerAttribute.java   
/**
 *
 * <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);
}
项目:AcademicTorrents-Downloader    文件:X509V2AttributeCertificate.java   
X509V2AttributeCertificate(
    AttributeCertificate    cert)
    throws IOException
{
    this.cert = cert;

    try
    {
        this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
        this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
    }
    catch (ParseException e)
    {
        throw new IOException("invalid data structure in certificate!");
    }
}
项目:CryptMeme    文件:X509V2AttributeCertificate.java   
X509V2AttributeCertificate(
    AttributeCertificate    cert)
    throws IOException
{
    this.cert = cert;

    try
    {
        this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
        this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
    }
    catch (ParseException e)
    {
        throw new IOException("invalid data structure in certificate!");
    }
}
项目:CryptMeme    文件:SignerAttribute.java   
/**
 *
 * <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);
}
项目:CryptMeme    文件:CMPCertificate.java   
public static CMPCertificate getInstance(Object o)
{
    if (o == null || o instanceof CMPCertificate)
    {
        return (CMPCertificate)o;
    }

    if (o instanceof ASN1Sequence || o instanceof byte[])
    {
        return new CMPCertificate(Certificate.getInstance(o));
    }

    if (o instanceof ASN1TaggedObject)
    {
        return new CMPCertificate(AttributeCertificate.getInstance(((ASN1TaggedObject)o).getObject()));
    }

    throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
项目:irma_future_id    文件:CMSSignedHelper.java   
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());
}
项目:irma_future_id    文件:CMSSignedHelper.java   
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());
}
项目:irma_future_id    文件:CMSSignedData.java   
public Store getAttributeCertificates()
{
    ASN1Set certSet = signedData.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 ASN1TaggedObject)
            {
                certList.add(new X509AttributeCertificateHolder(AttributeCertificate.getInstance(((ASN1TaggedObject)obj).getObject())));
            }
        }

        return new CollectionStore(certList);
    }

    return new CollectionStore(new ArrayList());
}
项目:irma_future_id    文件:SignerAttribute.java   
/**
 *
 * <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);
}
项目:irma_future_id    文件:CMPCertificate.java   
public static CMPCertificate getInstance(Object o)
{
    if (o == null || o instanceof CMPCertificate)
    {
        return (CMPCertificate)o;
    }

    if (o instanceof ASN1Sequence || o instanceof byte[])
    {
        return new CMPCertificate(Certificate.getInstance(o));
    }

    if (o instanceof ASN1TaggedObject)
    {
        return new CMPCertificate(AttributeCertificate.getInstance(((ASN1TaggedObject)o).getObject()));
    }

    throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
项目:irma_future_id    文件:X509V2AttributeCertificate.java   
X509V2AttributeCertificate(
    AttributeCertificate    cert)
    throws IOException
{
    this.cert = cert;

    try
    {
        this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
        this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
    }
    catch (ParseException e)
    {
        throw new IOException("invalid data structure in certificate!");
    }
}
项目:bc-java    文件:CMSSignedHelper.java   
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());
}
项目:bc-java    文件:CMSSignedHelper.java   
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());
}
项目:bc-java    文件:CMSSignedData.java   
public Store getAttributeCertificates()
{
    ASN1Set certSet = signedData.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 ASN1TaggedObject)
            {
                certList.add(new X509AttributeCertificateHolder(AttributeCertificate.getInstance(((ASN1TaggedObject)obj).getObject())));
            }
        }

        return new CollectionStore(certList);
    }

    return new CollectionStore(new ArrayList());
}
项目:bc-java    文件:SignerAttribute.java   
/**
 *
 * <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);
}
项目:bc-java    文件:CMPCertificate.java   
public static CMPCertificate getInstance(Object o)
{
    if (o == null || o instanceof CMPCertificate)
    {
        return (CMPCertificate)o;
    }

    if (o instanceof ASN1Sequence || o instanceof byte[])
    {
        return new CMPCertificate(Certificate.getInstance(o));
    }

    if (o instanceof ASN1TaggedObject)
    {
        return new CMPCertificate(AttributeCertificate.getInstance(((ASN1TaggedObject)o).getObject()));
    }

    throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
项目:bc-java    文件:X509V2AttributeCertificate.java   
X509V2AttributeCertificate(
    AttributeCertificate    cert)
    throws IOException
{
    this.cert = cert;

    try
    {
        this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
        this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
    }
    catch (ParseException e)
    {
        throw new IOException("invalid data structure in certificate!");
    }
}
项目:vbrowser    文件:VOMSAttributeCertificate.java   
public VOMSAttributeCertificate( AttributeCertificate ac )
{
    this.ac = ac ;

    //----------------------------------------------------------------------------
    // first level

    acinfo = ac.getAcinfo() ;
    signatureAlgorithm = ac.getSignatureAlgorithm() ;
    signatureValue = ac.getSignatureValue() ;

    //----------------------------------------------------------------------------
    // second level therefore is the acinfo - this has 9 subparts

    version =           acinfo.getVersion() ;
    holder =            acinfo.getHolder() ;
    issuer =            acinfo.getIssuer() ;
    signature =         acinfo.getSignature() ;
    serialNumber =      acinfo.getSerialNumber() ;
    attrCertValidityPeriod =    acinfo.getAttrCertValidityPeriod() ;
    attributes =        acinfo.getAttributes() ;
    issuerUniqueID =        acinfo.getIssuerUniqueID() ; // OPTIONAL
    extensions =        acinfo.getExtensions() ; // OPTIONAL

}
项目:ipack    文件:X509V2AttributeCertificateGenerator.java   
/**
 * generate an X509 certificate, based on the current issuer and subject,
 * using the passed in provider for the signing and the supplied source
 * of randomness, if required.
 */
public X509AttributeCertificate generate(
    PrivateKey      key,
    String          provider,
    SecureRandom    random)
    throws CertificateEncodingException, IllegalStateException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, InvalidKeyException
{
    if (!extGenerator.isEmpty())
    {
        acInfoGen.setExtensions(extGenerator.generate());
    }

    AttributeCertificateInfo acInfo = acInfoGen.generateAttributeCertificateInfo();

    ASN1EncodableVector  v = new ASN1EncodableVector();

    v.add(acInfo);
    v.add(sigAlgId);

    try
    {
        v.add(new DERBitString(X509Util.calculateSignature(sigOID, signatureAlgorithm, provider, key, random, acInfo)));

        return new X509V2AttributeCertificate(new AttributeCertificate(new DERSequence(v)));
    }
    catch (IOException e)
    {
        throw new ExtCertificateEncodingException("constructed invalid certificate", e);
    }
}
项目:ipack    文件:CertUtils.java   
private static AttributeCertificate generateAttrStructure(AttributeCertificateInfo attrInfo, AlgorithmIdentifier sigAlgId, byte[] signature)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(attrInfo);
    v.add(sigAlgId);
    v.add(new DERBitString(signature));

    return AttributeCertificate.getInstance(new DERSequence(v));
}
项目:ipack    文件:SignerAttribute.java   
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++;
    }
}
项目:gwt-crypto    文件:CertUtils.java   
private static AttributeCertificate generateAttrStructure(AttributeCertificateInfo attrInfo, AlgorithmIdentifier sigAlgId, byte[] signature)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(attrInfo);
    v.add(sigAlgId);
    v.add(new DERBitString(signature));

    return AttributeCertificate.getInstance(new DERSequence(v));
}
项目:gwt-crypto    文件:SignerAttribute.java   
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++;
    }
}
项目:Aki-SSL    文件:CertUtils.java   
private static AttributeCertificate generateAttrStructure(AttributeCertificateInfo attrInfo, AlgorithmIdentifier sigAlgId, byte[] signature)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(attrInfo);
    v.add(sigAlgId);
    v.add(new DERBitString(signature));

    return AttributeCertificate.getInstance(new DERSequence(v));
}
项目:Aki-SSL    文件:SignerAttribute.java   
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++;
    }
}
项目:TinyTravelTracker    文件:SignerAttribute.java   
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++;
    }
}
项目:CryptMeme    文件:X509V2AttributeCertificateGenerator.java   
/**
 * generate an X509 certificate, based on the current issuer and subject,
 * using the passed in provider for the signing and the supplied source
 * of randomness, if required.
 */
public X509AttributeCertificate generate(
    PrivateKey      key,
    String          provider,
    SecureRandom    random)
    throws CertificateEncodingException, IllegalStateException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, InvalidKeyException
{
    if (!extGenerator.isEmpty())
    {
        acInfoGen.setExtensions(extGenerator.generate());
    }

    AttributeCertificateInfo acInfo = acInfoGen.generateAttributeCertificateInfo();

    ASN1EncodableVector  v = new ASN1EncodableVector();

    v.add(acInfo);
    v.add(sigAlgId);

    try
    {
        v.add(new DERBitString(X509Util.calculateSignature(sigOID, signatureAlgorithm, provider, key, random, acInfo)));

        return new X509V2AttributeCertificate(new AttributeCertificate(new DERSequence(v)));
    }
    catch (IOException e)
    {
        throw new ExtCertificateEncodingException("constructed invalid certificate", e);
    }
}
项目:CryptMeme    文件:SignerAttribute.java   
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++;
    }
}
项目:irma_future_id    文件:CertUtils.java   
private static AttributeCertificate generateAttrStructure(AttributeCertificateInfo attrInfo, AlgorithmIdentifier sigAlgId, byte[] signature)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(attrInfo);
    v.add(sigAlgId);
    v.add(new DERBitString(signature));

    return AttributeCertificate.getInstance(new DERSequence(v));
}
项目:irma_future_id    文件:CertUtils.java   
private static AttributeCertificate generateAttrStructure(AttributeCertificateInfo attrInfo, AlgorithmIdentifier sigAlgId, byte[] signature)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(attrInfo);
    v.add(sigAlgId);
    v.add(new DERBitString(signature));

    return AttributeCertificate.getInstance(new DERSequence(v));
}