references:
http://cygwin.com/
http://royalexander.wordpress.com/2009/03/20/configuring-cygwin-cc-compiler-for-netbeans-65-under-windows/
http://netbeans.org/community/releases/68/cpp-setup-instructions.html
http://netbeans.org/kb/trails/cnd.html
Tuesday, May 25, 2010
Thursday, April 15, 2010
Signed Applet to Javascript
String lineSeparator = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction(){
public String run() {return System.getProperty("line.separator");}});
http://www.raditha.com/java/sandbox/unsigned.phphttp://stackoverflow.com/questions/852453/accesscontroller-doprivileged
http://chriswongdevblog.blogspot.com/2009/08/invisible-applet.html
http://forums.sun.com/thread.jspa?threadID=5434324
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4406607
http://forums.devshed.com/java-help-9/saving-file-into-local-disc-using-applet-613357.html
http://lwjgl.org/forum/index.php?action=printpage;topic=3186.0
http://stackoverflow.com/questions/1068271/signed-applet-gives-accesscontrolexception-access-denied-when-calling-from-java
http://www.snowbound.com/tech_tips/g_security_applet_java.html
http://java.sun.com/j2se/1.4.2/docs/api/java/security/AccessController.html
Wednesday, January 20, 2010
RPM commands
Some common rpm commands
1. Install
rpm -i
2. Remove
rpm -e
3. List all installed packages
rpm -qa[ i]
1. Install
rpm -i
2. Remove
rpm -e
3. List all installed packages
rpm -qa[ i
Monday, January 18, 2010
Installing default EJBCA on Fedora 10
Installation packages
- jdk 1.5
- ejbca 3.9.2
- JBOSS 5.1
- Ant 1.7.1 >= 1.6.5
- install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 5.0 http://java.sun.com/j2se/1.5.0/download.jsp
-----------------------------------------------------------------------------------
1) Install the following packages:
yum install ant-nodeps
yum install xdoclet
yum install xjavadoc //optional
2) install sun java 1.5 and Unlimited strength policy(readme.txt in zip).
3) unzip jboss 1.5 and ejbca to required folder.
4) Add the following lines to /etc/profile
# User specific aliases and functions
# The following are the environment variables for Java and JBOSS
export JAVA_HOME=/usr/java/jdk1.5.0_22
export PATH=$PATH:$JAVA_HOME/bin
export JBOSS_HOME=/opt/jboss-5.1.0.GA
export PATH=$PATH:$JBOSS_HOME/bin
export APPSRV_HOME=$JBOSS_HOME
export ANT_OPTS=-Xmx512m
export EJBCA_HOME=ejbca_3_9_2
5) In $APPSRV_HOME/bin/run.conf, edit the following:
JAVA_OPTS="-server -Xms128m -Xmx512m" //Optional
6) JBoss 5.x have a bug causing issues with the BC JCE provider. To work around this you can copy the files EJBCA_HOME/lib/bc*.jar to JBOSS_HOME/server/default/lib/.
cp -s EJBCA_HOME/lib/bc*.jar JBOSS_HOME/server/default/lib/.
7) $EJBCA_HOME/ant bootstrap //Compile, jar, war, ear everything and deploy it to JBoss.
8) Start JBOSS
$APPSRV_HOME/bin/./run.sh -b 0.0.0.0 //bind(b) allow access via ip address instead of localhost only.
JBoss should deploy the ear without errors.
9) $EJBCA_HOME/ant install //generate all certificates, keys, etc
admin keys will be stored in ${ejbca.home}/p12
Adds data to jboss/server/default/data/hypersonic database
*Only run once.
tomcat.jks is for the servlet container (don't bother with it)
truststore.jks is for the servlet container (don't bother with it)
superadmin.p12 should be imported in your browser, that's your administration certificate.
10) Stop JBoss
11) $EJBCA_HOME/ant deploy
deploy everything again and configure the servlet container with the keystore file(HTTPS) (this is why we needed to stop the container).
12) Import the certificate from $EJBCA_HOME/p12/superadmin.p12 into the browser. This is for administration access.
Default password for superadmin.p12: ejbca //configured in ejbca.properties
13) Start JBoss
https://:8443/ejbca //admin-GUI *superadmin.p12 provide the admin login.
http://localhost:8080/ejbca //public page w/o administration
*To add recognised CA signed SSL
$ant -Dca.name="My CA Name" javatruststore
- adds the CA certificate to p12/truststore.jks
- copies this 'truststore.jks' to $JBOSS_HOME/server/default/conf/keystore
- Stop and start tomcat
------------------------------------------------------------------------------------
Tips:
version of EJBCA - $EJBCA_HOME/ant ejbcaversion
EJB CA properties - conf/ejbca.properties
Database properties - conf/database.properties
Files deployed
- ant bootstrap
- deploy/ejbca-ds.xml
- deploy/ejbca-mail-service.xml
- deploy/ejbca.ear
- ant deploy
- Files from ant bootstrap
- conf/keystore/keystore.jk
- conf/keystore/truststore.jks
- deploy/jboss-web.deployer/server.xml
------------------------------------------------------------------------------------
Reference
http://www.ejbca.org/installation.html
- jdk 1.5
- ejbca 3.9.2
- JBOSS 5.1
- Ant 1.7.1 >= 1.6.5
- install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 5.0 http://java.sun.com/j2se/1.5.0/download.jsp
-----------------------------------------------------------------------------------
1) Install the following packages:
yum install ant-nodeps
yum install xdoclet
yum install xjavadoc //optional
2) install sun java 1.5 and Unlimited strength policy(readme.txt in zip).
3) unzip jboss 1.5 and ejbca to required folder.
4) Add the following lines to /etc/profile
# User specific aliases and functions
# The following are the environment variables for Java and JBOSS
export JAVA_HOME=/usr/java/jdk1.5.0_22
export PATH=$PATH:$JAVA_HOME/bin
export JBOSS_HOME=/opt/jboss-5.1.0.GA
export PATH=$PATH:$JBOSS_HOME/bin
export APPSRV_HOME=$JBOSS_HOME
export ANT_OPTS=-Xmx512m
export EJBCA_HOME=ejbca_3_9_2
5) In $APPSRV_HOME/bin/run.conf, edit the following:
JAVA_OPTS="-server -Xms128m -Xmx512m" //Optional
6) JBoss 5.x have a bug causing issues with the BC JCE provider. To work around this you can copy the files EJBCA_HOME/lib/bc*.jar to JBOSS_HOME/server/default/lib/.
cp -s EJBCA_HOME/lib/bc*.jar JBOSS_HOME/server/default/lib/.
7) $EJBCA_HOME/ant bootstrap //Compile, jar, war, ear everything and deploy it to JBoss.
8) Start JBOSS
$APPSRV_HOME/bin/./run.sh -b 0.0.0.0 //bind(b) allow access via ip address instead of localhost only.
JBoss should deploy the ear without errors.
9) $EJBCA_HOME/ant install //generate all certificates, keys, etc
admin keys will be stored in ${ejbca.home}/p12
Adds data to jboss/server/default/data/hypersonic database
*Only run once.
tomcat.jks is for the servlet container (don't bother with it)
truststore.jks is for the servlet container (don't bother with it)
superadmin.p12 should be imported in your browser, that's your administration certificate.
10) Stop JBoss
11) $EJBCA_HOME/ant deploy
deploy everything again and configure the servlet container with the keystore file(HTTPS) (this is why we needed to stop the container).
12) Import the certificate from $EJBCA_HOME/p12/superadmin.p12 into the browser. This is for administration access.
Default password for superadmin.p12: ejbca //configured in ejbca.properties
13) Start JBoss
https://
http://localhost:8080/ejbca //public page w/o administration
*To add recognised CA signed SSL
$ant -Dca.name="My CA Name" javatruststore
- adds the CA certificate to p12/truststore.jks
- copies this 'truststore.jks' to $JBOSS_HOME/server/default/conf/keystore
- Stop and start tomcat
------------------------------------------------------------------------------------
Tips:
version of EJBCA - $EJBCA_HOME/ant ejbcaversion
EJB CA properties - conf/ejbca.properties
Database properties - conf/database.properties
Files deployed
- ant bootstrap
- deploy/ejbca-ds.xml
- deploy/ejbca-mail-service.xml
- deploy/ejbca.ear
- ant deploy
- Files from ant bootstrap
- conf/keystore/keystore.jk
- conf/keystore/truststore.jks
- deploy/jboss-web.deployer/server.xml
------------------------------------------------------------------------------------
Reference
http://www.ejbca.org/installation.html
Tuesday, December 1, 2009
gcc library missing during run
edit /etc/ld.so.conf and run
In fedora
/etc/ld.so.conf -> include /etc/ld.so.conf.d/
all config in the above folder should include lib directory
e.g. pbc.conf
/usr/local/lib
http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/dlls.html
ldconfig.In fedora
/etc/ld.so.conf -> include /etc/ld.so.conf.d/
all config in the above folder should include lib directory
e.g. pbc.conf
/usr/local/lib
http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/dlls.html
Tuesday, October 20, 2009
SunJDK weblogic
Reference: http://buttso.blogspot.com/2009/09/switching-between-jrockit-and-sun-jdk.html
Looking at the start scripts $DOMAIN_HOME/bin/setDomainEnv.cmd, I just realized that this operational task is basically taken care of in the scripts we have.
To swap between the Sun JDK and JRockit to launch a WLS instance, all you need to do is set the JAVA_VENDOR environment variable to either "Sun" or "Oracle" and the scripts will take of launching WLS using the specified JDK.
Snippets from setDomainEnv.cmd:
Where JAVA_HOME is then used by startWebLogic.cmd script when it launches the WLS instance to identify the JDK to use.
Snippets from startWebLogic.cmd
With this information at hand, then switching between the two different JDKs is as simple as setting an environment variable before launching WebLogic Server.
Using JRockit:
And just as easy to switch back to Sun. Note here that you could just unset the JAVA_HOME environment variable, which will set the script to use whatever default was configured when the domain was created.
Using Sun JDK:
Switching Between JRockit and Sun JDK with WebLogic Server
Need to swap between JRockit and the Sun JDK when starting your WebLogic Server instance?Looking at the start scripts $DOMAIN_HOME/bin/setDomainEnv.cmd, I just realized that this operational task is basically taken care of in the scripts we have.
To swap between the Sun JDK and JRockit to launch a WLS instance, all you need to do is set the JAVA_VENDOR environment variable to either "Sun" or "Oracle" and the scripts will take of launching WLS using the specified JDK.
Snippets from setDomainEnv.cmd:
set BEA_JAVA_HOME=d:\wls1031\jrockit_160_05_R27.6.2-20
set SUN_JAVA_HOME=d:\wls1031\jdk160_11
if "%JAVA_VENDOR%"=="Oracle" (
set JAVA_HOME=%BEA_JAVA_HOME%
) else (
if "%JAVA_VENDOR%"=="Sun" (
set JAVA_HOME=%SUN_JAVA_HOME%
) else (
set JAVA_VENDOR=Sun
set JAVA_HOME=d:\wls1031\jdk160_11
)
)
Where JAVA_HOME is then used by startWebLogic.cmd script when it launches the WLS instance to identify the JDK to use.
Snippets from startWebLogic.cmd
%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS%
-Dweblogic.Name=%SERVER_NAME%
-Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy
%JAVA_OPTIONS%
%PROXY_SETTINGS%
%SERVER_CLASS%
With this information at hand, then switching between the two different JDKs is as simple as setting an environment variable before launching WebLogic Server.
Using JRockit:
>set JAVA_VENDOR=Oracle
>startWebLogic.cmd
...
d:\wls1031\JROCKI~1.2-2\bin\java -jrockit -Xms512m -Xmx512m -Dweblogic.Name=AdminServer ...
And just as easy to switch back to Sun. Note here that you could just unset the JAVA_HOME environment variable, which will set the script to use whatever default was configured when the domain was created.
Using Sun JDK:
>set JAVA_VENDOR=Sun
>startWebLogic.cmd
...
d:\wls1031\JDK160~1\bin\java -client -Xms256m -Xmx512m -Dweblogic.Name=AdminServer ...
Monday, October 12, 2009
OpenSSL resources
http://www.dylanbeattie.net/docs/openssl_iis_ssl_howto.html
http://www.herongyang.com/crypto/OpenSSL_Signing_keytool_CSR_5.html
http://security.ncsa.uiuc.edu/research/grid-howtos/usefulopenssl.php
To view the details of the certificate signing request contained in the file server.csr, use:
http://www.herongyang.com/crypto/OpenSSL_Signing_keytool_CSR_5.html
http://security.ncsa.uiuc.edu/research/grid-howtos/usefulopenssl.php
To view the details of the certificate signing request contained in the file server.csr, use:
openssl req -noout -text -in server.csr
c:\OpenSSL\bin\openssl asn1parse -inform der -in demo.p7 -i > c:\demo.asn1
c:\OpenSSL\bin\openssl pkcs7 -inform der -in demo.p7 -text -print_certs -noout
View certificate details
C:\Program Files\LunaPCI\keys>openssl x509 -inform PEM -in cert0.cer -text
------------------------------------------------------------------------------
1) Generate RSA key:
$ openssl genrsa -out key.pem 1024
$ openssl rsa -in key.pem -text -noout
2) Save public key in pub.pem file:
$ openssl rsa -in key.pem -pubout -out pub.pem
$ openssl rsa -in pub.pem -pubin -text -noout
3) Encrypt some data:
$ echo test test test > file.txt
$ openssl rsautl -encrypt -inkey pub.pem -pubin -in file.txt \
-out file.bin
$ ll file.bin
-rw-r--r-- 1 root root 128 2007-07-11 01:58 file.bin
4) Decrypt encrypted data:
$ openssl rsautl -decrypt -inkey key.pem -in file.bin
test test test
But you should have public key in so called SubjectPublicKeyInfo format
(look at RFC2459).
You can look at ASN.1 structure of public key with command:
$ openssl asn1parse -in pub.pem
0:d=0 hl=3 l= 159 cons: SEQUENCE
3:d=1 hl=2 l= 13 cons: SEQUENCE
5:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption
16:d=2 hl=2 l= 0 prim: NULL
18:d=1 hl=3 l= 141 prim: BIT STRING
Sample Public key
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRzVwcS4JP8K5iihVc4j26QZWp
4n4Bh9cTxdCovsrCd50lxPNRUPPGqPcPwYGLVyyTG8+DR9RtqcVrC3gYtI20G2+0
HbWTRWAAa/LF/x937nt3Q92CDu010eRY0CDtvyLcg90yLV/84TOc5PRwbCwuURgu
3Nzn+7BiEZ7lYCyXGQIDAQAB
-----END PUBLIC KEY-----
------------------------------------------------------------------------------
For public key in hex64 ending with '==', use openssl asn1parse -in c:\maybank.pem
-----BEGIN PUBLIC KEY-----
MIGIAoGAq74V/tQfDXWpO821eujW9MOpSROdVKQXncV3m+k1K0Vmnu8QGSzvFq5cBe7R6uHB
/J5gHKwFVG6XgrqjVa46gprk+8vQFfLfshHcFf/Vv79Ykpj0/PWaCAvp7uvcFKKByb1cDhAu
PDmzbBJYMyg7nG3dmAzhEqPK+LLOQ5s7mHkCAwEAAQ==
-----END PUBLIC KEY-----
------------------------------------------------------------------------------
Subscribe to:
Posts (Atom)