Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.knipp.rritoolkit.tcp
Class TcpParams

    java.lang.Object
      de.knipp.rritoolkit.tcp.TcpParams

    public class TcpParams

extends java.lang.Object

class that holds the configuration data for the TCP connection

Version:
  $Revision: 14936 $
Author:
  Klaus Malorny

Field Summary
`private java.security.KeyStore` | `certKeyStore` the keystore that holds the own certificates
`private java.lang.String` | `certPassword` the password for the certificate
`private java.lang.String` | `clientCertAlgorithm` the client cert algorithm
`private long` | `idleTimeout` the idle timeout in milliseconds (`0` = off)
`private int` | `maxReceiveSize` the maximum receive message size
`private java.lang.String` | `protocol` the protocol
`private int` | `receiveTimeout` the wait timeout in milliseconds
`private java.net.InetAddress` | `serverAddress` the address of the server
`private int` | `serverPort` the port number of the server
`private java.lang.String` | `trustedCertsAlgorithm` the trust certs algorithm
`private java.security.KeyStore` | `trustKeyStore` the keystore that holds the trusted root certificates
`private boolean` | `verifyServerName` flag whether to check the CN

Constructor Summary
`TcpParams()` constructor.
`TcpParams(TcpParams other)` copy constructor

Method Summary
`java.lang.String` | `getCertAlgorithm()` return the name of the client certificate algorithm
`java.security.KeyStore` | `getCertKeyStore()` return the client key store
`java.lang.String` | `getCertPassword()` return the password for the private key of the client certificate
`long` | `getIdleTimeout()` return the delay from which on an idle connection is considered as closed
`int` | `getMaxReceiveSize()` return the maximum message size that is accepted.
`java.lang.String` | `getProtocol()` return the name of the SSL protocol
`int` | `getReceiveTimeout()` return the maximum time to wait for a response
`java.net.InetAddress` | `getServerAddress()` return the server address
`int` | `getServerPort()` return the server port number
`java.lang.String` | `getTrustAlgorithm()` return the name of the trusted certificates algorithm
`java.security.KeyStore` | `getTrustKeyStore()` return the client key store
`private static java.security.KeyStore` | `loadKeyStore(java.io.File file, java.lang.String storeType, java.lang.String storePassword)` load a key store from the given file
`private static java.security.KeyStore` | `loadKeyStore(java.io.InputStream is, java.lang.String storeType, java.lang.String storePassword)` load a key store
`void` | `setCertAlgorithm(java.lang.String algorithm)` set the name of the client certificate algorithm
`void` | `setCertKeyStore(java.io.File file, java.lang.String storeType, java.lang.String storePassword)` set the client certificate key store
`void` | `setCertKeyStore(java.io.InputStream is, java.lang.String storeType, java.lang.String storePassword)` set the client certificate key store
`void` | `setCertKeyStore(java.security.KeyStore keyStore)` set the client certificate key store
`void` | `setCertPassword(java.lang.String password)` set the password for the private key of the client certificate
`void` | `setIdleTimeout(long timeout)` set the delay from which on an idle connection is considered as closed
`void` | `setMaxReceiveSize(int maxSize)` set the maximum message size that is accepted.
`void` | `setProtocol(java.lang.String theProtocol)` set the name of the SSL protocol
`void` | `setReceiveTimeout(int timeout)` set the maximum time to wait for a response
`void` | `setServerAddress(java.net.InetAddress address)` set the server address
`void` | `setServerPort(int port)` set the server port number
`void` | `setTrustAlgorithm(java.lang.String algorithm)` set the name of the trusted certificates algorithm
`void` | `setTrustKeyStore(java.io.File file, java.lang.String storeType, java.lang.String storePassword)` set the trust certificate key store
`void` | `setTrustKeyStore(java.io.InputStream is, java.lang.String storeType, java.lang.String storePassword)` set the trust certificate key store
`void` | `setTrustKeyStore(java.security.KeyStore keyStore)` set the trust certificate key store
`void` | `setupFromProperties(java.util.Properties props, java.lang.String prefix)` initialize the object from the given properties.
`void` | `setVerifyServerName(boolean verify)` set whether the common name of the server certificate shall be verified, i.e. shall be compared to the reverse mapping of the server address.
`boolean` | `verifyServerName()` return whether the server name shall be verified

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### serverAddress

    private java.net.InetAddress serverAddress

  the address of the server

### serverPort

    private int serverPort

  the port number of the server

### protocol

    private java.lang.String protocol

  the protocol

### clientCertAlgorithm

    private java.lang.String clientCertAlgorithm

  the client cert algorithm

### trustedCertsAlgorithm

    private java.lang.String trustedCertsAlgorithm

  the trust certs algorithm

### certPassword

    private java.lang.String certPassword

  the password for the certificate

### certKeyStore

    private java.security.KeyStore certKeyStore

  the keystore that holds the own certificates

