![]() |
![]() |
![]() |
java -Djava.security.manager
System.setSecurityManager(new SecurityManager())
This may fail if the current security permisssions do not allow
a security manager to be set. If
System.getSecurityManager()
is null
then a security manager can always be set
SecurityManager
that is in the
JDK is RMISecurityManager
that allows code to be
downloaded across the network - for remote code only.
Used by RMI and Jini applications
java -Djava.security.policy=someURL
permission java.io.FilePermission "/tmp/*", "read, write";
permission java.lang.RuntimePermission "exitVM", "true";
/tmp
directory is allowed, but not the FilePermission
to write to any other directory
RuntimePermission
to stopThread
jre/lib/ext
.
These classes are completely trusted
grant {
permission java.net.SocketPermission "224.0.1.85", "connect,accept";
permission java.net.SocketPermission "*.edu.au:80", "connect";
}
grant codebase "http://sunshade.dstc.edu.au/classes/" {
permission java.security.AllPermission "", "";
}
grant signedBy "sysadmin" {
permission java.security.AllPermission "", "";
}
keystore "url", "keystore-type"
e.g.
keystore "file:/home/jan/.keystore", "JKS";
keytool
keytool -keystore ~jan/.keystore -list # list known keys
keytool -keystore ~jan/.keystore -storepasswd -new
# generate password for store access
keytool -keystore ~jan/.keystore -genkey
# generate a new private/public key
keytool -keystore ~jan/.keystore -export
# export keys to a file for transmission
jarsigner
DES
DES/CBC/PKCS5Padding
Cipher
class is used by JCE to handle crypto
Cipher
public static Cipher getInstance(String transformation)
init()
init(int opmode, Key key)
init(opmode, Certificate cert)
// etc
where opmode
is one of ENCRYPT_MODE
or DECRYPT_MODE
public byte[] doFinal(byte[] input)
I can't get this to see any certificates yet
keytool -genkey -keystore mykeystore -alias "..." -keypass "..."
keytool -export -alias "..." -keystore keystore -file mycertfile.cer
keytool -import -alias "..." -keystore mytruststore -file mycertfile.cer
java -Djavax.net.ssl.keyStore=mykeystore \
-Djavax.net.ssl.keyStorePassword="..." \
TLSEchoServer
java -Djavax.net.ssl.trustStore=mytruststore \
-Djavax.net.ssl.trustStorePassword="..." \
TLSEchoClient localhost
-Djavax.net.debug=ssl