Search in sources :

Example 1 with ResponderId

use of sun.security.provider.certpath.ResponderId in project Bytecoder by mirkosertic.

the class OCSPStatusRequest method toString.

/**
 * Create a string representation of this {@code OCSPStatusRequest}
 *
 * @return a string representation of this {@code OCSPStatusRequest}
 */
@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("OCSPStatusRequest\n");
    sb.append("    ResponderIds:");
    if (responderIds.isEmpty()) {
        sb.append(" <EMPTY>");
    } else {
        for (ResponderId rid : responderIds) {
            sb.append("\n    ").append(rid.toString());
        }
    }
    sb.append("\n").append("    Extensions:");
    if (extensions.isEmpty()) {
        sb.append(" <EMPTY>");
    } else {
        for (Extension ext : extensions) {
            sb.append("\n    ").append(ext.toString());
        }
    }
    return sb.toString();
}
Also used : Extension(java.security.cert.Extension) ResponderId(sun.security.provider.certpath.ResponderId)

Example 2 with ResponderId

use of sun.security.provider.certpath.ResponderId in project Bytecoder by mirkosertic.

the class OCSPStatusRequest method send.

/**
 * Send the encoded {@code OCSPStatusRequest} out through the provided
 *      {@code HandshakeOutputStream}
 *
 * @param s the {@code HandshakeOutputStream} on which to send the encoded
 *      data
 *
 * @throws IOException if any encoding errors occur
 */
@Override
public void send(HandshakeOutStream s) throws IOException {
    s.putInt16(ridListLen);
    for (ResponderId rid : responderIds) {
        s.putBytes16(rid.getEncoded());
    }
    DerOutputStream seqOut = new DerOutputStream();
    DerOutputStream extBytes = new DerOutputStream();
    if (extensions.size() > 0) {
        for (Extension ext : extensions) {
            ext.encode(extBytes);
        }
        seqOut.write(DerValue.tag_Sequence, extBytes);
    }
    s.putBytes16(seqOut.toByteArray());
}
Also used : Extension(java.security.cert.Extension) DerOutputStream(sun.security.util.DerOutputStream) ResponderId(sun.security.provider.certpath.ResponderId)

Example 3 with ResponderId

use of sun.security.provider.certpath.ResponderId in project Bytecoder by mirkosertic.

the class OCSPStatusRequest method length.

/**
 * Obtain the length of the {@code OCSPStatusRequest} object in its
 *      encoded form
 *
 * @return the length of the {@code OCSPStatusRequest} object in its
 *      encoded form
 */
@Override
public int length() {
    // If we've previously calculated encodedLen simply return it
    if (encodedLen != 0) {
        return encodedLen;
    }
    ridListLen = 0;
    for (ResponderId rid : responderIds) {
        ridListLen += rid.length() + 2;
    }
    extListLen = 0;
    if (!extensions.isEmpty()) {
        try {
            DerOutputStream extSequence = new DerOutputStream();
            DerOutputStream extEncoding = new DerOutputStream();
            for (Extension ext : extensions) {
                ext.encode(extEncoding);
            }
            extSequence.write(DerValue.tag_Sequence, extEncoding);
            extListLen = extSequence.size();
        } catch (IOException ioe) {
        // Not sure what to do here
        }
    }
    // Total length is the responder ID list length and extensions length
    // plus each lists' 2-byte length fields.
    encodedLen = ridListLen + extListLen + 4;
    return encodedLen;
}
Also used : Extension(java.security.cert.Extension) DerOutputStream(sun.security.util.DerOutputStream) ResponderId(sun.security.provider.certpath.ResponderId) IOException(java.io.IOException)

Aggregations

Extension (java.security.cert.Extension)3 ResponderId (sun.security.provider.certpath.ResponderId)3 DerOutputStream (sun.security.util.DerOutputStream)2 IOException (java.io.IOException)1