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

项目:ipack    文件:DSTU4145ECBinary.java   
/**
 * ECBinary  ::= SEQUENCE {
 * version          [0] EXPLICIT INTEGER    DEFAULT 0,
 * f     BinaryField,
 * a    INTEGER (0..1),
 * b    OCTET STRING,
 * n    INTEGER,
 * bp    OCTET STRING}
 */
public ASN1Primitive toASN1Primitive()
{

    ASN1EncodableVector v = new ASN1EncodableVector();

    if (0 != version.compareTo(BigInteger.valueOf(0)))
    {
        v.add(new DERTaggedObject(true, 0, new ASN1Integer(version)));
    }
    v.add(f);
    v.add(a);
    v.add(b);
    v.add(n);
    v.add(bp);

    return new DERSequence(v);
}
项目:keepass2android    文件:SignedData.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 *  SignedData ::= SEQUENCE {
 *      version Version,
 *      digestAlgorithms DigestAlgorithmIdentifiers,
 *      contentInfo ContentInfo,
 *      certificates
 *          [0] IMPLICIT ExtendedCertificatesAndCertificates
 *                   OPTIONAL,
 *      crls
 *          [1] IMPLICIT CertificateRevocationLists OPTIONAL,
 *      signerInfos SignerInfos }
 * </pre>
 */
