Recent Notes

Displaying keyword search results 1 - 10
Created by Dr. Xi on November 01, 2013 10:17:57    Last update: November 01, 2013 10:17:57
This example class reads a RSA private key file in PEM format. import java.io.*; import java.security.*; im...
Created by Dr. Xi on October 31, 2013 18:17:09    Last update: October 31, 2013 18:17:09
You have a PGP public in PEM format, which cannot be stored in a Java key store. But you have the PEM encoded public key file. This class reads the file and creates a public key class in Java. Example key file: -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0B... Java code: import java.io.*; import java.security.*; im...
Created by Dr. Xi on October 12, 2013 13:06:55    Last update: October 12, 2013 13:06:55
Generate the ssh keys: $ ssh-keygen -t rsa Generating public/private r... Convert the ssh public key to PEM format: $ cd .ssh ~/.ssh$ ssh-keygen -f mykey.pub -e -m...
Created by Dr. Xi on May 02, 2011 15:59:37    Last update: February 25, 2012 09:16:37
This code snippet gets the default keystore used by the Java keytool and displays the list of aliases along with the key type (certificate or private key). import java.io.File; import java.io.FileInputSt... The default keystore used by the above code is: $HOME/.keystore .
Created by Fang on November 10, 2011 09:26:12    Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines! <?xml version="1.0" encoding="UTF-8"?> <xsd:sch...
Created by Fang on October 28, 2011 13:49:40    Last update: October 30, 2011 19:23:25
This is a simple example to demonstrate the templating power of JSF facelets. If you've used struts tiles before, you'll recognize the simplicity of templating with facelets. I've stripped out everything else except the pages themselves, just to put our focus on facelets. This is a Maven based project, and you need Tomcat (or any servlet container) to run the resulting webapp. To begin with this is the list of files: ./pom.xml ./src/main/webapp/home.xhtml ./src... I left faces-config.xml in there for completeness sake, it may not be needed. The Maven POM ( pom.xml ): <?xml version="1.0" encoding="UTF-8"?> <project... Web app configuration ( WEB-INF/web.xml ): <?xml version="1.0" encoding="UTF-8"?> <web-app... Empty WEB-INF/faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> <!-- Thi... index.jsp is simply a redirect to home.jsf : <% response.sendRedirect("home.jsf"); %>...
Created by freyo on April 06, 2011 14:58:43    Last update: May 05, 2011 14:52:49
To view certificate in CERT.RSA : C:\tmp>openssl pkcs7 -inform DER -in CERT.RSA -noo... To convert certificate to PEM: openssl pkcs7 -inform DER -in CERT.RSA -out CERT.p... Java keytool also works: $ keytool -printcert -file CERT.RSA Owner: EMA...
Created by Dr. Xi on April 27, 2011 11:57:36    Last update: April 27, 2011 11:58:35
This is a sample struts-config.xml file for Struts 1.x . <?xml version="1.0" encoding="UTF-8"?> <!DO...
Created by freyo on April 20, 2011 12:26:08    Last update: April 20, 2011 12:26:08
When you create a new key with Java keytool , it wraps the public key in a self signed certificate. You can generate a certificate signing request with the keytool -certreq command. After a certificate authority (CA) signs the certificate request, you can import the certificate received (a .crt file) back into the key store. Instead of using a CA, you can sign the certificate request with another key (with openssl, for example). If the certificate is not signed by a CA, you'll receive an error: $ keytool -import -alias android-root -file androi... To fix the problem, import the certificate of the signer: $ keytool -import -trustcacerts -file openssl.crt ... Import the certificate again (alias is the alias of the private key whose certificate was...
Created by alfa on April 08, 2011 11:05:24    Last update: April 08, 2011 11:05:24
Key points: Use java.awt.Robot to capture a screen region as java.awt.image.BufferedImage . Use javax.imageio.ImageIO to write image out to a file. import java.awt.AWTException; import java.awt.R...
Previous  1 2 Next