private CertEtcToken(ASN1TaggedObject choice) { this.tagNo = choice.getTagNo(); switch (tagNo) { case TAG_CERTIFICATE: value = Certificate.getInstance(choice, false); break; case TAG_ESSCERTID: value = ESSCertID.getInstance(choice.getObject()); break; case TAG_PKISTATUS: value = PKIStatusInfo.getInstance(choice, false); break; case TAG_ASSERTION: value = ContentInfo.getInstance(choice.getObject()); break; case TAG_CRL: value = CertificateList.getInstance(choice, false); break; case TAG_OCSPCERTSTATUS: value = CertStatus.getInstance(choice.getObject()); break; case TAG_OCSPCERTID: value = CertID.getInstance(choice, false); break; case TAG_OCSPRESPONSE: value = OCSPResponse.getInstance(choice, false); break; case TAG_CAPABILITIES: value = SMIMECapabilities.getInstance(choice.getObject()); break; default: throw new IllegalArgumentException("Unknown tag: " + tagNo); } }
/** * Get S/MIME capabilities (1.2.840.113549.1.9.15) extension value as a string. * * <pre> * SMIMECapability ::= SEQUENCE { * capabilityID OBJECT IDENTIFIER, * parameters ANY DEFINED BY capabilityID OPTIONAL } * SMIMECapabilities ::= SEQUENCE OF SMIMECapability * </pre> * * @see <a href="http://tools.ietf.org/html/rfc2633">RFC 2633</a> * @param bValue The octet string value * @return Extension value as a string * @throws IOException If an I/O problem occurs */ private String getSmimeCapabilitiesStringValue(byte[] bValue) throws IOException { SMIMECapabilities caps = SMIMECapabilities.getInstance(ASN1Primitive.fromByteArray(bValue)); String sParams = RB.getString("SmimeParameters"); StringBuilder sb = new StringBuilder(); for (Object o : caps.getCapabilities(null)) { SMIMECapability cap = (SMIMECapability) o; String sCapId = cap.getCapabilityID().getId(); String sCap = getRes(sCapId, "UnrecognisedSmimeCapability"); if (sb.length() != 0) { sb.append("<br>"); } sb.append("<ul><li>"); sb.append(MessageFormat.format(sCap, sCapId)); ASN1Encodable params; if ((params = cap.getParameters()) != null) { sb.append("<ul><li>"); sb.append(sParams); sb.append(": "); sb.append(stringify(params)); sb.append("</li></ul>"); } sb.append("</li></ul>"); } return sb.toString(); }