HPOS 4.0 technical note 3

HP Web Services for Output Server 49
Using HP Web Services for Output Server
SSL
StringBuilder sb = new StringBuilder(bytes.length * 3);
for (int b : bytes) {
b &= 0xff;
sb.append(HEXDIGITS[b >> 4]);
sb.append(HEXDIGITS[b & 15]);
sb.append(' ');
}
return sb.toString();
}
private static class SavingTrustManager implements X509TrustManager {
private final X509TrustManager tm;
private X509Certificate[] chain;
SavingTrustManager(X509TrustManager tm) {
this.tm = tm;
}
public X509Certificate[] getAcceptedIssuers() {
throw new UnsupportedOperationException();
}
public void checkClientTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
throw new UnsupportedOperationException();
}
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
this.chain = chain;
tm.checkServerTrusted(chain, authType);
}
}
}
You must change the host and the specified port in the code to import the certificate, and you must specify the file on
the client to which you want the Public key information to be written. Therefore, use the file in Web Service client
program to invoke the Web Services for Output Server through SSL.
An example of portion of code is as follows:
//This is the path to which the Public key from the server certificate is imported:
private static final String TRUSTSTORE_URL="c:\\jssecacerts";
private static final String TRUSTSTORE_PW="changeit";
static
{
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(