java.lang.Object
java.net.ServerSocket
javax.net.ssl.SSLServerSocket
- See Also:
- Top Examples, Source Code,
SSLSocket
public abstract String[] getEnabledCipherSuites()
- See Also:
setEnabledCipherSuites(String [])
, getSupportedCipherSuites()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1198]Write File over SSL
By jiten_sham { at } yahoo { dot } co { dot } in on 2004/12/16 09:57:45 Rate
import java.awt.*;
import java.io.*;
import java.lang.*;
import java.applet.*;
import java.security.*;
import javax.net.ssl.*;
public class writeFileSSL extends Applet
{
String myFile = "/too/foo";
File f = new File ( myFile ) ;
DataOutputStream dos;
public void init ( )
{
String osname = System.getProperty ( "os.name" ) ;
if ( osname.indexOf ( "Windows" ) != -1 )
{
myFile="C:" + File.separator + "tmpfoo";
System.out.println ( "Ok" ) ;
}
}
public void paint ( Graphics g )
{
try
{
// If the following property is null just connect to localhost
String hostname = System.getProperty ( "writeFileSSL.hostname" ) ;
if ( hostname == null )
hostname = "localhost"; //localhost
Security.addProvider ( new com.sun.net.ssl.internal.ssl.Provider ( ) ) ;
SSLSocketFactory sslFact = ( SSLSocketFactory ) SSLSocketFactory.getDefault ( ) ;
SSLSocket s = ( SSLSocket ) sslFact.createSocket ( hostname, 8181 ) ;
OutputStream out = s.getOutputStream ( ) ;
BufferedReader in = new BufferedReader ( new InputStreamReader ( s.getInputStream ( ) ) ) ;
String str = in.readLine ( ) ;
s.close ( ) ;
dos = new DataOutputStream ( new BufferedOutputStream ( new FileOutputStream ( myFile ) ,128 ) ) ;
dos.writeBytes ( "Cats can still hypnotize you when you least expect it\n" ) ;
if ( str != null )
dos.writeBytes ( str ) ;
dos.flush ( ) ;
dos.close ( ) ;
g.drawString ( "Successfully wrote to the file named " + myFile + " -- go take a look at it!", 10, 10 ) ;
}
catch ( SecurityException e )
{
g.drawString ( "writeFile: caught security exception", 10, 10 ) ;
}
catch ( IOException ioe )
{
g.drawString ( "writeFile: caught i/o exception", 10, 10 ) ;
System.out.println ( ioe ) ;
}
}
public static void main ( String args [ ] )
{
Frame f = new Frame ( "writeFile" ) ;
writeFileSSL writefile = new writeFileSSL ( ) ;
writefile.init ( ) ;
writefile.start ( ) ;
f.add ( "Center", writefile ) ;
f.setSize ( 300, 100 ) ;
f.setVisible ( true ) ;
}
}
public abstract String[] getEnabledProtocols()
- See Also:
setEnabledProtocols(String [])
, getSupportedProtocols()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract boolean getEnableSessionCreation()
- See Also:
setEnableSessionCreation(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract boolean getNeedClientAuth()
- See Also:
setUseClientMode(boolean)
, getWantClientAuth()
, setWantClientAuth(boolean)
, setNeedClientAuth(boolean)
, SSLSocket.setWantClientAuth(boolean)
, SSLSocket.setNeedClientAuth(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract String[] getSupportedCipherSuites()
- See Also:
setEnabledCipherSuites(String [])
, getEnabledCipherSuites()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract String[] getSupportedProtocols()
- See Also:
setEnabledProtocols(String [])
, getEnabledProtocols()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract boolean getUseClientMode()
- See Also:
setUseClientMode(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract boolean getWantClientAuth()
- See Also:
setUseClientMode(boolean)
, getNeedClientAuth()
, setNeedClientAuth(boolean)
, setWantClientAuth(boolean)
, SSLSocket.setWantClientAuth(boolean)
, SSLSocket.setNeedClientAuth(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setEnabledCipherSuites(String[] suites)
- See Also:
getEnabledCipherSuites()
, getSupportedCipherSuites()
, IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setEnabledProtocols(String[] protocols)
- See Also:
getSupportedProtocols()
, getEnabledProtocols()
, IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setEnableSessionCreation(boolean flag)
- See Also:
getEnableSessionCreation()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setNeedClientAuth(boolean need)
- See Also:
setUseClientMode(boolean)
, getWantClientAuth()
, setWantClientAuth(boolean)
, getNeedClientAuth()
, SSLSocket.setWantClientAuth(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setUseClientMode(boolean mode)
- See Also:
getUseClientMode()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setWantClientAuth(boolean want)
- See Also:
setUseClientMode(boolean)
, getNeedClientAuth()
, setNeedClientAuth(boolean)
, getWantClientAuth()
, SSLSocket.setNeedClientAuth(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected SSLServerSocket()
throws IOException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected SSLServerSocket(int port)
throws IOException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected SSLServerSocket(int port,
int backlog)
throws IOException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected SSLServerSocket(int port,
int backlog,
InetAddress address)
throws IOException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples