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


Java DERObjectIdentifier.getInstance方法代码示例

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


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

示例1: ObjectDigestInfo

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
private ObjectDigestInfo(
    ASN1Sequence seq)
{
    if (seq.size() > 4 || seq.size() < 3)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }

    digestedObjectType = DEREnumerated.getInstance(seq.getObjectAt(0));

    int offset = 0;

    if (seq.size() == 4)
    {
        otherObjectTypeID = DERObjectIdentifier.getInstance(seq.getObjectAt(1));
        offset++;
    }

    digestAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1 + offset));

    objectDigest = DERBitString.getInstance(seq.getObjectAt(2 + offset));
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:24,代码来源:ObjectDigestInfo.java

示例2: PolicyInformation

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
public PolicyInformation(
    ASN1Sequence seq)
{
    if (seq.size() < 1 || seq.size() > 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
                + seq.size());
    }

    policyIdentifier = DERObjectIdentifier.getInstance(seq.getObjectAt(0));

    if (seq.size() > 1)
    {
        policyQualifiers = ASN1Sequence.getInstance(seq.getObjectAt(1));
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:17,代码来源:PolicyInformation.java

示例3: AlgorithmIdentifier

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
public AlgorithmIdentifier(
    ASN1Sequence   seq)
{
    if (seq.size() < 1 || seq.size() > 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
                + seq.size());
    }
    
    objectId = DERObjectIdentifier.getInstance(seq.getObjectAt(0));

    if (seq.size() == 2)
    {
        parametersDefined = true;
        parameters = seq.getObjectAt(1);
    }
    else
    {
        parameters = null;
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:22,代码来源:AlgorithmIdentifier.java

示例4: getUPNStringFromSequence

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
/**
 * Get UPN String.
 *
 * @param seq ASN1Sequence abstraction representing subject alternative name.
 * First element is the object identifier, second is the object itself.
 *
 * @return UPN string or null
 */
private String getUPNStringFromSequence(final ASN1Sequence seq) {
    if (seq != null) {
        // First in sequence is the object identifier, that we must check
        final DERObjectIdentifier id = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
        if (id != null && UPN_OBJECTID.equals(id.getId())) {
            final ASN1TaggedObject obj = (ASN1TaggedObject) seq.getObjectAt(1);
            final DERUTF8String str = DERUTF8String.getInstance(obj.getObject());
            return str.getString();
        }
    }
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:X509SubjectAlternativeNameUPNPrincipalResolver.java

示例5: SpnegoTargToken

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
public SpnegoTargToken(byte[] token) throws DecodingException {
    ASN1InputStream stream = new ASN1InputStream(new ByteArrayInputStream(token));
    ASN1TaggedObject tagged;
    try {
        tagged = DecodingUtil.as(ASN1TaggedObject.class, stream);
    } catch(IOException e) {
        throw new DecodingException("spnego.token.malformed", null, e);
    }

    ASN1Sequence sequence = ASN1Sequence.getInstance(tagged, true);
    Enumeration<?> fields = sequence.getObjects();
    while(fields.hasMoreElements()) {
        tagged = DecodingUtil.as(ASN1TaggedObject.class, fields);
        switch (tagged.getTagNo()) {
        case 0:
            ASN1Enumerated enumerated = DEREnumerated.getInstance(tagged, true);
            result = enumerated.getValue().intValue();
            break;
        case 1:
            ASN1ObjectIdentifier mechanismOid = DERObjectIdentifier.getInstance(tagged, true);
            mechanism = mechanismOid.getId();
            break;
        case 2:
            ASN1OctetString mechanismTokenString = ASN1OctetString.getInstance(tagged, true);
            mechanismToken = mechanismTokenString.getOctets();
            break;
        case 3:
            ASN1OctetString mechanismListString = ASN1OctetString.getInstance(tagged, true);
            mechanismList = mechanismListString.getOctets();
            break;
        default:
            Object[] args = new Object[]{tagged.getTagNo()};
            throw new DecodingException("spnego.field.invalid", args, null);
        }
    }
}
 
开发者ID:cbsit,项目名称:JaasLounge,代码行数:37,代码来源:SpnegoTargToken.java

示例6: Attribute

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
public Attribute(
    ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: " + seq.size());
    }

    attrType = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
    attrValues = ASN1Set.getInstance(seq.getObjectAt(1));
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:12,代码来源:Attribute.java

示例7: PolicyQualifierInfo

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
/**
 * Creates a new <code>PolicyQualifierInfo</code> instance.
 *
 * @param as <code>PolicyQualifierInfo</code> X509 structure
 * encoded as an ASN1Sequence. 
 */
public PolicyQualifierInfo(
    ASN1Sequence as)
{
     if (as.size() != 2)
     {
         throw new IllegalArgumentException("Bad sequence size: "
                 + as.size());
     }

     policyQualifierId = DERObjectIdentifier.getInstance(as.getObjectAt(0));
     qualifier = as.getObjectAt(1);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:19,代码来源:PolicyQualifierInfo.java

示例8: getInstance

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
public static GeneralName getInstance(
    Object obj)
{
    if (obj == null || obj instanceof GeneralName)
    {
        return (GeneralName)obj;
    }

    if (obj instanceof ASN1TaggedObject)
    {
        ASN1TaggedObject    tagObj = (ASN1TaggedObject)obj;
        int                 tag = tagObj.getTagNo();

        switch (tag)
        {
        case otherName:
            return new GeneralName(tag, ASN1Sequence.getInstance(tagObj, false));
        case rfc822Name:
            return new GeneralName(tag, DERIA5String.getInstance(tagObj, false));
        case dNSName:
            return new GeneralName(tag, DERIA5String.getInstance(tagObj, false));
        case x400Address:
            throw new IllegalArgumentException("unknown tag: " + tag);
        case directoryName:
            return new GeneralName(tag, ASN1Sequence.getInstance(tagObj, true));
        case ediPartyName:
            return new GeneralName(tag, ASN1Sequence.getInstance(tagObj, false));
        case uniformResourceIdentifier:
            return new GeneralName(tag, DERIA5String.getInstance(tagObj, false));
        case iPAddress:
            return new GeneralName(tag, ASN1OctetString.getInstance(tagObj, false));
        case registeredID:
            return new GeneralName(tag, DERObjectIdentifier.getInstance(tagObj, false));
        }
    }

    throw new IllegalArgumentException("unknown object in getInstance");
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:39,代码来源:GeneralName.java

示例9: AccessDescription

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
public AccessDescription(
    ASN1Sequence   seq)
{
    if (seq.size() != 2) 
    {
        throw new IllegalArgumentException("wrong number of elements in inner sequence");
    }
    
    accessMethod = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
    accessLocation = GeneralName.getInstance(seq.getObjectAt(1));
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:12,代码来源:AccessDescription.java

示例10: prepareNextCertA

import org.bouncycastle.asn1.DERObjectIdentifier; //导入方法依赖的package包/类
protected static void prepareNextCertA(
    CertPath certPath,
    int index)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    //
    //
    // (a) check the policy mappings
    //
    ASN1Sequence pm = null;
    try
    {
        pm = DERSequence.getInstance(CertPathValidatorUtilities.getExtensionValue(cert,
            RFC3280CertPathUtilities.POLICY_MAPPINGS));
    }
    catch (AnnotatedException ex)
    {
        throw new ExtCertPathValidatorException("Policy mappings extension could not be decoded.", ex, certPath,
            index);
    }
    if (pm != null)
    {
        ASN1Sequence mappings = pm;

        for (int j = 0; j < mappings.size(); j++)
        {
            DERObjectIdentifier issuerDomainPolicy = null;
            DERObjectIdentifier subjectDomainPolicy = null;
            try
            {
                ASN1Sequence mapping = DERSequence.getInstance(mappings.getObjectAt(j));

                issuerDomainPolicy = DERObjectIdentifier.getInstance(mapping.getObjectAt(0));
                subjectDomainPolicy = DERObjectIdentifier.getInstance(mapping.getObjectAt(1));
            }
            catch (Exception e)
            {
                throw new ExtCertPathValidatorException("Policy mappings extension contents could not be decoded.",
                    e, certPath, index);
            }

            if (RFC3280CertPathUtilities.ANY_POLICY.equals(issuerDomainPolicy.getId()))
            {

                throw new CertPathValidatorException("IssuerDomainPolicy is anyPolicy", null, certPath, index);
            }

            if (RFC3280CertPathUtilities.ANY_POLICY.equals(subjectDomainPolicy.getId()))
            {

                throw new CertPathValidatorException("SubjectDomainPolicy is anyPolicy,", null, certPath, index);
            }
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:58,代码来源:RFC3280CertPathUtilities.java


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