public DERObject toASN1Object()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(version);
    v.add(digestAlgorithms);
    v.add(contentInfo);

    if (certificates != null)
    {
        v.add(new DERTaggedObject(false, 0, certificates));
    }

    if (crls != null)
    {
        v.add(new DERTaggedObject(false, 1, crls));
    }

    v.add(signerInfos);

    return new BERSequence(v);
}
项目:ipack    文件:SingleResponse.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 *  SingleResponse ::= SEQUENCE {
 *          certID                       CertID,
 *          certStatus                   CertStatus,
 *          thisUpdate                   GeneralizedTime,
 *          nextUpdate         [0]       EXPLICIT GeneralizedTime OPTIONAL,
 *          singleExtensions   [1]       EXPLICIT Extensions OPTIONAL }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(certID);
    v.add(certStatus);
    v.add(thisUpdate);

    if (nextUpdate != null)
    {
        v.add(new DERTaggedObject(true, 0, nextUpdate));
    }

    if (singleExtensions != null)
    {
        v.add(new DERTaggedObject(true, 1, singleExtensions));
    }

    return new DERSequence(v);
}
项目:ipack    文件:ECDHKEKGenerator.java   
public int generateBytes(byte[] out, int outOff, int len)
    throws DataLengthException, IllegalArgumentException
{
    // TODO Create an ASN.1 class for this (RFC3278)
    // ECC-CMS-SharedInfo
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(new AlgorithmIdentifier(algorithm, DERNull.INSTANCE));
    v.add(new DERTaggedObject(true, 2, new DEROctetString(Pack.intToBigEndian(keySize))));

    try
    {
        kdf.init(new KDFParameters(z, new DERSequence(v).getEncoded(ASN1Encoding.DER)));
    }
    catch (IOException e)
    {
        throw new IllegalArgumentException("unable to initialise kdf: " + e.getMessage());
    }

    return kdf.generateBytes(out, outOff, len);
}
项目:ipack    文件:ECPrivateKey.java   
public ECPrivateKey(
    BigInteger key,
    DERBitString publicKey,
    ASN1Object parameters)
{
    byte[] bytes = BigIntegers.asUnsignedByteArray(key);

    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(new ASN1Integer(1));
    v.add(new DEROctetString(bytes));

    if (parameters != null)
    {
        v.add(new DERTaggedObject(true, 0, parameters));
    }

    if (publicKey != null)
    {
        v.add(new DERTaggedObject(true, 1, publicKey));
    }

    seq = new DERSequence(v);
}
项目:ipack    文件:ECPrivateKeyStructure.java   
public ECPrivateKeyStructure(
    BigInteger    key,
    DERBitString  publicKey,
    ASN1Encodable parameters)
{
    byte[] bytes = BigIntegers.asUnsignedByteArray(key);

    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(new ASN1Integer(1));
    v.add(new DEROctetString(bytes));

    if (parameters != null)
    {
        v.add(new DERTaggedObject(true, 0, parameters));
    }

    if (publicKey != null)
    {
        v.add(new DERTaggedObject(true, 1, publicKey));
    }

    seq = new DERSequence(v);
}
项目:ipack    文件:DistributionPoint.java   
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    if (distributionPoint != null)
    {
        //
        // as this is a CHOICE it must be explicitly tagged
        //
        v.add(new DERTaggedObject(0, distributionPoint));
    }

    if (reasons != null)
    {
        v.add(new DERTaggedObject(false, 1, reasons));
    }

    if (cRLIssuer != null)
    {
        v.add(new DERTaggedObject(false, 2, cRLIssuer));
    }

    return new DERSequence(v);
}
项目:ipack    文件:V2Form.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 *  V2Form ::= SEQUENCE {
 *       issuerName            GeneralNames  OPTIONAL,
 *       baseCertificateID     [0] IssuerSerial  OPTIONAL,
 *       objectDigestInfo      [1] ObjectDigestInfo  OPTIONAL
 *         -- issuerName MUST be present in this profile
 *         -- baseCertificateID and objectDigestInfo MUST NOT
 *         -- be present in this profile
 *  }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    if (issuerName != null)
    {
        v.add(issuerName);
    }

    if (baseCertificateID != null)
    {
        v.add(new DERTaggedObject(false, 0, baseCertificateID));
    }

    if (objectDigestInfo != null)
    {
        v.add(new DERTaggedObject(false, 1, objectDigestInfo));
    }

    return new DERSequence(v);
}
项目:ipack    文件:CertifiedKeyPair.java   
/**
 * <pre>
 * CertifiedKeyPair ::= SEQUENCE {
 *                                  certOrEncCert       CertOrEncCert,
 *                                  privateKey      [0] EncryptedValue      OPTIONAL,
 *                                  -- see [CRMF] for comment on encoding
 *                                  publicationInfo [1] PKIPublicationInfo  OPTIONAL
 *       }
 * </pre>
 * @return a basic ASN.1 object representation.
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(certOrEncCert);

    if (privateKey != null)
    {
        v.add(new DERTaggedObject(true, 0, privateKey));
    }

    if (publicationInfo != null)
    {
        v.add(new DERTaggedObject(true, 1, publicationInfo));
    }

    return new DERSequence(v);
}
项目:ipack    文件:ResponseData.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 * ResponseData ::= SEQUENCE {
 *     version              [0] EXPLICIT Version DEFAULT v1,
 *     responderID              ResponderID,
 *     producedAt               GeneralizedTime,
 *     responses                SEQUENCE OF SingleResponse,
 *     responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (versionPresent || !version.equals(V1))
    {
        v.add(new DERTaggedObject(true, 0, version));
    }

    v.add(responderID);
    v.add(producedAt);
    v.add(responses);
    if (responseExtensions != null)
    {
        v.add(new DERTaggedObject(true, 1, responseExtensions));
    }

    return new DERSequence(v);
}
项目:ipack    文件:IetfAttrSyntax.java   
/**
 * 
 * <pre>
 * 
 *  IetfAttrSyntax ::= SEQUENCE {
 *    policyAuthority [0] GeneralNames OPTIONAL,
 *    values SEQUENCE OF CHOICE {
 *      octets OCTET STRING,
 *      oid OBJECT IDENTIFIER,
 *      string UTF8String
 *    }
 *  }
 *  
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (policyAuthority != null)
    {
        v.add(new DERTaggedObject(0, policyAuthority));
    }

    ASN1EncodableVector v2 = new ASN1EncodableVector();

    for (Enumeration i = values.elements(); i.hasMoreElements();)
    {
        v2.add((ASN1Encodable)i.nextElement());
    }

    v.add(new DERSequence(v2));

    return new DERSequence(v);
}
项目:ipack    文件:GeneralSubtree.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * 
 * Returns:
 * 
 * <pre>
 *       GeneralSubtree ::= SEQUENCE 
 *       {
 *         base                    GeneralName,
 *         minimum         [0]     BaseDistance DEFAULT 0,
 *         maximum         [1]     BaseDistance OPTIONAL 
 *       }
 * </pre>
 * 
 * @return a ASN1Primitive
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(base);

    if (minimum != null && !minimum.getValue().equals(ZERO))
    {
        v.add(new DERTaggedObject(false, 0, minimum));
    }

    if (maximum != null)
    {
        v.add(new DERTaggedObject(false, 1, maximum));
    }

    return new DERSequence(v);
}
项目:ipack    文件:CMSUtils.java   
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
项目:ipack    文件:NameConstraints.java   
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (permitted != null)
    {
        v.add(new DERTaggedObject(false, 0, new DERSequence(permitted)));
    }

    if (excluded != null)
    {
        v.add(new DERTaggedObject(false, 1, new DERSequence(excluded)));
    }

    return new DERSequence(v);
}
项目:ipack    文件:OtherInfo.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 *  OtherInfo ::= SEQUENCE {
 *      keyInfo KeySpecificInfo,
 *      partyAInfo [0] OCTET STRING OPTIONAL,
 *      suppPubInfo [2] OCTET STRING
 *  }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    v.add(keyInfo);

    if (partyAInfo != null)
    {
        v.add(new DERTaggedObject(0, partyAInfo));
    }

    v.add(new DERTaggedObject(2, suppPubInfo));

    return new DERSequence(v);
}
项目:ipack    文件:CMSSignedDataParser.java   
private static void writeSetToGeneratorTagged(
    ASN1Generator asn1Gen,
    ASN1SetParser asn1SetParser,
    int           tagNo)
    throws IOException
{
    ASN1Set asn1Set = getASN1Set(asn1SetParser);

    if (asn1Set != null)
    {
        if (asn1SetParser instanceof BERSetParser)
        {
            asn1Gen.getRawOutputStream().write(new BERTaggedObject(false, tagNo, asn1Set).getEncoded());
        }
        else
        {
            asn1Gen.getRawOutputStream().write(new DERTaggedObject(false, tagNo, asn1Set).getEncoded());
        }
    }
}
项目:ipack    文件:SignerLocation.java   
/**
 * <pre>
 *   SignerLocation ::= SEQUENCE {
 *       countryName        [0] DirectoryString OPTIONAL,
 *       localityName       [1] DirectoryString OPTIONAL,
 *       postalAddress      [2] PostalAddress OPTIONAL }
 *
 *   PostalAddress ::= SEQUENCE SIZE(1..6) OF DirectoryString
 *   
 *   DirectoryString ::= CHOICE {
 *         teletexString           TeletexString (SIZE (1..MAX)),
 *         printableString         PrintableString (SIZE (1..MAX)),
 *         universalString         UniversalString (SIZE (1..MAX)),
 *         utf8String              UTF8String (SIZE (1.. MAX)),
 *         bmpString               BMPString (SIZE (1..MAX)) }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    if (countryName != null)
    {
        v.add(new DERTaggedObject(true, 0, countryName));
    }

    if (localityName != null)
    {
        v.add(new DERTaggedObject(true, 1, localityName));
    }

    if (postalAddress != null)
    {
        v.add(new DERTaggedObject(true, 2, postalAddress));
    }

    return new DERSequence(v);
}
项目: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    文件:RevocationValues.java   
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();
    if (null != this.crlVals)
    {
        v.add(new DERTaggedObject(true, 0, this.crlVals));
    }
    if (null != this.ocspVals)
    {
        v.add(new DERTaggedObject(true, 1, this.ocspVals));
    }
    if (null != this.otherRevVals)
    {
        v.add(new DERTaggedObject(true, 2, this.otherRevVals.toASN1Primitive()));
    }
    return new DERSequence(v);
}
项目:ipack    文件:CrlOcspRef.java   
private CrlOcspRef(ASN1Sequence seq)
{
    Enumeration e = seq.getObjects();
    while (e.hasMoreElements())
    {
        DERTaggedObject o = (DERTaggedObject)e.nextElement();
        switch (o.getTagNo())
        {
            case 0:
                this.crlids = CrlListID.getInstance(o.getObject());
                break;
            case 1:
                this.ocspids = OcspListID.getInstance(o.getObject());
                break;
            case 2:
                this.otherRev = OtherRevRefs.getInstance(o.getObject());
                break;
            default:
                throw new IllegalArgumentException("illegal tag");
        }
    }
}
项目:ipack    文件:CrlOcspRef.java   
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();
    if (null != this.crlids)
    {
        v.add(new DERTaggedObject(true, 0, this.crlids.toASN1Primitive()));
    }
    if (null != this.ocspids)
    {
        v.add(new DERTaggedObject(true, 1, this.ocspids.toASN1Primitive()));
    }
    if (null != this.otherRev)
    {
        v.add(new DERTaggedObject(true, 2, this.otherRev.toASN1Primitive()));
    }
    return new DERSequence(v);
}
项目:ipack    文件:POPOSigningKeyInput.java   
/**
 * <pre>
 * POPOSigningKeyInput ::= SEQUENCE {
 *        authInfo             CHOICE {
 *                                 sender              [0] GeneralName,
 *                                 -- used only if an authenticated identity has been
 *                                 -- established for the sender (e.g., a DN from a
 *                                 -- previously-issued and currently-valid certificate
 *                                 publicKeyMAC        PKMACValue },
 *                                 -- used if no authenticated GeneralName currently exists for
 *                                 -- the sender; publicKeyMAC contains a password-based MAC
 *                                 -- on the DER-encoded value of publicKey
 *        publicKey           SubjectPublicKeyInfo }  -- from CertTemplate
 * </pre>
 * @return a basic ASN.1 object representation.
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (sender != null)
    {
        v.add(new DERTaggedObject(false, 0, sender));
    }
    else
    {
        v.add(publicKeyMAC);
    }

    v.add(publicKey);

    return new DERSequence(v);
}
项目:ipack    文件:SignerInfo.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 *  SignerInfo ::= SEQUENCE {
 *      version Version,
 *      issuerAndSerialNumber IssuerAndSerialNumber,
 *      digestAlgorithm DigestAlgorithmIdentifier,
 *      authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
 *      digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
 *      encryptedDigest EncryptedDigest,
 *      unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
 *  }
 *
 *  EncryptedDigest ::= OCTET STRING
 *
 *  DigestAlgorithmIdentifier ::= AlgorithmIdentifier
 *
 *  DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(version);
    v.add(issuerAndSerialNumber);
    v.add(digAlgorithm);

    if (authenticatedAttributes != null)
    {
        v.add(new DERTaggedObject(false, 0, authenticatedAttributes));
    }

    v.add(digEncryptionAlgorithm);
    v.add(encryptedDigest);

    if (unauthenticatedAttributes != null)
    {
        v.add(new DERTaggedObject(false, 1, unauthenticatedAttributes));
    }

    return new DERSequence(v);
}
项目: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    文件:SignedData.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 *  SignedData ::= SEQUENCE {
 *      version Version,
 *      digestAlgorithms DigestAlgorithmIdentifiers,
 *      contentInfo ContentInfo,
 *      certificates
 *          [0] IMPLICIT ExtendedCertificatesAndCertificates
 *                   OPTIONAL,
 *      crls
 *          [1] IMPLICIT CertificateRevocationLists OPTIONAL,
 *      signerInfos SignerInfos }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(version);
    v.add(digestAlgorithms);
    v.add(contentInfo);

    if (certificates != null)
    {
        v.add(new DERTaggedObject(false, 0, certificates));
    }

    if (crls != null)
    {
        v.add(new DERTaggedObject(false, 1, crls));
    }

    v.add(signerInfos);

    return new BERSequence(v);
}
项目: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    文件:KeyAgreeRecipientInfo.java   
/** 
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 * KeyAgreeRecipientInfo ::= SEQUENCE {
 *     version CMSVersion,  -- always set to 3
 *     originator [0] EXPLICIT OriginatorIdentifierOrKey,
 *     ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
 *     keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
 *     recipientEncryptedKeys RecipientEncryptedKeys 
 * }
 *
 * UserKeyingMaterial ::= OCTET STRING
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    v.add(version);
    v.add(new DERTaggedObject(true, 0, originator));

    if (ukm != null)
    {
        v.add(new DERTaggedObject(true, 1, ukm));
    }

    v.add(keyEncryptionAlgorithm);
    v.add(recipientEncryptedKeys);

    return new DERSequence(v);
}
项目:ipack    文件:OriginatorInfo.java   
/** 
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 * OriginatorInfo ::= SEQUENCE {
 *     certs [0] IMPLICIT CertificateSet OPTIONAL,
 *     crls [1] IMPLICIT CertificateRevocationLists OPTIONAL 
 * }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    if (certs != null)
    {
        v.add(new DERTaggedObject(false, 0, certs));
    }

    if (crls != null)
    {
        v.add(new DERTaggedObject(false, 1, crls));
    }

    return new DERSequence(v);
}
项目:ipack    文件:PasswordRecipientInfo.java   
/** 
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 * PasswordRecipientInfo ::= SEQUENCE {
 *   version CMSVersion,   -- Always set to 0
 *   keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier
 *                             OPTIONAL,
 *  keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
 *  encryptedKey EncryptedKey }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    v.add(version);

    if (keyDerivationAlgorithm != null)
    {
        v.add(new DERTaggedObject(false, 0, keyDerivationAlgorithm));
    }
    v.add(keyEncryptionAlgorithm);
    v.add(encryptedKey);

    return new DERSequence(v);
}
项目:ipack    文件:RevRepContentBuilder.java   
public RevRepContent build()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(new DERSequence(status));

    if (revCerts.size() != 0)
    {
        v.add(new DERTaggedObject(true, 0, new DERSequence(revCerts)));
    }

    if (crls.size() != 0)
    {
        v.add(new DERTaggedObject(true, 1, new DERSequence(crls)));
    }

    return RevRepContent.getInstance(new DERSequence(v));
}
项目:ipack    文件:Accuracy.java   
/**
 * <pre>
 * Accuracy ::= SEQUENCE {
 *             seconds        INTEGER              OPTIONAL,
 *             millis     [0] INTEGER  (1..999)    OPTIONAL,
 *             micros     [1] INTEGER  (1..999)    OPTIONAL
 *             }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{

    ASN1EncodableVector v = new ASN1EncodableVector();

    if (seconds != null)
    {
        v.add(seconds);
    }

    if (millis != null)
    {
        v.add(new DERTaggedObject(false, 0, millis));
    }

    if (micros != null)
    {
        v.add(new DERTaggedObject(false, 1, micros));
    }

    return new DERSequence(v);
}
项目: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    文件:SafeBag.java   
public DERObject toASN1Object()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(bagId);
    v.add(new DERTaggedObject(0, bagValue));

    if (bagAttributes != null)
    {
        v.add(bagAttributes);
    }

    return new DERSequence(v);
}
项目:keepass2android    文件:CertBag.java   
public CertBag(
    ASN1Sequence    seq)
{
    this.seq = seq;
    this.certId = (DERObjectIdentifier)seq.getObjectAt(0);
    this.certValue = ((DERTaggedObject)seq.getObjectAt(1)).getObject();
}
项目:keepass2android    文件:ContentInfo.java   
public ContentInfo(
    ASN1Sequence  seq)
{
    Enumeration   e = seq.getObjects();

    contentType = (DERObjectIdentifier)e.nextElement();

    if (e.hasMoreElements())
    {
        content = ((DERTaggedObject)e.nextElement()).getObject();
    }
}
项目:ipack    文件:CertRepMessage.java   
/**
 * <pre>
 * CertRepMessage ::= SEQUENCE {
 *                          caPubs       [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
 *                                                                             OPTIONAL,
 *                          response         SEQUENCE OF CertResponse
 * }
 * </pre>
 * @return a basic ASN.1 object representation.
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (caPubs != null)
    {
        v.add(new DERTaggedObject(true, 1, caPubs));
    }

    v.add(response);

    return new DERSequence(v);
}
项目:ipack    文件:CertEtcToken.java   
public ASN1Primitive toASN1Primitive()
{
    if (extension == null)
    {
        return new DERTaggedObject(explicit[tagNo], tagNo, value);
    }
    else
    {
        return extension.toASN1Primitive();
    }
}
项目:ipack    文件:TBSRequest.java   
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 * TBSRequest      ::=     SEQUENCE {
 *     version             [0]     EXPLICIT Version DEFAULT v1,
 *     requestorName       [1]     EXPLICIT GeneralName OPTIONAL,
 *     requestList                 SEQUENCE OF Request,
 *     requestExtensions   [2]     EXPLICIT Extensions OPTIONAL }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector    v = new ASN1EncodableVector();

    //
    // if default don't include - unless explicitly provided. Not strictly correct
    // but required for some requests
    //
    if (!version.equals(V1) || versionSet)
    {
        v.add(new DERTaggedObject(true, 0, version));
    }

    if (requestorName != null)
    {
        v.add(new DERTaggedObject(true, 1, requestorName));
    }

    v.add(requestList);

    if (requestExtensions != null)
    {
        v.add(new DERTaggedObject(true, 2, requestExtensions));
    }

    return new DERSequence(v);
}
项目:ipack    文件:V2TBSCertListGenerator.java   
public TBSCertList generateTBSCertList()
{
    if ((signature == null) || (issuer == null) || (thisUpdate == null))
    {
        throw new IllegalStateException("Not all mandatory fields set in V2 TBSCertList generator.");
    }

    ASN1EncodableVector  v = new ASN1EncodableVector();

    v.add(version);
    v.add(signature);
    v.add(issuer);

    v.add(thisUpdate);
    if (nextUpdate != null)
    {
        v.add(nextUpdate);
    }

    // Add CRLEntries if they exist
    if (crlentries.size() != 0)
    {
        v.add(new DERSequence(crlentries));
    }

    if (extensions != null)
    {
        v.add(new DERTaggedObject(0, extensions));
    }

    return new TBSCertList(new DERSequence(v));
}
项目:ipack    文件:TargetEtcChain.java   
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(target);
    if (chain != null)
    {
        v.add(chain);
    }
    if (pathProcInput != null)
    {
        v.add(new DERTaggedObject(false, 0, pathProcInput));
    }

    return new DERSequence(v);
}