### trustKeyStore

    private java.security.KeyStore trustKeyStore

  the keystore that holds the trusted root certificates

### verifyServerName

    private boolean verifyServerName

  flag whether to check the CN

### maxReceiveSize

    private int maxReceiveSize

  the maximum receive message size

### receiveTimeout

    private int receiveTimeout

  the wait timeout in milliseconds

### idleTimeout

    private long idleTimeout

  the idle timeout in milliseconds (`0` = off)

Constructor Detail

### TcpParams

    public TcpParams()

  constructor. The protocol and the algorithms are initialized with Sun's recommendations.

### TcpParams

    public TcpParams(TcpParams other)

  copy constructor

  Parameters:
    `other` - the other instance to copy from

Method Detail

### setServerAddress

    public void setServerAddress(java.net.InetAddress address)

  set the server address

  Parameters:
    `address` - the address

### getServerAddress

    public java.net.InetAddress getServerAddress()

  return the server address

  Returns:
    the server address

### setServerPort

    public void setServerPort(int port)

  set the server port number

  Parameters:
    `port` - the port number

### getServerPort

    public int getServerPort()

  return the server port number

  Returns:
    the port number

### setMaxReceiveSize

    public void setMaxReceiveSize(int maxSize)

  set the maximum message size that is accepted.

  Parameters:
    `maxSize` - the size or `0` for unlimited size

### getMaxReceiveSize

    public int getMaxReceiveSize()

  return the maximum message size that is accepted.

  Returns:
    the size or `0` for unlimited size

### setReceiveTimeout

    public void setReceiveTimeout(int timeout)

  set the maximum time to wait for a response

  Parameters:
    `timeout` - the timeout time in milliseconds, if `0`, it is waited indefinitely

### getReceiveTimeout

    public int getReceiveTimeout()

  return the maximum time to wait for a response

  Returns:
    the timeout time in milliseconds, if `0`, it is waited indefinitely

### setIdleTimeout

    public void setIdleTimeout(long timeout)

  set the delay from which on an idle connection is considered as closed

  Parameters:
    `timeout` - the idle timeout (off if `0`)

### getIdleTimeout

    public long getIdleTimeout()

  return the delay from which on an idle connection is considered as closed

  Returns:
    the idle timeout (`0` if off)

### setProtocol

    public void setProtocol(java.lang.String theProtocol)

  set the name of the SSL protocol

  Parameters:
    `theProtocol` - the protocol's name

### getProtocol

    public java.lang.String getProtocol()

  return the name of the SSL protocol

  Returns:
    the protocol's name

### setCertAlgorithm

    public void setCertAlgorithm(java.lang.String algorithm)

  set the name of the client certificate algorithm

  Parameters:
    `algorithm` - the name

### getCertAlgorithm

    public java.lang.String getCertAlgorithm()

  return the name of the client certificate algorithm

  Returns:
    the name

### setTrustAlgorithm

    public void setTrustAlgorithm(java.lang.String algorithm)

  set the name of the trusted certificates algorithm

  Parameters:
    `algorithm` - the name

### getTrustAlgorithm

    public java.lang.String getTrustAlgorithm()

  return the name of the trusted certificates algorithm

  Returns:
    the name

### loadKeyStore

    private static java.security.KeyStore loadKeyStore(java.io.InputStream is,
                                                       java.lang.String storeType,
                                                       java.lang.String storePassword)
                                                throws java.io.IOException,
                                                       java.security.GeneralSecurityException

  load a key store

  Parameters:
    `is` - the input stream
    `storeType` - the store type (may be `null` for the default type)
    `storePassword` - the store password (may be `null`)
  Returns:
    the loaded key store
  Throws:
    `java.io.IOException` - if the loading failed due to I/O problems
    `java.security.GeneralSecurityException` - if the key store could not be loaded

### loadKeyStore

    private static java.security.KeyStore loadKeyStore(java.io.File file,
                                                       java.lang.String storeType,
                                                       java.lang.String storePassword)
                                                throws java.io.IOException,
                                                       java.security.GeneralSecurityException

  load a key store from the given file

  Parameters:
    `file` - the file
    `storeType` - the store type (may be `null` for the default type)
    `storePassword` - the store password (may be `null`)
  Returns:
    the loaded key store
  Throws:
    `java.io.IOException` - if the loading failed due to I/O problems
    `java.security.GeneralSecurityException` - if the key store could not be loaded

### setCertKeyStore

    public void setCertKeyStore(java.security.KeyStore keyStore)

  set the client certificate key store

  Parameters:
    `keyStore` - the key store

### setCertKeyStore

    public void setCertKeyStore(java.io.InputStream is,
                                java.lang.String storeType,
                                java.lang.String storePassword)
                         throws java.io.IOException,
                                java.security.GeneralSecurityException

  set the client certificate key store

  Parameters:
    `is` - the input stream
    `storeType` - the store type (may be `null` for the default type)
    `storePassword` - the store password (may be `null`)
  Throws:
    `java.io.IOException` - if the loading failed due to I/O problems
    `java.security.GeneralSecurityException` - if the key store could not be loaded

