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


Java DERSequence.getInstance方法代碼示例

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


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

示例1: processCertE

import org.bouncycastle.asn1.DERSequence; //導入方法依賴的package包/類
protected static PKIXPolicyNode processCertE(
    CertPath certPath,
    int index,
    PKIXPolicyNode validPolicyTree)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    // 
    // (e)
    //
    ASN1Sequence certPolicies = null;
    try
    {
        certPolicies = DERSequence.getInstance(CertPathValidatorUtilities.getExtensionValue(cert,
            RFC3280CertPathUtilities.CERTIFICATE_POLICIES));
    }
    catch (AnnotatedException e)
    {
        throw new ExtCertPathValidatorException("Could not read certificate policies extension from certificate.",
            e, certPath, index);
    }
    if (certPolicies == null)
    {
        validPolicyTree = null;
    }
    return validPolicyTree;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:29,代碼來源:RFC3280CertPathUtilities.java

示例2: prepareNextCertA

import org.bouncycastle.asn1.DERSequence; //導入方法依賴的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

示例3: AdmissionSyntax

import org.bouncycastle.asn1.DERSequence; //導入方法依賴的package包/類
/**
 * Constructor from ASN1Sequence.
 * <p/>
 * The sequence is of type ProcurationSyntax:
 * <p/>
 * <pre>
 *     AdmissionSyntax ::= SEQUENCE
 *     {
 *       admissionAuthority GeneralName OPTIONAL,
 *       contentsOfAdmissions SEQUENCE OF Admissions
 *     }
 * <p/>
 *     Admissions ::= SEQUENCE
 *     {
 *       admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
 *       namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
 *       professionInfos SEQUENCE OF ProfessionInfo
 *     }
 * <p/>
 *     NamingAuthority ::= SEQUENCE
 *     {
 *       namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
 *       namingAuthorityUrl IA5String OPTIONAL,
 *       namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
 *     }
 * <p/>
 *     ProfessionInfo ::= SEQUENCE
 *     {
 *       namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
 *       professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
 *       professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
 *       registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
 *       addProfessionInfo OCTET STRING OPTIONAL
 *     }
 * </pre>
 *
 * @param seq The ASN.1 sequence.
 */
private AdmissionSyntax(ASN1Sequence seq)
{
    switch (seq.size())
    {
    case 1:
        contentsOfAdmissions = DERSequence.getInstance(seq.getObjectAt(0));
        break;
    case 2:
        admissionAuthority = GeneralName.getInstance(seq.getObjectAt(0));
        contentsOfAdmissions = DERSequence.getInstance(seq.getObjectAt(1));
        break;
    default:
        throw new IllegalArgumentException("Bad sequence size: " + seq.size());
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:54,代碼來源:AdmissionSyntax.java


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