Java 类org.bouncycastle.asn1.ASN1Set 实例源码

项目:ipack    文件:OriginatorInformation.java   
/**
 * 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());
}
项目:ipack    文件:CMSAuthenticatedDataParser.java   
private ASN1Set getAuthAttrSet()
    throws IOException
{
    if (authAttrs == null && authAttrNotRead)
    {
        ASN1SetParser set = authData.getAuthAttrs();

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

        authAttrNotRead = false;
    }

    return authAttrSet;
}
项目:ipack    文件:PKCS12SafeBag.java   
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;
}
项目:ipack    文件:PKCS10CertificationRequest.java   
/**
 * 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;
}
项目:ipack    文件:CscaMasterList.java   
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));
    }
}
项目:ipack    文件:SignerInfo.java   
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;
}
项目:ipack    文件:CertificationRequestInfo.java   
/**
 * @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.");
    }
}
项目:ipack    文件:CMSEnvelopedDataStreamGenerator.java   
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();
}
项目:ipack    文件:PrivateKeyInfo.java   
/**
 * @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);
    }
}
项目:ipack    文件:SignerInfo.java   
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;
}
项目:ipack    文件:SignerInfo.java   
public SignerInfo(
    SignerIdentifier        sid,
    AlgorithmIdentifier     digAlgorithm,
    Attributes              authenticatedAttributes,
    AlgorithmIdentifier     digEncryptionAlgorithm,
    ASN1OctetString         encryptedDigest,
    Attributes              unauthenticatedAttributes)
{
    if (sid.isTagged())
    {
        this.version = new ASN1Integer(3);
    }
    else
    {
        this.version = new ASN1Integer(1);
    }

    this.sid = sid;
    this.digAlgorithm = digAlgorithm;
    this.authenticatedAttributes = ASN1Set.getInstance(authenticatedAttributes);
    this.digEncryptionAlgorithm = digEncryptionAlgorithm;
    this.encryptedDigest = encryptedDigest;
    this.unauthenticatedAttributes = ASN1Set.getInstance(unauthenticatedAttributes);
}
项目:ipack    文件:EnvelopedData.java   
/**
 * @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);
    }
}
项目:ipack    文件:SignedData.java   
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;
}
项目:Websocket-Smart-Card-Signer    文件:CMSSignedDataWrapper.java   
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;
}
项目:ipack    文件:CMSSignedHelper.java   
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());
}
项目: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());
}
项目:ipack    文件:CMSSignedHelper.java   
Store getCRLs(ASN1Set crlSet)
{
    if (crlSet != null)
    {
        List crlList = new ArrayList(crlSet.size());

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

            if (obj instanceof ASN1Sequence)
            {
                crlList.add(new X509CRLHolder(CertificateList.getInstance(obj)));
            }
        }

        return new CollectionStore(crlList);
    }

    return new CollectionStore(new ArrayList());
}
项目:ipack    文件:CMSEnvelopedDataParser.java   
public CMSEnvelopedDataParser(
    InputStream    envelopedData) 
    throws CMSException, IOException
{
    super(envelopedData);

    this.attrNotRead = true;
    this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));

    // TODO Validate version?
    //DERInteger version = this._envelopedData.getVersion();

    OriginatorInfo info = this.envelopedData.getOriginatorInfo();

    if (info != null)
    {
        this.originatorInfo = new OriginatorInformation(info);
    }

    //
    // read the recipients
    //
    ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());

    //
    // read the encrypted content info
    //
    EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
    this.encAlg = encInfo.getContentEncryptionAlgorithm();
    CMSReadable readable = new CMSProcessableInputStream(
        ((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
    CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
        this.encAlg, readable);

    //
    // build the RecipientInformationStore
    //
    this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
        recipientInfos, this.encAlg, secureReadable);
}
项目:keepass2android    文件:Attribute.java   
public Attribute(
    DERObjectIdentifier attrType,
    ASN1Set             attrValues)
{
    this.attrType = attrType;
    this.attrValues = attrValues;
}
项目:keepass2android    文件:SafeBag.java   
public SafeBag(
    DERObjectIdentifier     oid,
    DERObject               obj,
    ASN1Set                 bagAttributes)
{
    this.bagId = oid;
    this.bagValue = obj;
    this.bagAttributes = bagAttributes;
}
项目:keepass2android    文件:SafeBag.java   
public SafeBag(
    ASN1Sequence    seq)
{
    this.bagId = (DERObjectIdentifier)seq.getObjectAt(0);
    this.bagValue = ((DERTaggedObject)seq.getObjectAt(1)).getObject();
    if (seq.size() == 3)
    {
        this.bagAttributes = (ASN1Set)seq.getObjectAt(2);
    }
}
项目:keepass2android    文件:SignedData.java   
public SignedData(
    DERInteger        _version,
    ASN1Set           _digestAlgorithms,
    ContentInfo       _contentInfo,
    ASN1Set           _certificates,
    ASN1Set           _crls,
    ASN1Set           _signerInfos)
{
    version          = _version;
    digestAlgorithms = _digestAlgorithms;
    contentInfo      = _contentInfo;
    certificates     = _certificates;
    crls             = _crls;
    signerInfos      = _signerInfos;
}
项目:ipack    文件:CMSUtils.java   
static ASN1Set createBerSetFromList(List derObjects)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    for (Iterator it = derObjects.iterator(); it.hasNext();)
    {
        v.add((ASN1Encodable)it.next());
    }

    return new BERSet(v);
}
项目:ipack    文件:X509Attribute.java   
public ASN1Encodable[] getValues()
{
    ASN1Set         s = attr.getAttrValues();
    ASN1Encodable[] values = new ASN1Encodable[s.size()];

    for (int i = 0; i != s.size(); i++)
    {
        values[i] = (ASN1Encodable)s.getObjectAt(i);
    }

    return values;
}
项目:ipack    文件:PKCS10CertificationRequest.java   
/**
 * create a PKCS10 certfication request using the BC provider.
 */
