當前位置: 首頁>>代碼示例>>Java>>正文


Java DERTaggedObject類代碼示例

本文整理匯總了Java中org.bouncycastle.asn1.DERTaggedObject的典型用法代碼示例。如果您正苦於以下問題:Java DERTaggedObject類的具體用法?Java DERTaggedObject怎麽用?Java DERTaggedObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DERTaggedObject類屬於org.bouncycastle.asn1包,在下文中一共展示了DERTaggedObject類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:27,代碼來源:DSTU4145ECBinary.java

示例2: toASN1Object

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:38,代碼來源:SignedData.java

示例3: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:32,代碼來源:SingleResponse.java

示例4: generateBytes

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:22,代碼來源:ECDHKEKGenerator.java

示例5: ECPrivateKeyStructure

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:25,代碼來源:ECPrivateKeyStructure.java

示例6: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:25,代碼來源:DistributionPoint.java

示例7: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:35,代碼來源:V2Form.java

示例8: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * <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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:30,代碼來源:CertifiedKeyPair.java

示例9: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:31,代碼來源:ResponseData.java

示例10: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 
 * <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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:36,代碼來源:IetfAttrSyntax.java

示例11: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:35,代碼來源:GeneralSubtree.java

示例12: getOthersFromStore

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
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;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:24,代碼來源:CMSUtils.java

示例13: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:17,代碼來源:NameConstraints.java

示例14: toASN1Primitive

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:26,代碼來源:OtherInfo.java

示例15: writeSetToGeneratorTagged

import org.bouncycastle.asn1.DERTaggedObject; //導入依賴的package包/類
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());
        }
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:21,代碼來源:CMSSignedDataParser.java


注:本文中的org.bouncycastle.asn1.DERTaggedObject類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。