responseBytes = new OCSPResp(new OCSPResponse( new OCSPResponseStatus(OCSPRespBuilder.INTERNAL_ERROR), null)).getEncoded();
public static OCSPResponse getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
/** * Encode this {@link CertificateStatus} to an {@link OutputStream}. * * @param output * the {@link OutputStream} to encode to. * @throws IOException */ public void encode(OutputStream output) throws IOException { TlsUtils.writeUint8(statusType, output); switch (statusType) { case CertificateStatusType.ocsp: byte[] derEncoding = ((OCSPResponse) response).getEncoded(ASN1Encoding.DER); TlsUtils.writeOpaque24(derEncoding, output); break; default: throw new TlsFatalAlert(AlertDescription.internal_error); } }
public static OCSPResponse getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
/** * Encode this {@link CertificateStatus} to an {@link OutputStream}. * * @param output * the {@link OutputStream} to encode to. * @throws IOException */ public void encode(OutputStream output) throws IOException { TlsUtils.writeUint8(statusType, output); switch (statusType) { case CertificateStatusType.ocsp: byte[] derEncoding = ((OCSPResponse) response).getEncoded(ASN1Encoding.DER); TlsUtils.writeOpaque24(derEncoding, output); break; default: throw new TlsFatalAlert(AlertDescription.internal_error); } }
public static OCSPResponse getInstance( Object obj) { if (obj instanceof OCSPResponse) { return (OCSPResponse)obj; } else if (obj != null) { return new OCSPResponse(ASN1Sequence.getInstance(obj)); } return null; }
/** * This method allows to create a {@code OCSPResp} from a {@code DERSequence}. * * @param otherRevocationInfoMatch {@code DERSequence} to convert to {@code OCSPResp} * @return {@code OCSPResp} */ public static OCSPResp getOcspResp(final DERSequence otherRevocationInfoMatch) { OCSPResp ocspResp = null; try { final OCSPResponse ocspResponse = OCSPResponse.getInstance(otherRevocationInfoMatch); ocspResp = new OCSPResp(ocspResponse); } catch (Exception e) { LOG.error("Impossible to create OCSPResp from DERSequence!", e); } return ocspResp; }
public static OCSPResponse getInstance( Object obj) { if (obj instanceof OCSPResponse) { return (OCSPResponse)obj; } else if (obj != null) { return new OCSPResponse(ASN1Sequence.getInstance(obj)); } return null; }
/** * Parse a {@link CertificateStatus} from an {@link InputStream}. * * @param input * the {@link InputStream} to parse from. * @return a {@link CertificateStatus} object. * @throws IOException */ public static CertificateStatus parse(InputStream input) throws IOException { short status_type = TlsUtils.readUint8(input); Object response; switch (status_type) { case CertificateStatusType.ocsp: { byte[] derEncoding = TlsUtils.readOpaque24(input); response = OCSPResponse.getInstance(TlsUtils.readDERObject(derEncoding)); break; } default: throw new TlsFatalAlert(AlertDescription.decode_error); } return new CertificateStatus(status_type, response); }
/** * Convert a BasicOCSPResp in OCSPResp (connection status is set to SUCCESSFUL). * * @param basicOCSPResp * @return */ public static final OCSPResp fromBasicToResp(final byte[] basicOCSPResp) { final OCSPResponseStatus responseStatus = new OCSPResponseStatus(OCSPResponseStatus.SUCCESSFUL); final DEROctetString derBasicOCSPResp = new DEROctetString(basicOCSPResp); final ResponseBytes responseBytes = new ResponseBytes(OCSPObjectIdentifiers.id_pkix_ocsp_basic, derBasicOCSPResp); final OCSPResponse ocspResponse = new OCSPResponse(responseStatus, responseBytes); final OCSPResp ocspResp = new OCSPResp(ocspResponse); //!!! todo to be checked: System.out.println("===> RECREATED: " + ocspResp.hashCode()); return ocspResp; }
/** * Parse a {@link CertificateStatus} from an {@link InputStream}. * * @param input * the {@link InputStream} to parse from. * @return a {@link CertificateStatus} object. * @throws IOException */ public static CertificateStatus parse(InputStream input) throws IOException { short status_type = TlsUtils.readUint8(input); Object response; switch (status_type) { case CertificateStatusType.ocsp: { byte[] derEncoding = TlsUtils.readOpaque24(input); response = OCSPResponse.getInstance(TlsUtils.readDERObject(derEncoding)); break; } default: throw new TlsFatalAlert(AlertDescription.decode_error); } return new CertificateStatus(status_type, response); }
/** * Convert a BasicOCSPResp in OCSPResp (connection status is set to * SUCCESSFUL). * * @param basicOCSPRespBinary * the binary of BasicOCSPResp * @return an instance of OCSPResp */ public static OCSPResp fromBasicToResp(final byte[] basicOCSPRespBinary) { final OCSPResponseStatus responseStatus = new OCSPResponseStatus(OCSPResponseStatus.SUCCESSFUL); final DEROctetString derBasicOCSPResp = new DEROctetString(basicOCSPRespBinary); final ResponseBytes responseBytes = new ResponseBytes(OCSPObjectIdentifiers.id_pkix_ocsp_basic, derBasicOCSPResp); final OCSPResponse ocspResponse = new OCSPResponse(responseStatus, responseBytes); // !!! todo to be checked: System.out.println("===> RECREATED: " + // ocspResp.hashCode()); return new OCSPResp(ocspResponse); }
break; case TAG_OCSPRESPONSE: value = OCSPResponse.getInstance(choice, false); break; case TAG_CAPABILITIES:
private static byte[] buildOCSPResponse(byte[] basicOcspResponse) throws IOException { DEROctetString doctet = new DEROctetString(basicOcspResponse); OCSPResponseStatus respStatus = new OCSPResponseStatus(OCSPRespBuilder.SUCCESSFUL); ResponseBytes responseBytes = new ResponseBytes(OCSPObjectIdentifiers.id_pkix_ocsp_basic, doctet); OCSPResponse ocspResponse = new OCSPResponse(respStatus, responseBytes); return new OCSPResp(ocspResponse).getEncoded(); }
break; case TAG_OCSPRESPONSE: value = OCSPResponse.getInstance(choice, false); break; case TAG_CAPABILITIES:
private static byte[] buildOCSPResponse(byte[] basicOcspResponse) throws IOException { DEROctetString doctet = new DEROctetString(basicOcspResponse); OCSPResponseStatus respStatus = new OCSPResponseStatus(OCSPRespBuilder.SUCCESSFUL); ResponseBytes responseBytes = new ResponseBytes(OCSPObjectIdentifiers.id_pkix_ocsp_basic, doctet); OCSPResponse ocspResponse = new OCSPResponse(respStatus, responseBytes); return new OCSPResp(ocspResponse).getEncoded(); }