Java Applet needs to be signed to run restricted methods like accessing local file system, recording contents.
To sign the applet, you normally needs to get certification from commercial companies like VeriSign,Thawte, which cost you few hundred dollars per year.
If you do not want to pay that money, you can create your own CA certificate to sign your applet. The side effect is that you will get some warning when applet starts.
Software you needed are OpenSSL, JDK and KeyStore Explorer.
Create Default KeyStore if not exist
Create a key by keytool to create the default key store, which may does not exist. This key will NOT be used later.
keytool -genkey -keyalg rsa -alias MyTempKey
Create Root CA Certificate
Create the private key
openssl genrsa -des3 -out ca.key 4096
Create the public key
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
Create and Sign Intermediate Certificate
Create the private key.
openssl genrsa -des3 -out server.key 4096
Create a certificate request for signing by the Root CA.
openssl req -new -key server.key -out server.csr
Sign the request with the Root CA and make a public key. Type
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
Import keys to KeyStore
Use KeyStore Explorer to import server.crt and server.key to keystore. Choose "Open The Default KeyStore", during the importing, I choose to set the alias of keys to "xgu" (you can choose any name you like).
Sign the Java JAR
To sign the java applet
jarsigner a_java_applet.jar xgu1
To verify the signed JAR
jarsigner -verify -verbose -certs a_java_applet.jar
References:
http://www.top20toolbar.com/misc/codesigncert.htm
http://download.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/rsa_signing.html
http://conshell.net/wiki/index.php/Keytool_to_OpenSSL_Conversion_tips
2011/06/30
2011/06/28
Road to Build a Voice Message System
Product Planing
I plan to build a "voice Message System" (VMS)
Basic feature:
- record a voice message from iPhone, android device or PC
- without any need for registration
- Receiver will receive a link of message
- the message can be downloaded, and it also can be played on web page.
Advanced feature:
- integration with Facebook
Similar Services
http://vocaroo.com/
http://audioboo.com/
Technical Consideration
For recording, I will not use Flash as "vocaroo.com". As I do not have experience with Flash, I have to set up some flash server to get the recorded audio data, too much trouble. I prefer to use Java Applet, but for recording, I need to get the Java Applet signed, which cost few hundred dollars a year. And I also find out that Java Web Start technology also needs code signed.
For playback, I prefer to use HTML5 native audio playback on the browser. Since different browser supports different audio codec, and no codec is supported by all mainstream browsers, some trans-coding work is needed at server side.
Developing Recorder
Found same some code of a simple audio recorder at: http://www.jsresources.org/examples/SimpleAudioRecorder.html
The create a standalone JAR:
1. Right-click the src directory of the project
2. Choose Export, and select "JAR file" under "Java"
3. Click Next to the third (last) page
4. Select "Generate the manifest file"
5. At the bottom, browse for the "Main class"
6. Finish
http://forums.macrumors.com/showthread.php?t=502171
Code Reference
Downloaded audioboo.jar from www.audioboo.com. Extract it and then use CavaJ to decompile it. and luckily I got source code.
Developing Player
To be updated when I get there...
Developing Trans-coder
To be updated when I get there...
Misc Information
- Audioboo.com's applet is signed with UTN-USERFirst-Object
I plan to build a "voice Message System" (VMS)
Basic feature:
- record a voice message from iPhone, android device or PC
- without any need for registration
- Receiver will receive a link of message
- the message can be downloaded, and it also can be played on web page.
Advanced feature:
- integration with Facebook
Similar Services
http://vocaroo.com/
http://audioboo.com/
Technical Consideration
For recording, I will not use Flash as "vocaroo.com". As I do not have experience with Flash, I have to set up some flash server to get the recorded audio data, too much trouble. I prefer to use Java Applet, but for recording, I need to get the Java Applet signed, which cost few hundred dollars a year. And I also find out that Java Web Start technology also needs code signed.
For playback, I prefer to use HTML5 native audio playback on the browser. Since different browser supports different audio codec, and no codec is supported by all mainstream browsers, some trans-coding work is needed at server side.
Developing Recorder
Found same some code of a simple audio recorder at: http://www.jsresources.org/examples/SimpleAudioRecorder.html
The create a standalone JAR:
1. Right-click the src directory of the project
2. Choose Export, and select "JAR file" under "Java"
3. Click Next to the third (last) page
4. Select "Generate the manifest file"
5. At the bottom, browse for the "Main class"
6. Finish
http://forums.macrumors.com/showthread.php?t=502171
Code Reference
Downloaded audioboo.jar from www.audioboo.com. Extract it and then use CavaJ to decompile it. and luckily I got source code.
Developing Player
To be updated when I get there...
Developing Trans-coder
To be updated when I get there...
Misc Information
- Audioboo.com's applet is signed with UTN-USERFirst-Object
2011/06/27
Useful Online Tools
Get string's binary in different kind of encoding
http://str2bin.appspot.com/
Beautifully format your code (C, C++, Java ...) with HTML tags, make it easier to share code on the HTML page
http://www.blogtrog.com/
JavaScript Compiler
http://closure-compiler.appspot.com/
http://str2bin.appspot.com/
Beautifully format your code (C, C++, Java ...) with HTML tags, make it easier to share code on the HTML page
http://www.blogtrog.com/
JavaScript Compiler
http://closure-compiler.appspot.com/
Communication between Javascript & Java Applet
From Java to JavaScript
A very simple way to call Javascript method from Java Applet.
Java Applet Side
HTML Side
Reference:
http://www.rgagnon.com/javadetails/java-0172.html
http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html
From JavaScript to Java
http://download.oracle.com/javase/1.4.2/docs/guide/plugin/developer_guide/js_java.html
A very simple way to call Javascript method from Java Applet.
Java Applet Side
import java.applet.*; import java.net.*; public class InJava4 extends Applet{ private void callJs(String s, Object aobj[]) { try { Object aobj[] = new Object[3]; aobj[0] = "param1"; aobj[1] = "param2"; aobj[2] = "param3"; JSObject.getWindow(this).call("some_javascript_function", aobj); } catch (JSException jsexception) { System.out.println((new StringBuilder()).append("JavaScript exception delivering ").append(s).toString()); } } }
HTML Side
<HTML> <HEAD> <SCRIPT src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></SCRIPT> <SCRIPT type="text/javascript"> function some_javascript_function() { var args=$.makeArray(arguments); doAlert(args.shift()); doAlert(args.shift()); doAlert(args.shift()); } </SCRIPT> </HEAD> <BODY> <APPLET CODE="InJava4.class" NAME="myApplet" MAYSCRIPT HEIGHT=10 WIDTH=10></APPLET> </BODY> </HTML>
Reference:
http://www.rgagnon.com/javadetails/java-0172.html
http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html
From JavaScript to Java
http://download.oracle.com/javase/1.4.2/docs/guide/plugin/developer_guide/js_java.html
2011/06/09
Linux Command Examples
Delete a folder recursively
find . -type d -name .svn -exec rm -rf {} \;
Kernel Debug Message
dmesg -wH
Zip and unzip
tar czvf xxx.tgz folder/
tar xvzf file-1.0.tar.gz
tar xvjf file-1.0.tar.bz2
tar xvf file-1.0.tar
Get the log to a file
./some_exe 2>&1 | tee fileName.log
How to find a file by name
find /etc -name "ho*t" -print
updatedb
locate filenamefin
How to grep a string from a folder
grep -R "string string" *
Check the return value of the command
echo $?c
How to patch diff
diff -rupN original/ new/ > some.diff
patch -p0 --dry-run < some.diff
patch -p0 < some.diff
patch -p0 -R < some.diff
Version Control
create branch
svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/branches/my-calc-branch -m "Creating a private branch of /calc/trunk."
delete .svn
rm -rf `find . -type d -name .svn`
delete cvs
find . -name 'CVS' -type d -exec rm -rf {} \;
Device Access
sudo dd of=/dev/zero if=/dev/mtd0 skip=1 bs=512 count=1
find . -type d -name .svn -exec rm -rf {} \;
Kernel Debug Message
dmesg -wH
Zip and unzip
tar czvf xxx.tgz folder/
tar xvzf file-1.0.tar.gz
tar xvjf file-1.0.tar.bz2
tar xvf file-1.0.tar
Get the log to a file
./some_exe 2>&1 | tee fileName.log
How to find a file by name
find /etc -name "ho*t" -print
updatedb
locate filenamefin
How to grep a string from a folder
grep -R "string string" *
Check the return value of the command
echo $?c
How to patch diff
diff -rupN original/ new/ > some.diff
patch -p0 --dry-run < some.diff
patch -p0 < some.diff
patch -p0 -R < some.diff
Version Control
create branch
svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/branches/my-calc-branch -m "Creating a private branch of /calc/trunk."
delete .svn
rm -rf `find . -type d -name .svn`
delete cvs
find . -name 'CVS' -type d -exec rm -rf {} \;
Device Access
sudo dd of=/dev/zero if=/dev/mtd0 skip=1 bs=512 count=1
2011/06/06
Read Memory Usage from Status of Proc
VmPeak: 8368 kB (peak usage of virtual memory)
VmSize: 7344 kB (usage of virtual memory)
VmLck: 0 kB (locked memory)
VmHWM: 2336 kB (peak usage of hardware memory)
VmRSS: 2336 kB (usage of hardware memory)
VmData: 3052 kB (heap)
VmStk: 88 kB (stack)
VmExe: 16 kB (text section)
VmLib: 4080 kB (shared library)
VmPTE: 56 kB (page table entry size)
Explanation comes from:
http://d.hatena.ne.jp/naoya/20080727/1217119867
http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html
http://www.linuxquestions.org/questions/programming-9/vmsize-regarding-proc-pid-status-432227/
VmSize: 7344 kB (usage of virtual memory)
VmLck: 0 kB (locked memory)
VmHWM: 2336 kB (peak usage of hardware memory)
VmRSS: 2336 kB (usage of hardware memory)
VmData: 3052 kB (heap)
VmStk: 88 kB (stack)
VmExe: 16 kB (text section)
VmLib: 4080 kB (shared library)
VmPTE: 56 kB (page table entry size)
Explanation comes from:
http://d.hatena.ne.jp/naoya/20080727/1217119867
http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html
http://www.linuxquestions.org/questions/programming-9/vmsize-regarding-proc-pid-status-432227/
Subscribe to:
Posts (Atom)
Post Code on Blogger
Simplest way to post code to blogger for me: <pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black;overflow-x:...
-
Explain There is not interrupt PIN for PCIe interrupt. When device wants to raise an interrupt, an interrupt message is sent to host via ...
-
Configure Space Addressing One of the major improvements the PCI Local Bus had over other I/O architectures was its configuration mechanism...
-
What is LMA and VMA Every loadable or allocatable output section has two addresses. The first is the VMA, or virtual memory address. This ...