### setCertKeyStore

    public void setCertKeyStore(java.io.File file,
                                java.lang.String storeType,
                                java.lang.String storePassword)
                         throws java.io.IOException,
                                java.security.GeneralSecurityException

  set the client certificate key store

  Parameters:
    `file` - the file
    `storeType` - the store type (may be `null` for the default type)
    `storePassword` - the store password (may be `null`)
  Throws:
    `java.io.IOException` - if the loading failed due to I/O problems
    `java.security.GeneralSecurityException` - if the key store could not be loaded

### getCertKeyStore

    public java.security.KeyStore getCertKeyStore()

  return the client key store

  Returns:
    the key store, may be `null`

### setCertPassword

    public void setCertPassword(java.lang.String password)

  set the password for the private key of the client certificate

  Parameters:
    `password` - the password, may be `null`

### getCertPassword

    public java.lang.String getCertPassword()

  return the password for the private key of the client certificate

  Returns:
    the password, may be `null`

### setTrustKeyStore

    public void setTrustKeyStore(java.security.KeyStore keyStore)

  set the trust certificate key store

  Parameters:
    `keyStore` - the key store

### setTrustKeyStore

    public void setTrustKeyStore(java.io.InputStream is,
                                 java.lang.String storeType,
                                 java.lang.String storePassword)
                          throws java.io.IOException,
                                 java.security.GeneralSecurityException

  set the trust certificate key store

  Parameters:
    `is` - the input stream
    `storeType` - the store type (may be `null` for the default type)
    `storePassword` - the store password (may be `null`)
  Throws:
    `java.io.IOException` - if the loading failed due to I/O problems
    `java.security.GeneralSecurityException` - if the key store could not be loaded

### setTrustKeyStore

    public void setTrustKeyStore(java.io.File file,
                                 java.lang.String storeType,
                                 java.lang.String storePassword)
                          throws java.io.IOException,
                                 java.security.GeneralSecurityException

  set the trust certificate key store

  Parameters:
    `file` - the file
    `storeType` - the store type (may be `null` for the default type)
    `storePassword` - the store password (may be `null`)
  Throws:
    `java.io.IOException` - if the loading failed due to I/O problems
    `java.security.GeneralSecurityException` - if the key store could not be loaded

### getTrustKeyStore

    public java.security.KeyStore getTrustKeyStore()

  return the client key store

  Returns:
    the key store, may be `null`

### setVerifyServerName

    public void setVerifyServerName(boolean verify)

  set whether the common name of the server certificate shall be verified, i.e. shall be compared to the reverse mapping of the server address.

  Parameters:
    `verify` - if `true`, the name is verified

### verifyServerName

    public boolean verifyServerName()

  return whether the server name shall be verified

  Returns:
    `true` if so

### setupFromProperties

    public void setupFromProperties(java.util.Properties props,
                                    java.lang.String prefix)
                             throws java.io.IOException,
                                    java.security.GeneralSecurityException,
                                    java.lang.NumberFormatException

  initialize the object from the given properties. Missing properties cause the respective data unchanged. The following properties are recognized:

  prefixserver.name | required | Host name or IP address of server
  prefixserver.port | required | Port number
  prefixprotocol | optional | The protocol name
  prefixcert.algorithm | optional | The designated algorithm for dealing with client certificates
  prefixcert.keystore.path | optional | The path to the file containing the client certificate
  prefixcert.keystore.type | optional | The type of the key store, typically "jks" or "pkcs12"
  prefixcert.keystore.password | optional | The password, if the keystore is protected
  prefixcert.password | optional | The password for the certificate itself
  prefixtrust.algorithm | optional | The designated algorithm for dealing with trusted certificates
  prefixtrust.keystore.path | optional | The path to the file containing the trusted root certificates
  prefixtrust.keystore.type | optional | The type of the key store, typically "jks" or "pkcs12"
  prefixtrust.keystore.password | optional | The password, if the keystore is protected
  prefixtrust.verifyname | optional | Specifies whether the name shall be verified. If "true" or "yes" (case insensitive) are specified, the verification is done
  prefixtimeout.receive | optional | the timeout in milliseconds when reading responses from the server
  prefixtimeout.idle | optional | the idle timeout in milliseconds. If the given time no communication has taken place, the connection is considered as closed

  Parameters:
    `props` - the properties
    `prefix` - the prefix
  Throws:
    `java.io.IOException` - if the specified files could not be loaded
    `java.security.GeneralSecurityException` - if the key stores or the passwords are invalid
    `java.lang.NumberFormatException` - if a numeric property is not parsable

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2011 Knipp Medien und Kommunikation GmbH