iaik.security.ssl
Class Utils

java.lang.Object
  |
  +--iaik.security.ssl.Utils

public class Utils
extends java.lang.Object

Some basic utility methods.


Field Summary
static java.lang.String PROPERTYNAME_HTTPS_PROXY_HOST
          Constant string "https.proxyHost".
static java.lang.String PROPERTYNAME_HTTPS_PROXY_PORT
          Constant string "https.proxyPort".
 
Method Summary
static boolean equalsBlock(byte[] a, byte[] b)
          Check two blocks for equality.
static boolean equalsBlock(byte[] a, int aOff, byte[] b, int bOff, int len)
          Check two blocks for equality.
static java.io.BufferedReader getASCIIReader(java.io.InputStream in)
          Get a reader that returns data from the stream assuming ASCII encoding is used.
static java.io.PrintWriter getASCIIWriter(java.io.OutputStream out)
          Get a writer that writes data to the stream in ASCII encoding is used.
static java.io.PrintWriter getASCIIWriter(java.io.OutputStream out, boolean autoflush)
          Get a writer that writes data to the stream in ASCII encoding is used.
static SSLSocket proxyConnect(java.net.InetAddress address, int port, SSLContext context)
          Connect to the specified host via HTTPS proxy (if set via properties).
static SSLSocket proxyConnect(java.net.InetAddress address, int port, SSLContext context, java.net.InetAddress proxyAddress, int proxyPort)
           
static SSLSocket proxyConnect(java.lang.String address, int port, SSLContext context, java.net.Socket proxySocket)
          Connect to the specified host via HTTPS proxy (if set via properties).
static java.lang.String toString(int a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTYNAME_HTTPS_PROXY_HOST

public static final java.lang.String PROPERTYNAME_HTTPS_PROXY_HOST
Constant string "https.proxyHost". Property specifying a HTTPS proxy (if set)

PROPERTYNAME_HTTPS_PROXY_PORT

public static final java.lang.String PROPERTYNAME_HTTPS_PROXY_PORT
Constant string "https.proxyPort". Property specifying a HTTPS proxy (if set)
Method Detail

equalsBlock

public static boolean equalsBlock(byte[] a,
                                  int aOff,
                                  byte[] b,
                                  int bOff,
                                  int len)
Check two blocks for equality. The specified sub blocks of the given byte arrays are checked for equality.
Parameters:
a - the first byte array to be compared
aOff - the offset indicating the start position of the sub-block of a
b - the second byte array to be compared
bOff - the offset indicating the start position of the sub-block of b
len - the number of bytes to be compared
Returns:
true, if the two sub-blocks are equal, false otherwise

equalsBlock

public static boolean equalsBlock(byte[] a,
                                  byte[] b)
Check two blocks for equality.
Parameters:
a - the first byte array to be compared
b - the second byte array to be compared
Returns:
true, if the two blocks are equal, false otherwise

toString

public static java.lang.String toString(int a)

proxyConnect

public static SSLSocket proxyConnect(java.net.InetAddress address,
                                     int port,
                                     SSLContext context)
                              throws java.io.IOException
Connect to the specified host via HTTPS proxy (if set via properties). If the HTTPS proxy properties are set a connection is made via the proxy, otherwise the connection is made directly. If an error occurs connecting through the proxy an IOException is thrown. Note that proxy authentication is currently not supported.

proxyConnect

public static SSLSocket proxyConnect(java.lang.String address,
                                     int port,
                                     SSLContext context,
                                     java.net.Socket proxySocket)
                              throws java.io.IOException
Connect to the specified host via HTTPS proxy (if set via properties). If proxyAddress is not null a connection is made via the proxy, otherwise the connection is made directly. If an error occurs connecting through the proxy an IOException is thrown. Note that proxy authentication is currently not supported.

proxyConnect

public static SSLSocket proxyConnect(java.net.InetAddress address,
                                     int port,
                                     SSLContext context,
                                     java.net.InetAddress proxyAddress,
                                     int proxyPort)
                              throws java.io.IOException

getASCIIReader

public static java.io.BufferedReader getASCIIReader(java.io.InputStream in)
Get a reader that returns data from the stream assuming ASCII encoding is used. This is useful when connecting over the network as both peers obviously have to use the same encoding which is defined as ASCII for most common text protocols (HTTP, HTTPS, etc.).

getASCIIWriter

public static java.io.PrintWriter getASCIIWriter(java.io.OutputStream out)
Get a writer that writes data to the stream in ASCII encoding is used. This is useful when connecting over the network as both peers obviously have to use the same encoding which is defined as ASCII for most common text protocols (HTTP, HTTPS, etc.).

getASCIIWriter

public static java.io.PrintWriter getASCIIWriter(java.io.OutputStream out,
                                                 boolean autoflush)
Get a writer that writes data to the stream in ASCII encoding is used. This is useful when connecting over the network as both peers obviously have to use the same encoding which is defined as ASCII for most common text protocols (HTTP, HTTPS, etc.). The autoflush parameter specifies if the PrintWriter is to be created with autoflush set.