use of org.bouncycastle.asn1.x509.CRLReason in project keystore-explorer by kaikramer.
the class X509Ext method getReasonCodeStringValue.
private String getReasonCodeStringValue(byte[] value) throws IOException {
// @formatter:off
/*
* ReasonCode ::= { CRLReason }
*
* CRLReason ::= ASN1Enumerated { unspecified (0), keyCompromise (1),
* cACompromise (2), affiliationChanged (3), superseded (4),
* cessationOfOperation (5), certificateHold (6), removeFromCRL (8),
* privilegeWithdrawn (9), aACompromise (10) }
*/
// @formatter:on
StringBuilder sb = new StringBuilder();
CRLReason crlReason = CRLReason.getInstance(value);
long crlReasonLong = crlReason.getValue().longValue();
if (crlReasonLong == CRLReason.unspecified) {
sb.append(res.getString("UnspecifiedCrlReason"));
} else if (crlReasonLong == CRLReason.keyCompromise) {
sb.append(res.getString("KeyCompromiseCrlReason"));
} else if (crlReasonLong == CRLReason.cACompromise) {
sb.append(res.getString("CaCompromiseCrlReason"));
} else if (crlReasonLong == CRLReason.affiliationChanged) {
sb.append(res.getString("AffiliationChangedCrlReason"));
} else if (crlReasonLong == CRLReason.superseded) {
sb.append(res.getString("SupersededCrlReason"));
} else if (crlReasonLong == CRLReason.cessationOfOperation) {
sb.append(res.getString("CessationOfOperationCrlReason"));
} else if (crlReasonLong == CRLReason.certificateHold) {
sb.append(res.getString("CertificateHoldCrlReason"));
} else if (crlReasonLong == CRLReason.removeFromCRL) {
sb.append(res.getString("RemoveFromCrlCrlReason"));
} else if (crlReasonLong == CRLReason.privilegeWithdrawn) {
sb.append(res.getString("PrivilegeWithdrawnCrlReason"));
} else // CRLReason.aACompromise
{
sb.append(res.getString("AaCompromiseCrlReason"));
}
sb.append(NEWLINE);
return sb.toString();
}
Aggregations