Search in sources :

Example 6 with CertPolicyId

use of org.bouncycastle.asn1.x509.CertPolicyId in project xipki by xipki.

the class XmlX509CertprofileUtil method buildPolicyMappings.

// method buildCertificatePolicies
public static PolicyMappings buildPolicyMappings(org.xipki.ca.certprofile.x509.jaxb.PolicyMappings type) {
    ParamUtil.requireNonNull("type", type);
    List<PolicyIdMappingType> mappings = type.getMapping();
    final int n = mappings.size();
    CertPolicyId[] issuerDomainPolicy = new CertPolicyId[n];
    CertPolicyId[] subjectDomainPolicy = new CertPolicyId[n];
    for (int i = 0; i < n; i++) {
        PolicyIdMappingType mapping = mappings.get(i);
        ASN1ObjectIdentifier oid = new ASN1ObjectIdentifier(mapping.getIssuerDomainPolicy().getValue());
        issuerDomainPolicy[i] = CertPolicyId.getInstance(oid);
        oid = new ASN1ObjectIdentifier(mapping.getSubjectDomainPolicy().getValue());
        subjectDomainPolicy[i] = CertPolicyId.getInstance(oid);
    }
    return new PolicyMappings(issuerDomainPolicy, subjectDomainPolicy);
}
Also used : CertPolicyId(org.bouncycastle.asn1.x509.CertPolicyId) PolicyMappings(org.bouncycastle.asn1.x509.PolicyMappings) PolicyIdMappingType(org.xipki.ca.certprofile.x509.jaxb.PolicyIdMappingType) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 7 with CertPolicyId

use of org.bouncycastle.asn1.x509.CertPolicyId in project signer by demoiselle.

the class AcceptablePolicySet method parse.

@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    int total = derSequence.size();
    for (int i = 0; i < total; i++) {
        CertPolicyId certPolicyId = new CertPolicyId();
        certPolicyId.parse(derSequence.getObjectAt(i).toASN1Primitive());
        if (this.certPolicyIds == null) {
            this.certPolicyIds = new ArrayList<>();
        }
        this.certPolicyIds.add(certPolicyId);
    }
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence)

Example 8 with CertPolicyId

use of org.bouncycastle.asn1.x509.CertPolicyId in project keystore-explorer by kaikramer.

the class PolicyInformationUtil method toString.

// @formatter:off
/*
	 * PolicyInformation ::= ASN1Sequence { policyIdentifier CertPolicyId,
	 * policyQualifiers ASN1Sequence SIZE (1..MAX) OF PolicyQualifierInfo
	 * OPTIONAL }
	 *
	 * CertPolicyId ::= OBJECT IDENTIFIER
	 *
	 * PolicyQualifierInfo ::= ASN1Sequence { policyQualifierId
	 * PolicyQualifierId, qualifier ANY DEFINED BY policyQualifierId }
	 *
	 * -- policyQualifierIds for Internet policy qualifiers
	 *
	 * id-qt OBJECT IDENTIFIER ::= { id-pkix 2 } id-qt-cps OBJECT IDENTIFIER ::=
	 * { id-qt 1 } id-qt-unotice OBJECT IDENTIFIER ::= { id-qt 2 }
	 *
	 * PolicyQualifierId ::= OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
	 *
	 * Qualifier ::= CHOICE { cPSuri CPSuri, userNotice UserNotice }
	 *
	 * CPSuri ::= DERIA5String
	 *
	 * UserNotice ::= ASN1Sequence { noticeRef NoticeReference OPTIONAL,
	 * explicitText DisplayText OPTIONAL}
	 *
	 * NoticeReference ::= ASN1Sequence { organization DisplayText,
	 * noticeNumbers ASN1Sequence OF ASN1Integer }
	 *
	 * DisplayText ::= CHOICE { ia5String DERIA5String (SIZE (1..200)),
	 * visibleString VisibleString (SIZE (1..200)), bmpString BMPString (SIZE
	 * (1..200)), utf8String UTF8String (SIZE (1..200)) }
	 */
// @formatter:on
/**
 * Get string representation of policy information.
 *
 * @param policyInformation
 *            Policy information
 * @return String representation of policy information
 * @throws IOException
 *             If policy information is invalid
 */
public static String toString(PolicyInformation policyInformation) throws IOException {
    StringBuffer sbPolicyInformation = new StringBuffer();
    ASN1ObjectIdentifier policyIdentifier = policyInformation.getPolicyIdentifier();
    sbPolicyInformation.append(MessageFormat.format(res.getString("PolicyInformationUtil.PolicyIdentifier"), policyIdentifier.getId()));
    ASN1Sequence policyQualifiers = policyInformation.getPolicyQualifiers();
    if (policyQualifiers != null) {
        sbPolicyInformation.append(", ");
        StringBuffer sbPolicyQualifiers = new StringBuffer();
        for (int i = 0; i < policyQualifiers.size(); i++) {
            PolicyQualifierInfo policyQualifierInfo = PolicyQualifierInfo.getInstance(policyQualifiers.getObjectAt(i));
            sbPolicyQualifiers.append(toString(policyQualifierInfo));
            if ((i + 1) < policyQualifiers.size()) {
                sbPolicyQualifiers.append(", ");
            }
        }
        sbPolicyInformation.append(MessageFormat.format(res.getString("PolicyInformationUtil.PolicyQualifiers"), sbPolicyQualifiers));
    }
    return sbPolicyInformation.toString();
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) PolicyQualifierInfo(org.bouncycastle.asn1.x509.PolicyQualifierInfo) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 9 with CertPolicyId

use of org.bouncycastle.asn1.x509.CertPolicyId in project keystore-explorer by kaikramer.

the class JPolicyMappings method populate.

private void populate() {
    if (policyMappings == null) {
        policyMappings = new PolicyMappings(new CertPolicyId[0], new CertPolicyId[0]);
    }
    reloadPolicyMappingsTable();
    selectFirstPolicyMappingInTable();
    updateButtonControls();
}
Also used : CertPolicyId(org.bouncycastle.asn1.x509.CertPolicyId) PolicyMappings(org.bouncycastle.asn1.x509.PolicyMappings)

Aggregations

ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)5 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)4 CRLDistPoint (org.bouncycastle.asn1.x509.CRLDistPoint)3 CertPolicyId (org.bouncycastle.asn1.x509.CertPolicyId)3 DistributionPoint (org.bouncycastle.asn1.x509.DistributionPoint)3 PolicyMappings (org.bouncycastle.asn1.x509.PolicyMappings)3 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)2 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)2 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)2 DERBMPString (org.bouncycastle.asn1.DERBMPString)2 DERIA5String (org.bouncycastle.asn1.DERIA5String)2 DERPrintableString (org.bouncycastle.asn1.DERPrintableString)2 DERSequence (org.bouncycastle.asn1.DERSequence)2 DirectoryString (org.bouncycastle.asn1.x500.DirectoryString)2 IssuingDistributionPoint (org.bouncycastle.asn1.x509.IssuingDistributionPoint)2 HashMap (java.util.HashMap)1 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)1 ASN1String (org.bouncycastle.asn1.ASN1String)1 DERBitString (org.bouncycastle.asn1.DERBitString)1 DERGeneralString (org.bouncycastle.asn1.DERGeneralString)1