use of org.mozilla.jss.netscape.security.x509.CRLDistributionPoint in project jss by dogtagpki.
the class ExtPrettyPrint method getCRLDistributionPointsExtension.
/**
* String Representation of CRLDistributionPointsExtension
*/
private String getCRLDistributionPointsExtension() {
StringBuffer sb = new StringBuffer();
//
// Generic stuff: name, OID, criticality
//
sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
sb.append(mResource.getString(PrettyPrintResources.TOKEN_CRL_DP_EXT) + "- " + mExt.getExtensionId().toString() + "\n");
sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
if (mExt.isCritical()) {
sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
} else {
sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
}
//
// Now the CRLDP-specific stuff
//
CRLDistributionPointsExtension ext = (CRLDistributionPointsExtension) mExt;
int numPoints = ext.getNumPoints();
sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_NUMPOINTS) + numPoints + "\n");
for (int i = 0; i < numPoints; i++) {
//
// print one individual CRL distribution point
//
int idt;
// reset each time through loop
idt = mIndentSize + 4;
boolean isEmpty = true;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_POINTN) + i + "\n");
CRLDistributionPoint pt = ext.getPointAt(i);
// further indent rest of information
idt += 4;
if (pt.getFullName() != null) {
isEmpty = false;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT) + pt.getFullName() + "\n");
}
if (pt.getRelativeName() != null) {
isEmpty = false;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT) + pt.getRelativeName() + "\n");
}
if (pt.getReasons() != null) {
isEmpty = false;
byte[] reasonBits = pt.getReasons().toByteArray();
String reasonList = reasonBitsToReasonList(reasonBits);
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_REASONS) + reasonList + "\n");
}
if (pt.getCRLIssuer() != null) {
isEmpty = false;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_CRLISSUER) + pt.getCRLIssuer() + "\n");
}
if (isEmpty) {
sb.append(pp.indent(idt) + "<i>empty</i>\n");
}
}
return sb.toString();
}
use of org.mozilla.jss.netscape.security.x509.CRLDistributionPoint in project jss by dogtagpki.
the class ExtPrettyPrint method getFreshestCRLExtension.
/**
* String Representation of FreshestCRLExtension
*/
private String getFreshestCRLExtension() {
StringBuffer sb = new StringBuffer();
//
// Generic stuff: name, OID, criticality
//
sb.append(pp.indent(mIndentSize) + mResource.getString(PrettyPrintResources.TOKEN_IDENTIFIER));
sb.append(mResource.getString(PrettyPrintResources.TOKEN_FRESHEST_CRL_EXT) + "- " + mExt.getExtensionId().toString() + "\n");
sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRITICAL));
if (mExt.isCritical()) {
sb.append(mResource.getString(PrettyPrintResources.TOKEN_YES) + "\n");
} else {
sb.append(mResource.getString(PrettyPrintResources.TOKEN_NO) + "\n");
}
//
// Now the CRLDP-specific stuff
//
FreshestCRLExtension ext = (FreshestCRLExtension) mExt;
int numPoints = ext.getNumPoints();
sb.append(pp.indent(mIndentSize + 4) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_NUMPOINTS) + numPoints + "\n");
for (int i = 0; i < numPoints; i++) {
//
// print one individual CRL distribution point
//
int idt;
// reset each time through loop
idt = mIndentSize + 4;
boolean isEmpty = true;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_POINTN) + i + "\n");
CRLDistributionPoint pt = ext.getPointAt(i);
// further indent rest of information
idt += 4;
if (pt.getFullName() != null) {
isEmpty = false;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT) + pt.getFullName() + "\n");
}
if (pt.getRelativeName() != null) {
isEmpty = false;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_DISTPOINT) + pt.getRelativeName() + "\n");
}
if (pt.getReasons() != null) {
isEmpty = false;
byte[] reasonBits = pt.getReasons().toByteArray();
String reasonList = reasonBitsToReasonList(reasonBits);
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_REASONS) + reasonList + "\n");
}
if (pt.getCRLIssuer() != null) {
isEmpty = false;
sb.append(pp.indent(idt) + mResource.getString(PrettyPrintResources.TOKEN_CRLDP_CRLISSUER) + pt.getCRLIssuer() + "\n");
}
if (isEmpty) {
sb.append(pp.indent(idt) + "<i>empty</i>\n");
}
}
return sb.toString();
}
Aggregations