How to use the RFC SDK as part of a QTP test script

Hi there,
after having recorded some business transactions, I want to insert some checks into the QTP test script: an easy example would be an existence check in a database table. Instead of recording a SE16 or SE16N, I would find the approach much more elegant and much more efficient to use a (VB-)programmed RFC call for this purpose.
Unfortunately, I didn't find a way to address an RFC using the actual connection that QTP is working on. Creating a new connection would probably be possible but is not what I want.
Any idea how I could proceed? Does anybody else have experiences in this area?
I think this issue is not restricted to QTP but shared by any tool working on top of the SAP GUI Scripting API.
Thanks and regards
- Rüdiger
Edited by: Rüdiger Plantiko on Nov 21, 2008 4:24 PM

bigbrain28 wrote:
> Thank You, cfsearching! I don't quite understand 100%
how it works
As all three of us indicated you use array notation for this
type of
requirement. In ColdFusion you can use array notation or dot
notation
to access structure data. Almost all data in ColdFusion is
now some
type of structure.
I.E. #Form['myField']# is the same as #Form.myField#.
The advantage is that with array notation you can do things
you can not
do with dot notation. You can reference elements that have
keys that
are illegal variable names such as one with a space.
I.E. #url['my field'] is allowed, #url.my field# would fail
or course.
And you can concatenate the key string as we did with your
example.
I.E. #Form['aString' & aVariable]#
There are many powerful things one can do with this
knowledge. One can
access record sets with array notations. This can allow for
very
sophisticated parsing of a record set.
I.E. #myQuery['column'][row]#
You can dynamical call a variable. Thus creating dynamic code
that does
not even need to know what variables exist until run time.
I.E. #variables[anyName]#
This just scratches the surface.