public PKCS10CertificationRequest(
    String              signatureAlgorithm,
    X509Name            subject,
    PublicKey           key,
    ASN1Set             attributes,
    PrivateKey          signingKey)
    throws NoSuchAlgorithmException, NoSuchProviderException,
            InvalidKeyException, SignatureException
{
    this(signatureAlgorithm, subject, key, attributes, signingKey, BouncyCastleProvider.PROVIDER_NAME);
}
项目:ipack    文件:PKCS10CertificationRequest.java   
/**
 * create a PKCS10 certfication request using the named provider.
 */
public PKCS10CertificationRequest(
    String              signatureAlgorithm,
    X500Principal       subject,
    PublicKey           key,
    ASN1Set             attributes,
    PrivateKey          signingKey,
    String              provider)
    throws NoSuchAlgorithmException, NoSuchProviderException,
            InvalidKeyException, SignatureException
{
    this(signatureAlgorithm, convertName(subject), key, attributes, signingKey, provider);
}
项目:ipack    文件:PKCS10CertificationRequest.java   
/**
 * 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)
{
    ASN1Set    attrSet = certificationRequest.getCertificationRequestInfo().getAttributes();

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

    List list = new ArrayList();

    for (int i = 0; i != attrSet.size(); i++)
    {
        Attribute attr = Attribute.getInstance(attrSet.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()]);
}
项目:ipack    文件:Attribute.java   
private Attribute(
    ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: " + seq.size());
    }

    attrType = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
    attrValues = ASN1Set.getInstance(seq.getObjectAt(1));
}
项目:ipack    文件:Attribute.java   
public Attribute(
    ASN1ObjectIdentifier attrType,
    ASN1Set             attrValues)
{
    this.attrType = attrType;
    this.attrValues = attrValues;
}
项目:ipack    文件:DistributionPointName.java   
public DistributionPointName(
    ASN1TaggedObject    obj)
{
    this.type = obj.getTagNo();

    if (type == 0)
    {
        this.name = GeneralNames.getInstance(obj, false);
    }
    else
    {
        this.name = ASN1Set.getInstance(obj, false);
    }
}
项目:ipack    文件:SignerInfo.java   
public SignerInfo(
    ASN1Sequence seq)
{
    Enumeration     e = seq.getObjects();

    version = (ASN1Integer)e.nextElement();
    issuerAndSerialNumber = IssuerAndSerialNumber.getInstance(e.nextElement());
    digAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement());

    Object obj = e.nextElement();

    if (obj instanceof ASN1TaggedObject)
    {
        authenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)obj, false);

        digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement());
    }
    else
    {
        authenticatedAttributes = null;
        digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(obj);
    }

    encryptedDigest = DEROctetString.getInstance(e.nextElement());

    if (e.hasMoreElements())
    {
        unauthenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false);
    }
    else
    {
        unauthenticatedAttributes = null;
    }
}
项目:ipack    文件:SignerInformation.java   
private ASN1Primitive getSingleValuedSignedAttribute(
    ASN1ObjectIdentifier attrOID, String printableName)
    throws CMSException
{
    AttributeTable unsignedAttrTable = this.getUnsignedAttributes();
    if (unsignedAttrTable != null
        && unsignedAttrTable.getAll(attrOID).size() > 0)
    {
        throw new CMSException("The " + printableName
            + " attribute MUST NOT be an unsigned attribute");
    }

    AttributeTable signedAttrTable = this.getSignedAttributes();
    if (signedAttrTable == null)
    {
        return null;
    }

    ASN1EncodableVector v = signedAttrTable.getAll(attrOID);
    switch (v.size())
    {
        case 0:
            return null;
        case 1:
        {
            Attribute t = (Attribute)v.get(0);
            ASN1Set attrValues = t.getAttrValues();
            if (attrValues.size() != 1)
            {
                throw new CMSException("A " + printableName
                    + " attribute MUST have a single attribute value");
            }

            return attrValues.getObjectAt(0).toASN1Primitive();
        }
        default:
            throw new CMSException("The SignedAttributes in a signerInfo MUST NOT include multiple instances of the "
                + printableName + " attribute");
    }
}
项目:ipack    文件:CertificationRequestInfo.java   
/**
 * @deprecated use X500Name method.
 */
