How to use the different class for each screen as well as function.

Hi Experts,
How to use the different class for each screen as well as function.
With BestRegards,
M.Thippa Reddy.

Hi ThippaReddy,
see this sample code
Public Class ClsMenInBlack
#Region "Declarations"
    'Class objects
    'UI and Di objects
    Dim objForm As SAPbouiCOM.Form
    'Variables
    Dim strQuery As String
#End Region
#Region "Methods"
    Private Function GeRate() As Double
            Return Double
    End Function
#End Region
Public Sub SBO_Appln_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean)
        If pVal.BeforeAction = True Then
            If pVal.MenuUID = "ENV_Menu_MIB" Then
            End If
        Else ' Before Action False
            End If
    End Sub
#End Region
End Class
End Class
Rgds
Micheal
Vasu Anna Regional Feeling a???? Just Kidding
Edited by: micheal willis on Jul 27, 2009 5:49 PM
Edited by: micheal willis on Jul 27, 2009 5:50 PM

Similar Messages

  • How to Use the same iview for both KM End User and the KM Administrator

    Hi friends,
    *This is my scenario :* How to Use the same iview for both KM End User and the KM Administrator but with different Context
    Menu Options.
    i followed these steps but im getting same context menu for both KM End User and the KM Administrator .
    Assign the role Content Administrator to the user km_admin. This is needed so that km_admin can change
    the presentation settings for the KM Folder u201EReports_kmFolder‟.
    Now, login with user km_admin. Navigate to the Km Folder reports_kmFolder through Content Administration
    -> Km Content. Click on Details link of the folder reports_kmFolder.
    Go To Settings -> Presentation. Click on the tab u201ESettings for You‟-> Click on button u201ESelect Profile‟.
    Select the radio button corresponding to u201Elayout Set‟, and choose u201EConsumerExplorer‟ from the dropdown.
    Click u201EOK‟.
    Select both the check boxes corresponding to Items Affected as shown above, and click u201ESave‟
    Now, remove the u201ESuper Administrator‟ role from the user km_admin and login with this user.
    How rto resolve this????
    Regards,
    Prasad.

    Hello Prasad,
    Most likely the user km_admin still has system principal roles assigned, even though you removed the Super Admin role, you should check that this user doesn't have any other admin roles, otherwise it will be considered a System Principal user and will therefore still have access to all content. For more information see http://help.sap.com/saphelp_nw70/helpdata/en/19/56f28fbd4e11d5993b00508b6b8b11/frameset.htm
    Try creating a new user with just read access to the content and you should see that it will not be able to make any changes etc.
    Regards,
    Lorcan.

  • How to use the implementation class in propetty pallete

    Hi,
    I am using forms 10g....I have to insert horizontal scroll bar in text item..
    I have only class files instead of jar files ...how cani place the class file instead of jar file...
    How to use the implementation class in property palette to display the PJC
    Thanks,
    Ansaf.

    The Implementation Class must reflect the full name of the class. For instance, if the full class name is : xx.yyy.zz.class_name, then put this in the Implementation Class property of the corresponding item.
    Also, the class must be stored in the equivalent directory structure, so that, in my example: <DEV_HOME>/forms/java/xx/yyy/zz
    Francois

  • How can i apply different color for each cell in jlist component?

    hi guys i need your help and sorry if my english is very bad..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..
    Edited by: ryrene on Mar 21, 2010 12:13 AM

    ryrene wrote:
    hi guys i need your help and sorry if my english is very bad.
    ..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..I'll see your tnx, and raise you dve bmbrs & nplm.

  • How to use the second display for installation OS in my vertical lines iMac

    My 17" iMac display is full of vertical lines, it is unuseable. Does anyone know how to use the second display for Mac OS X or disable the first display for installation Mac OS x ?

    Go to: *System Preferences > Displays* and select the Arrangement tab, then relocate your Menu bar by dragging it to the other display.
    Unfortunately there is no Hardware or Software switch to turn off the iMac's Internal Display.

  • How to use the index method for pathpoints object in illustrator through javascripts

    hii...
    am using Illustrator CS2 using javascripts...
    how to use the index method for pathpoints object in illustrator through javascripts..

    Hi, what are you trying to do with path points?
    CarlosCanto

  • How to use the LAN NetStream for peer transmission, please help, write a sample code

    How to use the LAN NetStream for peer transmission, please help, write a sample code

    No reply, I reply, Oh

  • How to use the game centre for apple iPad mini

    How to use the game centre for apple iPad mini

    Here you go:
    Using Game Center on your Mac or iOS device - Apple Support

  • How to use the print option for photos?

    How to use the print option for photos.  I have a wireless printer but how do I set it up?

    http://www.apple.com/support/iphone/assistant/airprint/

  • How to use the Output clause for the updated statment

    How to use the output clause for the below update stament,
    DECLARE @MyTableVar table(
        sname int NOT NULL)
    update A set stat ='USED' 
    from (select top 1 * from #A 
    where stat='AVAILABLE' order by sno)A
    Output inserted.sname
    INTO @MyTableVar;
    SELECT sname
    FROM @MyTableVar;
    Here am getting one error incorrect syntax near Output
    i want to return the updated value from output clause

    see
    http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Can someone help me in easy steps on how to use the home sharing for music on itunes.

    Hi can someone give me easy to follow instructions on how to use the home sharing for itunes.

    iTunes- Setting up Home Sharing on your computer
    Setting up Home Sharing for Apple TV (2nd generation)
    Troubleshooting Home Sharing

  • How to  find the user exit for a screen..

    Hi,
    plz help me how to find the user exit for a screen..?
    Regards
    Anbu

    Hi,
    check this program this will give you the list of user-exit and BADI for the perticular Tcode.
    REPORT  zuserexit_badi.
    TABLES : tstc,
    tadir,
    modsapt,
    modact,
    trdir,
    tfdir,
    enlfdir,
    sxs_attrt ,
    tstct.
    DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
    DATA : field1(30).
    DATA : v_devclass LIKE tadir-devclass.
    PARAMETERS : p_tcode LIKE tstc-tcode,
    p_pgmna LIKE tstc-pgmna .
    DATA wa_tadir TYPE tadir.
    START-OF-SELECTION.
      IF NOT p_tcode IS INITIAL.
        SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
      ELSEIF NOT p_pgmna IS INITIAL.
        tstc-pgmna = p_pgmna.
      ENDIF.
      IF sy-subrc EQ 0.
        SELECT SINGLE * FROM tadir
        WHERE pgmid = 'R3TR'
        AND object = 'PROG'
        AND obj_name = tstc-pgmna.
        MOVE : tadir-devclass TO v_devclass.
        IF sy-subrc NE 0.
          SELECT SINGLE * FROM trdir
          WHERE name = tstc-pgmna.
          IF trdir-subc EQ 'F'.
            SELECT SINGLE * FROM tfdir
            WHERE pname = tstc-pgmna.
            SELECT SINGLE * FROM enlfdir
            WHERE funcname = tfdir-funcname.
            SELECT SINGLE * FROM tadir
            WHERE pgmid = 'R3TR'
            AND object = 'FUGR'
            AND obj_name EQ enlfdir-area.
            MOVE : tadir-devclass TO v_devclass.
          ENDIF.
        ENDIF.
        SELECT * FROM tadir INTO TABLE jtab
        WHERE pgmid = 'R3TR'
        AND object IN ('SMOD', 'SXSD')
        AND devclass = v_devclass.
        SELECT SINGLE * FROM tstct
        WHERE sprsl EQ sy-langu
        AND tcode EQ p_tcode.
        FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
        WRITE:/(19) 'Transaction Code - ',
        20(20) p_tcode,
        45(50) tstct-ttext.
        SKIP.
        IF NOT jtab[] IS INITIAL.
          WRITE:/(105) sy-uline.
          FORMAT COLOR COL_HEADING INTENSIFIED ON.
    Sorting the internal Table
          SORT jtab BY object.
          DATA : wf_txt(60) TYPE c,
          wf_smod TYPE i ,
          wf_badi TYPE i ,
          wf_object2(30) TYPE c.
          CLEAR : wf_smod, wf_badi , wf_object2.
    Get the total SMOD.
          LOOP AT jtab INTO wa_tadir.
            AT FIRST.
              FORMAT COLOR COL_HEADING INTENSIFIED ON.
              WRITE:/1 sy-vline,
              2 'Enhancement/ Business Add-in',
              41 sy-vline ,
              42 'Description',
              105 sy-vline.
              WRITE:/(105) sy-uline.
            ENDAT.
            CLEAR wf_txt.
            AT NEW object.
              IF wa_tadir-object = 'SMOD'.
                wf_object2 = 'Enhancement' .
              ELSEIF wa_tadir-object = 'SXSD'.
                wf_object2 = ' Business Add-in'.
              ENDIF.
              FORMAT COLOR COL_GROUP INTENSIFIED ON.
              WRITE:/1 sy-vline,
              2 wf_object2,
              105 sy-vline.
            ENDAT.
            CASE wa_tadir-object.
              WHEN 'SMOD'.
                wf_smod = wf_smod + 1.
                SELECT SINGLE modtext INTO wf_txt
                FROM modsapt
                WHERE sprsl = sy-langu
                AND name = wa_tadir-obj_name.
                FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
              WHEN 'SXSD'.
    For BADis
                wf_badi = wf_badi + 1 .
                SELECT SINGLE text INTO wf_txt
                FROM sxs_attrt
                WHERE sprsl = sy-langu
                AND exit_name = wa_tadir-obj_name.
                FORMAT COLOR COL_NORMAL INTENSIFIED ON.
            ENDCASE.
            WRITE:/1 sy-vline,
            2 wa_tadir-obj_name HOTSPOT ON,
            41 sy-vline ,
            42 wf_txt,
            105 sy-vline.
            AT END OF object.
              WRITE : /(105) sy-uline.
            ENDAT.
          ENDLOOP.
          WRITE:/(105) sy-uline.
          SKIP.
          FORMAT COLOR COL_TOTAL INTENSIFIED ON.
          WRITE:/ 'No.of Exits:' , wf_smod.
          WRITE:/ 'No.of BADis:' , wf_badi.
        ELSE.
          FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
          WRITE:/(105) 'No userexits or BADis exist'.
        ENDIF.
      ELSE.
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        WRITE:/(105) 'Transaction does not exist'.
      ENDIF.
    AT LINE-SELECTION.
      DATA : wf_object TYPE tadir-object.
      CLEAR wf_object.
      GET CURSOR FIELD field1.
      CHECK field1(8) EQ 'WA_TADIR'.
      READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
      MOVE jtab-object TO wf_object.
      CASE wf_object.
        WHEN 'SMOD'.
          SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
          CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
        WHEN 'SXSD'.
          SET PARAMETER ID 'EXN' FIELD sy-lisel+1(20).
          CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
      ENDCASE.
    Reagards,
    Bharat.

  • I have multiple emails, how do I add different signatures for each email address

    I have multiple emails for different companies I work for, how do I add a different signature for each one, it seems like I have to use the same one for all of them

    Thanks.  I think I'm on the right track.  I added the email address to my contacts and double clicked the image icon to change it, but it only lets me snap a new picture or select an image from another location.  What is the folder location of the stock icons that come with Mac OSX?

  • MDT Console with more then 15 machines, How to use the same drivers for more machines.

    Hello,
    I'm am looking for a solution to make our MDT design as effective as possible(as small as posible).
    The Situation:
    The company has more then 15 different computers added to the MDT console for the automated installation of Windows 7. The installations are done in 2 different ways, 1 with a local USB key installation (with the deployment folder on the USB key) and the other
    installation is a network USB key installation (with the deployment folder on the server).
    The local USB key exists for offices in parts of the world where the internet connection is poor.
    The problem:
    We have machines which can use the same driver for different kinds of hardware functions (LAN, WLAN, etc..)
    If we add a new machine to the MDT and we don't check the box for "Import drivers even if they are duplicates of an existing driver" we will automatic use the driver which already exists in the deployment folder. If say half a year
    later we stop using an older machine which "may" have drivers that are being used for other machines and we delete the machine from MDT we should
    NOT check the box "Completely delete these items, even if there are copies in other folders". The problem is that this can also lead to a lot of unused drivers in the deployment folder also because we do not know exactly how many
    computers are using a certain driver.
    At the moment we have another deployment share with for each machine its own drivers installed (so some drivers will be multiple times in the deployment folder) as you can guess this becomes really big.(deployment folder of more then 24 GB). The advantage
    of this is that we can delete a machine from the MDT list without having to worry if the drivers for that machine might be used by other machines. It is now just becoming to big in size(GB).
    The Question:
    Is there not an option within MDT that checks automatically if the drivers connected to a certain machine in MDT are being used by other machines? In this case we would check the box "Completely delete these items, even if there are copies in other folders"
    and MDT would not delete the drivers which are still used for the installations of other computers.
    Thanks in advance.
    Greets,
    Arie

    Arie,
    I think you are over-complicating this. Basically using drivers that already exist is the way to go. Otherwise drivers will be imported a second, third or fourth time. Which also takes up allot of disk space. If you're concerned about driver management,
    then I would suggest to drop your concerns, since there is nothing to less you can do about this particular issue. As long as you don't delete the driver that's been imported earlier by another machine there is nothing to worry.
    Ask yourself:
    - how long am I going to support model x
    - how many times do I want to update drivers
    With selection profiles you can easily target which content needs to go where (on your USB drive of-course)
    I can imagine that managing 25 shares for 25 different models, just because you 'refuse' to have old drivers in your share, or have removed support for some hardware models, isn't really time and energy efficient too.
    If you take a look in your deploymentshare\control folders you will see some XML files. These XML files hold all the entries in your deploymentshare. So your drivers.xml and drivergroups.xml (depending on the number of groups you have) are going to be very
    big XML files. These XML files are read by MDT to identify the objects in MDT and under which folder the objects are located.
    It's not possible to create or have an dependency between driver files and hardware models, other then creating groups under "Out-of-box Drivers" and using selection profiles.
    Another suggestion would be to decrease your number of hardware models drastically. On the other hand, having 25 Gb of offline media isn't really a big deal either. Portable and removable media of those sizes (32 and 64 Gb) isn't that expensive as it used
    to be 5 years ago.
    Don't get me wrong, I perfectly understand your desire to manage this, but MDT doesn't provide any other way, then the things I have pointed out to you here.
    Good luck! :)
    If this post is helpful please click "Mark for answer", thanks! Kind regards

  • How to use the same keypair for both encrypt/decryprt-SunPKCS#11

    Dear All,
    Subject: To access iKey 2032 token, to retrieve public/private key from iKey 2032 token using pkcs#11 in sdk1.5, to encrypt/decrypt files.
    When I separate the encrypt and decrypt part of java program, encryption program works well, whereas decryption program does not decrypt anything in the decrypt file (But there is no error). I printed out the public and private key in both encrypt and decrypt part of java program, its displayed differently::
    Encrypt program:
    SunPKCS11-rainbow_token RSA public key, 1024 bits (id 10, session object)
    modulus: 114338469922835728259534620463489934081917342509275191892563243582065
    74380495029336519036972702864998634664269499641616889325482699399559620370181624
    72068116957594402738459932902481604823224406859575930392708524033619120886256353
    58738237376491107769961041015109436347533548940674900728805627968145581222172729
    public exponent: 65537
    SunPKCS11-rainbow_token RSA private key, 1024 bits (id 11, session object, sensi
    tive, unextractable)
    Decrypt Program::
    SunPKCS11-rainbow_token RSA public key, 1024 bits (id 12, session object)
    modulus: 138556361758970660122782926386849783732271581948935425587968692317930
    09262429353977097956605140384961825974398004270547046620971835394362397699233738
    54481804748731546655197744692886754946373745924825650876065903334173666990347814
    83727290962956934521650035029131176614982652900659797194703065074407857754883163
    public exponent: 65537
    SunPKCS11-rainbow_token RSA private key, 1024 bits (id 13, session object, sensi
    tive, unextractable)
    I suspect that every time program generates different set of key, therefore we need to store the generated key during encryption part (i believe it is to be in the keystore) and to use the same for decryption part. Could you please give me a tips how to do this?
    Encrypt Program ::
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Encrypt.
    public class Encrypt
    public Encrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         Security.addProvider(p);
         KeyStore ks = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              KeyPair kp = kpg.genKeyPair();
              kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in = new FileInputStream("C:\\ReportDBBE.properties");
              FileOutputStream out = new FileOutputStream("C:\\ReportDBAE.properties");
              Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
              cp.init(cp.ENCRYPT_MODE,kp.getPublic());
              CipherOutputStream cout=new CipherOutputStream(out,cp);
              byte[] input=new byte[8];
              int byteread=in.read(input);
              while(byteread!=-1){
                   cout.write(input,0,byteread);
                   byteread=in.read(input);
              cout.flush();
              in.close();
              cout.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Encrypt tl = new Encrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Decrypt Program ::
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Decrypt.
    public class Decrypt
    public Decrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         Security.addProvider(p);
         KeyStore ks = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              KeyPair kp = kpg.genKeyPair();
              kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in1 = new FileInputStream("C:\\ReportDBAE.properties");
              FileOutputStream out1 = new FileOutputStream("C:\\ReportDBAD.properties");
              Cipher cipher=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
              AlgorithmParameters algParams = cipher.getParameters();
              cipher.init(Cipher.DECRYPT_MODE,kp.getPrivate(),algParams);
              CipherInputStream cin1=new CipherInputStream(in1,cipher);
              byte[] input1=new byte[8];
              int byteread1=cin1.read(input1);
              while(byteread1!=-1){
                   out1.write(input1,0,byteread1);
                   byteread1=cin1.read(input1);
              out1.flush();
              in1.close();
              out1.close();
              cin1.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(InvalidAlgorithmParameterException iape)
         System.out.println("Invalid Algorithm ParameterException " + iape.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Decrypt tl = new Decrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Configuration file::
    name = rainbow_token
    library = c:\winnt\system32\dkck201.dll
    attributes(*,CKO_PRIVATE_KEY,*) = {
    CKA_SIGN = true
    attributes(*,CKO_PRIVATE_KEY,CKK_DH) = {
    CKA_SIGN = null
    attributes(*,CKO_PRIVATE_KEY,CKK_RSA) = {
    CKA_DECRYPT = true
    }

    Hi all,
    Now i manage to use the same keypair for both encrypt/decryprt-SunPKCS#11. Below is my code woks well. In my code i hard coded alias name of certificate, did anyone knows how to read alias name of certificate from iKey token 2032??
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Encrypt.
    public class Encrypt
    public Encrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         String myAlias = "349eefd1-845b-4ba4-9f88-06e9f5cb82f6";
         /** to view alias name
         keytool -list -v -keystore NONE -storetype PKCS11 -storepass PASSWORD
         Security.addProvider(p);
         KeyStore ks = null;
         PrivateKey privKey = null;
         PublicKey pubKey = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
              java.security.cert.Certificate cert = ks.getCertificate(myAlias);
              Key key = ks.getKey(myAlias, pin);
              if(key != null) {
                   System.out.println("key class: " + key.getClass().getName()); // -> sun.security.pkcs11.P11Key$P11PrivateKey
                   System.out.println("key bytes: " + key.getEncoded()); // -> null!!!!!!!
         if(PrivateKey.class.isInstance(key)) {
         privKey = (PrivateKey)key;
         System.out.println("algo: " + privKey.getAlgorithm()); // -> RSA
         //Signature rsasig = Signature.getInstance("SHA1withRSA");
         //rsasig.initSign(privKey);
         //rsasig.update(data.getBytes());
         //byte[] sigBytes = rsasig.sign();
         pubKey = cert.getPublicKey();
         //System.out.println("signed bytes: " +sigBytes);
         //return sigBytes;
         //KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              //KeyPair kp = kpg.genKeyPair();
              //KeyPair kp = kpg.generateKeyPair();
              //kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in = new FileInputStream("C:\\ReportDBBE.properties");
              FileOutputStream out = new FileOutputStream("C:\\ReportDBAE.properties");
              Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
    //cp.init(cp.ENCRYPT_MODE,kp.getPublic());
              cp.init(cp.ENCRYPT_MODE,pubKey);
              CipherOutputStream cout=new CipherOutputStream(out,cp);
              byte[] input=new byte[8];
              int byteread=in.read(input);
              while(byteread!=-1){
                   cout.write(input,0,byteread);
                   byteread=in.read(input);
              cout.flush();
              in.close();
              cout.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         ike.printStackTrace();
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
         catch(UnrecoverableKeyException unrke)
         System.out.println("Unrecoverable Key Exception " + unrke.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Encrypt tl = new Encrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Your help is very much appreciated!!!!

Maybe you are looking for