Similar Messages

  • How to use the backup database to create report or update testing

    Hi,
    I have a fully backup of production database in the last month, and I have using Oracle 8.1.7. I want to known how can I use
    this backup to generate a new instance so that I can reproduct some report from the last month data or doing some update testing
    from the backup database with the both production instance and last month instance is opened at the same time. I have tried to
    create a new instance by using the oradim and startup the new sid with mount option and then use the alter database function
    to change the datafile name to the new directory. After this i also create the local service name and change to listerner. I can
    startup the new instance but when i start the production database. I got the error that I can open the database with exclusive.
    I do this in Oracle 7.3.4 and it works. But how can i setting it in Oracle 8.1.7. Anyone can help me and many thanks.

    Hi,
    Create the Second instance thro' Database Configuration Assistant, and Replace with Back up files.Now you can run two instances at parallel.

  • How to use the RFC's of a Model of 1 ESS appl. in other ess webdynpro Appl.

    Hi All,
    I need to add the name and address in the overview screen of W4 ess DC, The W4 uses P0210 Model which doesnot has these name and address fields,but the address ess DC application which uses P0006 Model has name and address fields, How can i put the name and address fields on overview screen of w4, moreover the overview screen is bizcardview.Please give your valuable suggestions.
    Thanks.

    I am trying to add primitive syntax highlighting to my JTextPane and have serious problems which I already stated in this forum. Now I read from uncle_alice that the text package from swing is not ment for that and that I need to write my own JTextPane and my own document and view.
    Can you explain what you mean by "writing my own JTextPane and View and Dcoument".
    My own Document I already have in order to provide SQL-highlighting.
    But what exactly do you mean by suggesting to write my own View! Whoever uses JTextPane doesnt really have much to do with its view. Can you give me a hint as I am completely stuck with an Exception : "javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Length must be positive"
    can you pinpoint the standard text-package's deficiency? it lacks what? what is the best work around?
    cheers
    ioannis

  • Using the Netbeans GUI within a Project with existing Ant Script

    I cannot seem to figure out how to use the Netbeans GUI in my Project with existing Ant Script. Is this possible? I have no problem creating GUI interfaces in a java Application, but attempting to make a new JFrame Form gives the error: package org.jdesktop.layout does not exist, and I have not been able to find a way around this. Any suggestions? Thanks in advance.
    Chris Coulon

    OK, I think I am on the right track, but I don't understand why I am still getting this error:
    clean:
    compile:
    Copying 1 file to /Users/chris/**JavaProjects/Netbeans_ImageJ
    Created dir: /Users/chris/**JavaProjects/Netbeans_ImageJ/source/build
    Compiling 292 source files to /Users/chris/**JavaProjects/Netbeans_ImageJ/source/build
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:31: package org.jdesktop.layout does not exist
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:31: package org.jdesktop.layout does not exist
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:34: package org.jdesktop.layout does not exist
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/plugins/Kline_Frame.java:38: package org.jdesktop.layout does not exist
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    4 errors
    /Users/chris/**JavaProjects/Netbeans_ImageJ/source/build.xml:11: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 6 seconds)
    I no longer have the error in my java code in the Projects list, but I still cannot build the project. This is my current build.xml file:
    <!-- Ant makefile for ImageJ -->
    <project name="ImageJ" default="run">
      <target name="compile" description="Compile everything.">
          <!-- Copy the swing layout library into dist.lib -->
        <copy file="dist/lib/swing-layout-1.0.3.jar" todir=".." />
        <!-- First, ensure the build directory exists. -->
        <mkdir dir="build" />
        <!-- Build everything; add debug="on" to debug -->
        <javac srcdir="." destdir="build" optimize="on" source="1.4" target="1.4" debug="on">
          <!-- The plugins directory only needs to be
                 present at runtime, not at build time. -->
          <!-- exclude name="plugins/**"/-->
        </javac>
      </target>
      <target name="build" depends="compile" description="Build ij.jar.">
        <!-- Copy needed files into the build directory. -->
        <copy file="IJ_Props.txt" todir="build" />
        <copy file="images/microscope.gif" tofile="build/microscope.gif" />
        <copy file="images/about.jpg" tofile="build/about.jpg" />
         <copy file="plugins/MacAdapter.class" tofile="build/MacAdapter.class" />
        <copy todir="build/macros"><fileset dir="macros"/></copy>
        <!-- Build ij.jar. -->
        <jar jarfile="ij.jar" basedir="build"
             manifest="MANIFEST.MF" />
      </target>
      <target name="clean" description="Delete the build files.">
        <delete dir="build" />
        <delete file="ij.jar" />
      </target>
      <target name="run" depends="build" description="Build and run ImageJ.">
        <copy file="ij.jar" toDir=".." />
        <java maxmemory="640m" jar="ij.jar" fork="yes" />
      </target>
      <target name="run2" depends="build" description="Build and run ImageJ.">
        <!-- Run in ImageJ directory -->
        <copy file="ij.jar" toDir=".." />
        <java maxmemory="640m" dir=".." jar="ij.jar" fork="yes" />
      </target>
      <target name="zip" depends="clean" description="Build zrc.zip.">
        <zip zipfile="../src.zip"
           basedir=".."
           includes="source/**"
        />
      </target>
      <target name="javadocs" description="Build the JavaDocs.">
        <delete dir="../api" />
        <mkdir dir="../api" />
        <javadoc
               sourcepath="."
               packagenames="ij.*"
               destdir="../api"
               author="true"
               version="true"
               use="true"
               windowtitle="ImageJ API">
        </javadoc>
      </target>
       </project>notice I added this line: <copy file="dist/lib/swing-layout-1.0.3.jar" todir=".." />
    because the dir ".." is where the other jar files are placed, i.e.:
    [GAIAG:~/**JavaProjects/Netbeans_ImageJ/source] chris% ls ..
    PolarDisplay          ij.jar               swing-layout-1.0.3.jar
    TestFrames          myApp
    api               source
    So why is the build not able to see the package org.jdesktop.layout in the jar file?
    Chris

  • How can I find out the screen size of the users moniter using the Acrobat SDK?

    How can I find out the screen size of the users moniter using the Acrobat SDK? I need to know how much sreen real estate that is available on the users moniter. Is there some call that I can make from the SDK to discover the maximun X and Y coordinates?
    Thanks,
    Gregory

    Currently, I am testing on multiple moniters and it is defaulting to the moniter designated as the #1 moniter. For our purposes, this is acceptable. Once the two documents have loaded, the user can move and re-size at will.
    Gregory

  • How to Create a PDF Document and apply Digital Signature in C# using the Adobe SDK?

    Hi Everybody!
    I have to do two distinct tasks here:
    1) How can I create a PDF document using the Adobe SDK in my .NET Applications(C# - 2.0)?
    I just need a basic sample to create a document with a simple text, for example. I did not find any useful information in the adobe documentation. I have the Acrobat Professional 8.0 in my computer, but it's very dificult to work whith de Acrobat.dll and .NET with a poor documentaion.
    2)How can I apply digital signature in a existent pdf document?
    I need to sign documents using the SDK, just a basic sample in c# would be helpful to start!
    Anybody could help?
    Thank in advance!

    Leonard Rosenthol or anybody that can help, sorry to insist.
    I will explain better my problem:
    I have an ASP.NET WebPAge (C# - 2.0). In this page, the user make a request. The request should generate a PDF document with the informations of the request and with a field to add a digital signature. The document created will be send to a approver that will confirm the approval applying his digital signature (I need to do too, a webpage where the approver open the page, choose the pdf document, and sign, just selecting his own certificate and clicking in the button SIGN... but this is another problem).
    That's the reason that I have to create a PDF document. If I create a WORD or HTML document, and then convert to PDF, how can I add a field to digital signature in this pdf document?
    Is there any solution using Acrobat SDK?
    Thank you very much!

  • How to call the RFC from R/3 to SRM, when we use webdynpro abap? (Urgent)

    Hello
    We use SRM Server 5.5 with classic scenario.
    We want to call RFC in R/3 from webdynpro ABAP.
    How can we do that?
    We are developing the web report using webdynpro abap.
    So we need some of R/3 data such like PR(EBAN)and PO(EKKO,EKPO).
    When user choose the search parameter, report diplay the Shopping cart, PR and PO data on webdynpro.  So we call the R/3 RFC to display the PR, PO data.
    But I tired to call the RFC in R/3, We could not call it.
    How to call the RFC from R/3 to SRM, when we use webdynpro abap?
    Thank you,
    Best Regards,
    SH.

    Hi
    <b>Please look at the following threads as well -></b>
    WebDynpro in SRM
    BAPI's /RFC's in SRM
    BAPI to Change Shopping Cart by RFC
    SRM60 and webdynpro
    Webdynpro Services Exception
    WebDynpro using BAPI has an error
    SRM60 and webdynpro...
    <b>SAP uses META Function modules in SRM to get data from R/3 back-end.</b>
    <u>For getting Purchase requistion data, use the function modules -></u>
    META_REQUISITION_CHANGE        Change purchase requisition              
    META_REQUISITION_CREATE        Create Requisition                       
    META_REQUISITION_DELETE        Delete/close purchase requisition        
    META_REQUISITION_GETDETAIL     Display requisition details              
    META_REQUISITION_GETITEMS      Display requisition items                
    META_REQUISITION_GETRELINFO    Get Releasease Info for requisitions
    <u>For getting Purchase order data, use the function modules -></u>
    META_PO_CREATE                 Create purchase order                    
    META_PO_DELETE                 Delete reservation                       
    META_PO_GETDETAIL              Display purchase order details           
    META_PO_GETITEMS               Display purchase order items             
    META_PO_GETRELINFO             Display purchase order release information
    Hope this will definitely help. Do let me know.
    Regards
    - Atul

  • Any tutorials on how to use the daily build of the Flex SDK to create Flash Player 10 content?

    Is there a tutorial on Adobe on how to use the daily build of
    the Flex SDK to create Flash Player 10 content?

    The approach you take might depend on a few things, but it boils down to using mouse interactive coding to trigger whatever effect you eventually realize.  The code you use will depend on the version of Actionscript you plan to use.
    You could make this as a movieclip that is normally stopped at its first frame and when you mouseover or click the movieclip, it animates along its own timeline to its enlarged state.  If the thumbnail is very small and the larger version is substantially larger, and both need to be clear images, this might be the better approach.
    If this only involves enlarging something, you could also probably realize it just using Actionscript Tween coding rather than timeline animation.

  • How to use the image manipulation palette to extract a part of an image

    How to use the image manipulation palette to extract a part of an image?I have a parent image from which i need to extract a certain sub part.can somebody pls help me on how to use this particular tool?
    Thanks

    Use the above snippet. You might need to convert the Image Type you are using with picture functions. The above snippet will give you good idea on how to achieve what you intend to.
    -FraggerFox!
    Certified LabVIEW Architect, Certified TestStand Developer
    "What you think today is what you live tomorrow"

  • I am using Photoshop CC2014 15.00.  In the pop-up menu for the Fill command there is a place for Scripted patterns.  Within that part, the tree and the picture frame are grayed. Why?   I've seen demonstrations on how to use the feature but mine doesn't wo

    I am using Photoshop CC2014 15.00.  In the pop-up menu for the Fill command there is a place for Scripted patterns.  Within that part, the tree and the picture frame are grayed.
    Why?   I've seen demonstrations on how to use the feature but mine doesn't work.  I checked the updates and I have the current version.
    Thanks.      LM

    I am running CC 2014.2.1 and I've updated to Yosemite. Not seeing tree or frame as an option in the menu. Coworker still on Mavericks has it.

  • Using the RFC adapter (sender), how do I know which RFC is being sent?

    Hello everyone!
    Has anyone used the RFC adapter (sender) in XI to pick up RFC messages? How would I know which RFC is triggered for example when a user creates a PO (purchase order)?
    Warm Regards,
    Glenn

    Glenn,
    When u are writinfg RFC program, u will have destination right?  There u know u have to give RFC Destination(SM59) while creating RFC destination we will be giving Program ID .
    Similarly in XI while creating Sender RFC u have to give the program id. So with these program id these programs are linked together and triggered from R/3 to the exact Sender adapter.
    Please see Michal weblog for more details
    /people/michal.krawczyk2/blog/2005/03/29/configuring-the-sender-rfc-adapter--step-by-step
    I hope it clears your doubt!!!
    Best regards,
    raj.

  • Okay so I set up my Time Capsule already and is now backing up 2 of my iMacs. Works great. What I want to know is how to use the TC to directly store files? I want to do this to delete some files but still have them on the TC for future reference..

    Okay so I set up my Time Capsule already and is now backing up 2 of my iMacs. Works great. What I want to know is how to use the TC to directly store files? I want to do this to delete some files on iMac 20inch but still have them on the TC for future reference..eg some movies on iTunes. I want to directly save them on the drive so I can delete them from iTunes and gain some storage. (Ps on iMac 20 inch (it's almost full - 320 GB) when I enter time machine, a tab comes up on finder which reads "Time Machine backups" it's able to be ejected like a disc or a connected device. On the iMac 20 inch, I dragged some files onto there as if using it like a hard drive. Is this the correct method? Then I went to my 27inch iMac and saw the "Time Machine Backups" hoping to see the files I dragged from the 20inch iMac. But the files were not there except a folder that said "Backups.backupdb". Can someone help me?

    It's not a good idea to use a network disk for both Time Machine backups and other things.  By design Time Machine will eventually consume all the space on its output disk, which will then cause problem for your other files.  I'd store those other files on an external disk connected to the Time Capsule.  The problem with that is that Time Machine will only back up files that are local to your Mac.  That means that you'll only have one copy of the files on or attached to your Time Capsule.
    By the way, you've been misled by poor field labeling on this forum into typing a large part of your message into the field intended for the subject.  In the future just type a short summary of your post into that field and type the whole message into the field below that.

  • 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!!!!

  • How to Use the language function for assignment and validation

    Hi All,
    If anyone can explain me in details with example ,how to use the language function for assignments and validations?
    Thanks
    Arnab

    Hi Arnab,
    The expression is checked only for the current MDM session.
    If u login with the ABC language it will always show the ABC language no matter how many times u execute it.
    Try connecting to the DM with the XYZ language.
    It should go to the if part rather than else.
    Hope it helps.
    Thanks,
    Minaz

  • How to use the divide() function in bpel

    Hi All,
    How to use the divide() function in bpel.
    pls can u give the one sample example

    2 div 4
    Eg;
    <assign name="Assign_1">
    <copy>
    <from expression="2 div 4"/>
    <to variable="outputVariable" part="payload"
    query="/client:testProcessResponse/client:result"/>
    </copy>
    </assign>
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for