You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
250 lines
8.5 KiB
250 lines
8.5 KiB
//Auto-generated by kalyptus. DO NOT EDIT.
|
|
package org.kde.koala;
|
|
|
|
import org.kde.qt.Qt;
|
|
import org.kde.qt.QtSupport;
|
|
|
|
/**
|
|
|
|
KDE SSL Wrapper Class
|
|
This class implements KDE's SSL support by wrapping OpenSSL.
|
|
@author George Staikos <staikos@kde.org>
|
|
|
|
@short KDE SSL Class.
|
|
@see KExtendedSocket
|
|
@see TCPSlaveBase
|
|
|
|
*/
|
|
public class KSSL implements QtSupport {
|
|
private long _qt;
|
|
private boolean _allocatedInJavaWorld = true;
|
|
protected KSSL(Class dummy){}
|
|
|
|
/**
|
|
Construct a KSSL object
|
|
@param init Set this to false if you do not want this class to
|
|
immediately initialize OpenSSL.
|
|
@short Construct a KSSL object
|
|
*/
|
|
public KSSL(boolean init) {
|
|
newKSSL(init);
|
|
}
|
|
private native void newKSSL(boolean init);
|
|
public KSSL() {
|
|
newKSSL();
|
|
}
|
|
private native void newKSSL();
|
|
/**
|
|
Initialize OpenSSL.
|
|
This will do nothing if it is already initialized.
|
|
@return true on success
|
|
|
|
@short Initialize OpenSSL.
|
|
@see #reInitialize
|
|
*/
|
|
public native boolean initialize();
|
|
/**
|
|
This is used for applicationss which do STARTTLS or something
|
|
similar. It creates a TLS method regardless of the user's settings.
|
|
@return true if TLS is successfully initialized
|
|
|
|
@short This is used for applicationss which do STARTTLS or something similar.
|
|
*/
|
|
public native boolean TLSInit();
|
|
/**
|
|
Set an SSL session to use. This deep copies the session so it
|
|
doesn't have to remain valid. You need to call it after calling
|
|
initialize or reInitialize. The ID is cleared in close().
|
|
@param session A valid session to reuse. If null, it will clear the
|
|
session ID in memory.
|
|
@return true on success
|
|
|
|
@short Set an SSL session to use.
|
|
*/
|
|
public native boolean setSession(KSSLSession session);
|
|
/**
|
|
Close the SSL session.
|
|
@short Close the SSL session.
|
|
*/
|
|
public native void close();
|
|
/**
|
|
Reinitialize OpenSSL.
|
|
This is not generally needed unless you are reusing the KSSL object
|
|
for a new session.
|
|
@return true on success
|
|
|
|
@short Reinitialize OpenSSL.
|
|
@see #initialize
|
|
*/
|
|
public native boolean reInitialize();
|
|
/**
|
|
Trigger a reread of KSSL configuration and reInitialize() KSSL.
|
|
If you setAutoReconfig() to false, then this will simply
|
|
reInitialize() and not read in the new configuration.
|
|
@return true on successful reinitalizations
|
|
|
|
@short Trigger a reread of KSSL configuration and reInitialize() KSSL.
|
|
@see #setAutoReconfig
|
|
*/
|
|
public native boolean reconfig();
|
|
/**
|
|
Enable or disable automatic reconfiguration on initialize().
|
|
@param ar Set to false in order to disable auto-reloading of the
|
|
KSSL configuration during initialize().
|
|
By default, KSSL will read its configuration on initialize(). You
|
|
might want to disable this for performance reasons.
|
|
@short Enable or disable automatic reconfiguration on initialize().
|
|
*/
|
|
public native void setAutoReconfig(boolean ar);
|
|
/**
|
|
This will reseed the pseudo-random number generator with the EGD
|
|
(entropy gathering daemon) if the EGD is configured and enabled.
|
|
You don't need to call this yourself normally.
|
|
@return 0 on success
|
|
|
|
@short This will reseed the pseudo-random number generator with the EGD (entropy gathering daemon) if the EGD is configured and enabled.
|
|
*/
|
|
public native int seedWithEGD();
|
|
/**
|
|
Set a new KSSLSettings instance as the settings. This deletes the
|
|
current instance of KSSLSettings.
|
|
@param settings A new, valid settings object.
|
|
@return true on success
|
|
|
|
@short Set a new KSSLSettings instance as the settings.
|
|
*/
|
|
public native boolean setSettings(KSSLSettings settings);
|
|
/**
|
|
One is built by the constructor, so this will only return a NULL
|
|
pointer if you set one with setSettings().
|
|
@return the current settings instance
|
|
|
|
@short One is built by the constructor, so this will only return a NULL pointer if you set one with setSettings().
|
|
*/
|
|
public native KSSLSettings settings();
|
|
/**
|
|
Use this to set the certificate to send to the server.
|
|
Do NOT delete the KSSLPKCS12 object until you are done with the
|
|
session. It is not defined when KSSL will be done with this.
|
|
@param pkcs the valid PKCS#12 object to send.
|
|
@return true if the certificate was properly set to the session.
|
|
|
|
@short Use this to set the certificate to send to the server.
|
|
*/
|
|
public native boolean setClientCertificate(KSSLPKCS12 pkcs);
|
|
/**
|
|
Set the peer hostname to be used for certificate verification.
|
|
@param realHost the remote hostname as the user believes to be
|
|
connecting to
|
|
@short Set the peer hostname to be used for certificate verification.
|
|
*/
|
|
public native void setPeerHost(String realHost);
|
|
public native void setPeerHost();
|
|
/**
|
|
Connect the SSL session to the remote host using the provided
|
|
socket descriptor.
|
|
@param sock the socket descriptor to connect with. This must be
|
|
an already connected socket.
|
|
@return 1 on success, 0 on error setting the file descriptor,
|
|
-1 on other error.
|
|
|
|
@short Connect the SSL session to the remote host using the provided socket descriptor.
|
|
*/
|
|
public native int connect(int sock);
|
|
/**
|
|
Connect the SSL session to the remote host using the provided
|
|
socket descriptor. This is for use with an SSL server application.
|
|
@param sock the socket descriptor to connect with. This must be
|
|
an already connected socket.
|
|
@return 1 on success, 0 on error setting the file descriptor,
|
|
-1 on other error.
|
|
|
|
@short Connect the SSL session to the remote host using the provided socket descriptor.
|
|
*/
|
|
public native int accept(int sock);
|
|
/**
|
|
Read data from the remote host via SSL.
|
|
@param buf the buffer to read the data into.
|
|
@param len the maximum length of data to read.
|
|
@return the number of bytes read, 0 on an exception, or -1 on error.
|
|
|
|
@short Read data from the remote host via SSL.
|
|
*/
|
|
// int read(void* arg1,int arg2); >>>> NOT CONVERTED
|
|
/**
|
|
Peek at available data from the remote host via SSL.
|
|
@param buf the buffer to read the data into.
|
|
@param len the maximum length of data to read.
|
|
@return the number of bytes read, 0 on an exception, or -1 on error.
|
|
|
|
@short Peek at available data from the remote host via SSL.
|
|
*/
|
|
// int peek(void* arg1,int arg2); >>>> NOT CONVERTED
|
|
/**
|
|
Write data to the remote host via SSL.
|
|
@param buf the buffer to read the data from.
|
|
@param len the length of data to send from the buffer.
|
|
@return the number of bytes written, 0 on an exception,
|
|
or -1 on error.
|
|
|
|
@short Write data to the remote host via SSL.
|
|
*/
|
|
// int write(const void* arg1,int arg2); >>>> NOT CONVERTED
|
|
/**
|
|
Determine if data is waiting to be read.
|
|
@return -1 on error, 0 if no data is waiting, > 0 if data is waiting.
|
|
|
|
@short Determine if data is waiting to be read.
|
|
*/
|
|
public native int pending();
|
|
/**
|
|
Obtain a reference to the connection information.
|
|
@return a reference to the connection information,
|
|
valid after connected
|
|
|
|
@short Obtain a reference to the connection information.
|
|
@see KSSLConnectionInfo
|
|
*/
|
|
public native KSSLConnectionInfo connectionInfo();
|
|
/**
|
|
Obtain a reference to the information about the peer.
|
|
@return a reference to the peer information,
|
|
valid after connected
|
|
|
|
@short Obtain a reference to the information about the peer.
|
|
@see KSSLPeerInfo
|
|
*/
|
|
public native KSSLPeerInfo peerInfo();
|
|
/**
|
|
Obtain a pointer to the session information.
|
|
@return a pointer to the session information.
|
|
This is valid after connected, while connected.
|
|
It is deleted by the KSSL object which returns it.
|
|
May return 0L if no valid session exists.
|
|
|
|
@short Obtain a pointer to the session information.
|
|
@see KSSLSession
|
|
*/
|
|
public native KSSLSession session();
|
|
/**
|
|
Determine if we are currently reusing an SSL session ID.
|
|
@return true if we are reusing a session ID.
|
|
|
|
@short Determine if we are currently reusing an SSL session ID.
|
|
*/
|
|
public native boolean reusingSession();
|
|
/**
|
|
Determine if SSL is available and works.
|
|
@return true is SSL is available and usable
|
|
|
|
@short Determine if SSL is available and works.
|
|
*/
|
|
public static native boolean doesSSLWork();
|
|
/** Deletes the wrapped C++ instance */
|
|
protected native void finalize() throws InternalError;
|
|
/** Delete the wrapped C++ instance ahead of finalize() */
|
|
public native void dispose();
|
|
/** Has the wrapped C++ instance been deleted? */
|
|
public native boolean isDisposed();
|
|
}
|