function GenTDES() // Generate3DES() can be direct accessed in MainApplet.class { if(document.app.Generate3DES()) { document.form1.GetGenTDESVle.value= "Success"; } else { document.form1.GetGenTDESVle.value=document.app.getErrorString(); } } // getEncryptPINcode() can be direct accessed in MainApplet.class function EncryptTDES() { if(document.app.EncryptPINcode(document.form1.UserPin.value)) { document.form1.GetEncryptTDESVle.value= document.app.getEncryptPINcode(); } else { document.form1.GetEncryptTDESVle.value=document.app.getErrorString(); } } // RsaEncrypt3DES() can be direct accessed in MainApplet.class however it will call into PaySecure.* classes. function RSAEncryptTDES() { if(document.app.RsaEncrypt3DES()) { document.form1.GetRSAEncryptTDESVle.value= document.app.getRsaEncrypt3DES(); } else { document.form1.GetRSAEncryptTDESVle.value= document.app.getErrorString(); } } #### package POST_jCRYPT; use strict; use warnings; use Inline::Java; BEGIN { $ENV{CLASSPATH} .= "./ChunghwaPost.jar"; } use Inline Java => 'STUDY', STUDY => [ 'MainApplet' ], AUTOSTUDY => '1', DEBUG => '1'; sub new { my $MainApplet = shift; return POST_jCRYPT->new(@_); } 1; #### #!/usr/bin/perl #use strict; use warnings; use Inline::Java; use Data::Dumper; use lib '/home/macpaul/perl'; use POST_jCRYPT; my $pwd ="12345678"; my $usercode ="example1"; my $javaobj = POST_jCRYPT::MainApplet->new(); # ePin print $javaobj->Generate3DES(), "\n"; $javaobj->EncryptPINcode($pwd); my $ePIN = $javaobj->getEncryptPINcode(); print $ePIN, "\n"; $javaobj->RsaEncrypt3DES(); my $eKey = $javaobj->getRsaEncrypt3DES(); print $eKey, "\n";