use of org.bouncycastle.asn1.DERObject in project nhin-d by DirectProject.
the class CertificatePolicyCpsUriExtensionField method injectReferenceValue.
/**
* {@inheritDoc}
*/
@Override
public void injectReferenceValue(X509Certificate value) throws PolicyProcessException {
this.certificate = value;
final DERObject exValue = getExtensionValue(value);
if (exValue == null) {
if (isRequired())
throw new PolicyRequiredException("Extention " + getExtentionIdentifier().getDisplay() + " is marked as required by is not present.");
else {
final Collection<String> emptyList = Collections.emptyList();
this.policyValue = PolicyValueFactory.getInstance(emptyList);
return;
}
}
final Collection<String> retVal = new ArrayList<String>();
final ASN1Sequence seq = (ASN1Sequence) exValue;
@SuppressWarnings("unchecked") final Enumeration<DEREncodable> pols = seq.getObjects();
while (pols.hasMoreElements()) {
final PolicyInformation pol = PolicyInformation.getInstance(pols.nextElement());
if (pol.getPolicyQualifiers() != null) {
@SuppressWarnings("unchecked") final Enumeration<DEREncodable> polInfos = pol.getPolicyQualifiers().getObjects();
while (polInfos.hasMoreElements()) {
final PolicyQualifierInfo polInfo = PolicyQualifierInfo.getInstance(polInfos.nextElement());
if (polInfo.getPolicyQualifierId().equals(PolicyQualifierId.id_qt_cps)) {
retVal.add(polInfo.getQualifier().toString());
}
}
}
}
///CLOVER:OFF
if (retVal.isEmpty() && isRequired())
throw new PolicyRequiredException("Extention " + getExtentionIdentifier().getDisplay() + " is marked as required by is not present.");
///CLOVER:ON
this.policyValue = PolicyValueFactory.getInstance(retVal);
}
use of org.bouncycastle.asn1.DERObject in project nhin-d by DirectProject.
the class CertificatePolicyIndentifierExtensionField method injectReferenceValue.
/**
* {@inheritDoc}
*/
@Override
public void injectReferenceValue(X509Certificate value) throws PolicyProcessException {
this.certificate = value;
final DERObject exValue = getExtensionValue(value);
if (exValue == null) {
if (isRequired())
throw new PolicyRequiredException("Extention " + getExtentionIdentifier().getDisplay() + " is marked as required by is not present.");
else {
final Collection<String> emptyList = Collections.emptyList();
this.policyValue = PolicyValueFactory.getInstance(emptyList);
return;
}
}
final Collection<String> retVal = new ArrayList<String>();
final ASN1Sequence seq = (ASN1Sequence) exValue;
@SuppressWarnings("unchecked") final Enumeration<DEREncodable> pols = seq.getObjects();
while (pols.hasMoreElements()) {
final PolicyInformation pol = PolicyInformation.getInstance(pols.nextElement());
retVal.add(pol.getPolicyIdentifier().getId());
}
this.policyValue = PolicyValueFactory.getInstance(retVal);
}
Aggregations