|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.sap.security.core.server.https.Utils
This class contains several static utility methods for use with SecureConnectionFactory.
Copyright (c) 2003 SAP AG.
| Constructor Summary | |
Utils()
|
|
| Method Summary | |
KeyStore |
convertCertificateToKeyStore(InputStream is,
char[] password)
converts a single certificate to a java KeyStore instance, which can be used as trusted CA keystore for SecureConnectionFactory. |
static KeyStore |
convertPKCS12ToKeyStore(InputStream certStream,
char[] password)
converts a PKCS#12 structure to a java KeyStore instance, which can be used as credentials keystore for SecureConnectionFactory. |
KeyStore |
convertPKCS7ToKeyStore(InputStream is,
char[] password)
converts a PKCS#7 chain of certificates to a java KeyStore instance |
static List |
getClientAliases(KeyStore keystore)
Returns a list of client aliases identifying client certificates |
static Hashtable |
getHttpHeaders(HttpURLConnection con)
Extracts http-headers from HttpURLConnection |
static KeyStore |
getJavaDefaultKeystore()
Looks for default SUN Keystore (cacerts), loads and returns it as KeyStore object. |
static Socket |
getProxySocket(String host,
int port)
Creates a socket for SSL over proxy, which can be used in createSocket-method.
|
static Socket |
getProxySocket(String host,
int port,
String proxyServer,
int proxyPort)
Creates a socket for SSL over proxy, which can be used in createSocket-method. |
static Socket |
getProxySocket(String host,
int port,
String proxyServer,
int proxyPort,
String proxyusr,
String proxypwd)
Creates a socket for SSL over proxy, which can be used in createSocket-method.
|
static Socket |
getProxySocket(String host,
int port,
String proxyusr,
String proxypwd)
Creates a socket for SSL over proxy, which can be used in createSocket-method.
|
protected static Socket |
getProxySocket(String host,
int port,
String authenticationMechanism,
String proxyServer,
int proxyPort,
String proxyusr,
String proxypwd)
|
boolean |
hasClientCertificates(KeyStore keystore)
Checks whether the keystore contains client certificates. |
static String |
headersToString(Hashtable headers)
Visualizes http-headers from HttpURLConnection. |
static boolean |
isNonProxyHost(String host)
Tests if the connection to the host should be established using proxy settings configured in system properties. |
static byte[] |
loadAsBytes(HttpURLConnection con)
Reads all available data from InputStream provided by given connection. |
static byte[] |
loadAsBytes(InputStream input)
Reads all available data from provided InputStream. |
static void |
setBasicAuthenticationHeader(HttpURLConnection con,
String username,
String pwd)
Adds basic-authentication header to a HttpURLConnection. |
static void |
setHostnameVerifier(HttpURLConnection con,
HostnameVerifier verifier)
|
static void |
setIgnoreServerCertificate(HttpURLConnection con)
Skips server certificate verification for given connection. |
static void |
setIgnoreServerCertificate(Socket socket)
Skips server certificate verification for a given socket. |
static void |
setProxyAuthentication(HttpURLConnection con,
String proxyuser,
String proxypwd)
Adds proxy authentication header to a HttpURLConnection. |
static void |
setSSLDebugStream(HttpURLConnection con,
OutputStream os)
Replicates the debugging outputs to specified output stream (e.g. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Utils()
| Method Detail |
public static Socket getProxySocket(String host,
int port)
throws IOException
createSocket-method.
https.proxyHost
and https.proxyPort.host - the hostnameport - the portIOException -
public static Socket getProxySocket(String host,
int port,
String proxyusr,
String proxypwd)
throws IOException
createSocket-method.
https.proxyHost
and https.proxyPort.host - the hostnameport - the portIOException -
public static Socket getProxySocket(String host,
int port,
String proxyServer,
int proxyPort)
throws IOException
createSocket-method.host - the hostnameport - the portproxyServer - the name of proxy serverproxyPort - the port of proxy serverIOException -
public static Socket getProxySocket(String host,
int port,
String proxyServer,
int proxyPort,
String proxyusr,
String proxypwd)
throws IOException
createSocket-method.
host - the hostnameport - the portproxyServer - the name of proxy serverproxyPort - the port of proxy serverproxyusr - user name for proxy authenticationproxypwd - password for proxy authenticationIOException -
protected static Socket getProxySocket(String host,
int port,
String authenticationMechanism,
String proxyServer,
int proxyPort,
String proxyusr,
String proxypwd)
throws IOException
public static KeyStore getJavaDefaultKeystore()
public static void setBasicAuthenticationHeader(HttpURLConnection con,
String username,
String pwd)
con - a HttpURLConnection objectusername - the usernamepwd - the password (in plain text)
public static void setProxyAuthentication(HttpURLConnection con,
String proxyuser,
String proxypwd)
con - a HttpURLConnection objectproxyuser - the username for proxy authenticationproxypwd - the password (in plain text) for proxy authentication
public static byte[] loadAsBytes(HttpURLConnection con)
throws IOException
con - a HttpURLConnection objectIOException - if occurs during reading from InputStream
public static byte[] loadAsBytes(InputStream input)
throws IOException
input - the InputStreamIOException - if occurs during reading from InputStreampublic static Hashtable getHttpHeaders(HttpURLConnection con)
con - a HttpURLConnection objectpublic static String headersToString(Hashtable headers)
con - a HttpURLConnection objectpublic static void setIgnoreServerCertificate(HttpURLConnection con)
con - a HttpURLConnection objectpublic static void setIgnoreServerCertificate(Socket socket)
socket - a Socket object
public static void setHostnameVerifier(HttpURLConnection con,
HostnameVerifier verifier)
public static void setSSLDebugStream(HttpURLConnection con,
OutputStream os)
con - an instance of HttpURLConnectionout - OuputStram to write topublic static boolean isNonProxyHost(String host)
host - Hostname
public KeyStore convertPKCS7ToKeyStore(InputStream is,
char[] password)
throws KeyStoreException,
CertificateException
is - InputStream (pkcs#7 data)password - (will be ignored)
public KeyStore convertCertificateToKeyStore(InputStream is,
char[] password)
throws KeyStoreException,
CertificateException
is - InputStream (X509 certificate)password - (will be ignored)
public static KeyStore convertPKCS12ToKeyStore(InputStream certStream,
char[] password)
throws KeyStoreException,
CertificateException
is - InputStream (with PKCS#12 format)password -
public static List getClientAliases(KeyStore keystore)
throws KeyStoreException
public boolean hasClientCertificates(KeyStore keystore)
throws KeyStoreException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||