public CertificationRequestInfo(
    X509Name                subject,
    SubjectPublicKeyInfo    pkInfo,
    ASN1Set                 attributes)
{
    this.subject = X500Name.getInstance(subject.toASN1Primitive());
    this.subjectPKInfo = pkInfo;
    this.attributes = attributes;

    if ((subject == null) || (version == null) || (subjectPKInfo == null))
    {
        throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
    }
}
项目:ipack    文件:SignerInfoGenerator.java   
private ASN1Set getAttributeSet(
    AttributeTable attr)
{
    if (attr != null)
    {
        return new DERSet(attr.toASN1EncodableVector());
    }

    return null;
}
项目:ipack    文件:Attribute.java   
public Attribute(
    ASN1ObjectIdentifier attrType,
    ASN1Set             attrValues)
{
    this.attrType = attrType;
    this.attrValues = attrValues;
}
项目:ipack    文件:CMSSignedGenerator.java   
protected ASN1Set getAttributeSet(
    AttributeTable attr)
{
    if (attr != null)
    {
        return new DERSet(attr.toASN1EncodableVector());
    }

    return null;
}
项目:ipack    文件:SafeBag.java   
private SafeBag(
    ASN1Sequence    seq)
{
    this.bagId = (ASN1ObjectIdentifier)seq.getObjectAt(0);
    this.bagValue = ((ASN1TaggedObject)seq.getObjectAt(1)).getObject();
    if (seq.size() == 3)
    {
        this.bagAttributes = (ASN1Set)seq.getObjectAt(2);
    }
}
项目:ipack    文件:SignedData.java   
public SignedData(
    ASN1Integer        _version,
    ASN1Set           _digestAlgorithms,
    ContentInfo       _contentInfo,
    ASN1Set           _certificates,
    ASN1Set           _crls,
    ASN1Set           _signerInfos)
{
    version          = _version;
    digestAlgorithms = _digestAlgorithms;
    contentInfo      = _contentInfo;
    certificates     = _certificates;
    crls             = _crls;
    signerInfos      = _signerInfos;
}
项目:ipack    文件:SignedData.java   
public SignedData(
    ASN1Sequence seq)
{
    Enumeration     e = seq.getObjects();

    version = (ASN1Integer)e.nextElement();
    digestAlgorithms = ((ASN1Set)e.nextElement());
    contentInfo = ContentInfo.getInstance(e.nextElement());

    while (e.hasMoreElements())
    {
        ASN1Primitive o = (ASN1Primitive)e.nextElement();

        //
        // an interesting feature of SignedData is that there appear to be varying implementations...
        // for the moment we ignore anything which doesn't fit.
        //
        if (o instanceof ASN1TaggedObject)
        {
            ASN1TaggedObject tagged = (ASN1TaggedObject)o;

            switch (tagged.getTagNo())
            {
            case 0:
                certificates = ASN1Set.getInstance(tagged, false);
                break;
            case 1:
                crls = ASN1Set.getInstance(tagged, false);
                break;
            default:
                throw new IllegalArgumentException("unknown tag value " + tagged.getTagNo());
            }
        }
        else
        {
            signerInfos = (ASN1Set)o;
        }
    }
}
项目:ipack    文件:PrivateKeyInfo.java   
public PrivateKeyInfo(
    AlgorithmIdentifier algId,
    ASN1Encodable       privateKey,
    ASN1Set             attributes)
    throws IOException
{
    this.privKey = new DEROctetString(privateKey.toASN1Primitive().getEncoded(ASN1Encoding.DER));
    this.algId = algId;
    this.attributes = attributes;
}