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


Java DERObject类代码示例

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


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

示例1: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的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

示例2: dumpAsString

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
 * Dump out the object as a string.
 *
 * @param obj  the object to be dumped
 * @param verbose  if true, dump out the contents of octet and bit strings.
 * @return  the resulting string.
 */
public static String dumpAsString(
    Object   obj,
    boolean  verbose)
{
    StringBuffer buf = new StringBuffer();

    if (obj instanceof DERObject)
    {
        _dumpAsString("", verbose, (DERObject)obj, buf);
    }
    else if (obj instanceof DEREncodable)
    {
        _dumpAsString("", verbose, ((DEREncodable)obj).getDERObject(), buf);
    }
    else
    {
        return "unknown object type " + obj.toString();
    }

    return buf.toString();
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:29,代码来源:ASN1Dump.java

示例3: convertAltNameType

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
 * Convert types returned by Bouncy Castle X509ExtensionUtil.getSubjectAlternativeNames(X509Certificate) to be
 * consistent with what is documented for: java.security.cert.X509Certificate#getSubjectAlternativeNames.
 * 
 * @param nameType the alt name type
 * @param nameValue the alt name value
 * @return converted representation of name value, based on type
 */
private static Object convertAltNameType(Integer nameType, Object nameValue) {
    Logger log = getLogger();
    if (DIRECTORY_ALT_NAME.equals(nameType) || DNS_ALT_NAME.equals(nameType) || RFC822_ALT_NAME.equals(nameType)
            || URI_ALT_NAME.equals(nameType) || REGISTERED_ID_ALT_NAME.equals(nameType)) {

        // these are just strings in the appropriate format already, return as-is
        return nameValue;
    }

    if (IP_ADDRESS_ALT_NAME.equals(nameType)) {
        // this is a byte[], IP addr in network byte order
        return IPAddressHelper.addressToString((byte[]) nameValue);
    }

    if (EDI_PARTY_ALT_NAME.equals(nameType) || X400ADDRESS_ALT_NAME.equals(nameType)
            || OTHER_ALT_NAME.equals(nameType)) {

        // these have no defined representation, just return a DER-encoded byte[]
        return ((DERObject) nameValue).getDEREncoded();
    }

    log.warn("Encountered unknown alt name type '{}', adding as-is", nameType);
    return nameValue;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:X509Util.java

示例4: extractAuthorityInformationAccess

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public static void extractAuthorityInformationAccess(List<String> OCSPUrl,
		DERObject aiaExt) {
	AuthorityInformationAccess aia = AuthorityInformationAccess
			.getInstance(aiaExt);
	AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
	DERObjectIdentifier OCSPOid = new DERObjectIdentifier(
			"1.3.6.1.5.5.7.48.1"); //$NON-NLS-1$
	for (AccessDescription accessDescription : accessDescriptions) {
		GeneralName generalName = accessDescription.getAccessLocation();
		String nextName = generalName.getName().toString();
		DERObjectIdentifier acessMethod = accessDescription
				.getAccessMethod();
		if (acessMethod.equals(OCSPOid)) {
			OCSPUrl.add(nextName);
		}
	}
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:18,代码来源:DerEncoder.java

示例5: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <p/>
 * Returns:
 * <p/>
 * <pre>
 *       CertificatePair ::= SEQUENCE {
 *         forward        [0]    Certificate OPTIONAL,
 *         reverse        [1]    Certificate OPTIONAL,
 *         -- at least one of the pair shall be present -- }
 * </pre>
 *
 * @return a DERObject
 */
public DERObject toASN1Object()
{
    ASN1EncodableVector vec = new ASN1EncodableVector();

    if (forward != null)
    {
        vec.add(new DERTaggedObject(0, forward));
    }
    if (reverse != null)
    {
        vec.add(new DERTaggedObject(1, reverse));
    }

    return new DERSequence(vec);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:30,代码来源:CertificatePair.java

示例6: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public DERObject toASN1Object()
{
    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:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:25,代码来源:DistributionPoint.java

示例7: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的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 DERObject toASN1Object()
{
    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:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:35,代码来源:V2Form.java

示例8: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 */
public DERObject toASN1Object()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

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

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

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


    return new DERSequence(v);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:26,代码来源:AuthorityKeyIdentifier.java

示例9: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
 * 
 * <pre>
 * 
 *  IetfAttrSyntax ::= SEQUENCE {
 *    policyAuthority [0] GeneralNames OPTIONAL,
 *    values SEQUENCE OF CHOICE {
 *      octets OCTET STRING,
 *      oid OBJECT IDENTIFIER,
 *      string UTF8String
 *    }
 *  }
 *  
 * </pre>
 */
public DERObject toASN1Object()
{
    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:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:36,代码来源:IetfAttrSyntax.java

示例10: getDERObject

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public DERObject getDERObject()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();
    ASN1EncodableVector  subV = new ASN1EncodableVector();

    v.add(id);
    subV.add(octStr);
    subV.add(iterationCount);

    if (keyLength != null)
    {
        subV.add(keyLength);
    }

    v.add(new DERSequence(subV));

    return new DERSequence(v);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:19,代码来源:PBKDF2Params.java

示例11: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
 * <pre>
 *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
 *
 *     Extension         ::=   SEQUENCE {
 *        extnId            EXTENSION.&amp;id ({ExtensionSet}),
 *        critical          BOOLEAN DEFAULT FALSE,
 *        extnValue         OCTET STRING }
 * </pre>
 */
public DERObject toASN1Object()
{
    ASN1EncodableVector     vec = new ASN1EncodableVector();
    Enumeration             e = ordering.elements();

    while (e.hasMoreElements())
    {
        DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
        X509Extension           ext = (X509Extension)extensions.get(oid);
        ASN1EncodableVector     v = new ASN1EncodableVector();

        v.add(oid);

        if (ext.isCritical())
        {
            v.add(new DERBoolean(true));
        }

        v.add(ext.getValue());

        vec.add(new DERSequence(v));
    }

    return new DERSequence(vec);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:36,代码来源:X509Extensions.java

示例12: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public DERObject toASN1Object() 
{
    ASN1EncodableVector av = new ASN1EncodableVector();
  
    if (noticeRef != null)
    {
        av.add(noticeRef);
    }
    
    if (explicitText != null)
    {
        av.add(explicitText);
    }
     
    return new DERSequence(av);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:17,代码来源:UserNotice.java

示例13: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的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 DERObject
 */
public DERObject toASN1Object()
{
    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:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:35,代码来源:GeneralSubtree.java

示例14: ExtendedKeyUsage

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public ExtendedKeyUsage(
    Vector  usages)
{
    ASN1EncodableVector v = new ASN1EncodableVector();
    Enumeration         e = usages.elements();

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

        v.add(o);
        this.usageTable.put(o, o);
    }

    this.seq = new DERSequence(v);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:17,代码来源:ExtendedKeyUsage.java

示例15: toASN1Object

import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 * BasicConstraints := SEQUENCE {
 *    cA                  BOOLEAN DEFAULT FALSE,
 *    pathLenConstraint   INTEGER (0..MAX) OPTIONAL
 * }
 * </pre>
 */
public DERObject toASN1Object()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

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

    if (pathLenConstraint != null)  // yes some people actually do this when cA is false...
    {
        v.add(pathLenConstraint);
    }

    return new DERSequence(v);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:26,代码来源:BasicConstraints.java


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