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);
}
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);
}
}
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();
}
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();
}
Aggregations