Java Code Examples for sun.security.provider.certpath.OCSPResponse#getSingleResponse()

The following examples show how to use sun.security.provider.certpath.OCSPResponse#getSingleResponse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusResponseManager.java    From openjsse with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new cache entry from the raw bytes of the response
 *
 * @param responseBytes the DER encoding for the OCSP response
 *
 * @throws IOException if an {@code OCSPResponse} cannot be
 *         created from the encoded bytes.
 */
ResponseCacheEntry(byte[] responseBytes, CertId cid)
        throws IOException {
    Objects.requireNonNull(responseBytes,
            "Non-null responseBytes required");
    Objects.requireNonNull(cid, "Non-null Cert ID required");

    ocspBytes = responseBytes.clone();
    OCSPResponse oResp = new OCSPResponse(ocspBytes);
    status = oResp.getResponseStatus();
    respId = oResp.getResponderId();
    singleResp = oResp.getSingleResponse(cid);
    if (status == OCSPResponse.ResponseStatus.SUCCESSFUL) {
        if (singleResp != null) {
            // Pull out the nextUpdate field in advance because the
            // Date is cloned.
            nextUpdate = singleResp.getNextUpdate();
        } else {
            throw new IOException(
                    "Unable to find SingleResponse for SN " +
                    cid.getSerialNumber());
        }
    } else {
        nextUpdate = null;
    }
}
 
Example 2
Source File: StatusResponseManager.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new cache entry from the raw bytes of the response
 *
 * @param responseBytes the DER encoding for the OCSP response
 *
 * @throws IOException if an {@code OCSPResponse} cannot be
 *         created from the encoded bytes.
 */
ResponseCacheEntry(byte[] responseBytes, CertId cid)
        throws IOException {
    Objects.requireNonNull(responseBytes,
            "Non-null responseBytes required");
    Objects.requireNonNull(cid, "Non-null Cert ID required");

    ocspBytes = responseBytes.clone();
    OCSPResponse oResp = new OCSPResponse(ocspBytes);
    status = oResp.getResponseStatus();
    respId = oResp.getResponderId();
    singleResp = oResp.getSingleResponse(cid);
    if (status == OCSPResponse.ResponseStatus.SUCCESSFUL) {
        if (singleResp != null) {
            // Pull out the nextUpdate field in advance because the
            // Date is cloned.
            nextUpdate = singleResp.getNextUpdate();
        } else {
            throw new IOException(
                    "Unable to find SingleResponse for SN " +
                    cid.getSerialNumber());
        }
    } else {
        nextUpdate = null;
    }
}
 
Example 3
Source File: StatusResponseManager.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new cache entry from the raw bytes of the response
 *
 * @param responseBytes the DER encoding for the OCSP response
 *
 * @throws IOException if an {@code OCSPResponse} cannot be created from
 *      the encoded bytes.
 */
ResponseCacheEntry(byte[] responseBytes, CertId cid)
        throws IOException {
    Objects.requireNonNull(responseBytes,
            "Non-null responseBytes required");
    Objects.requireNonNull(cid, "Non-null Cert ID required");

    ocspBytes = responseBytes.clone();
    OCSPResponse oResp = new OCSPResponse(ocspBytes);
    status = oResp.getResponseStatus();
    respId = oResp.getResponderId();
    singleResp = oResp.getSingleResponse(cid);
    if (status == OCSPResponse.ResponseStatus.SUCCESSFUL) {
        if (singleResp != null) {
            // Pull out the nextUpdate field in advance because the
            // Date is cloned.
            nextUpdate = singleResp.getNextUpdate();
        } else {
            throw new IOException("Unable to find SingleResponse for " +
                    "SN " + cid.getSerialNumber());
        }
    } else {
        nextUpdate = null;
    }
}