I have a javacard and it has 2 applets installed. Now I would like to select one among the two. Currently how I do is that, I provide the cap file of the applet from which I get its AID. But I don't find this method satisfactory. So
Is there a way or steps to get the AID of the applets installed in a java card without having the cap file?
Is there a way to select the applet without its AID? By this I mean that is there a way to make an applet auto selectable after reset?
Are there any other ideas or insights over this?
For the questions you have asked,
Yes. PyApduTool can make you reach you goal. This tool can help you get all the packages' or applets'AID in java card even though you don NOT have the cap file.
Just press the "Refresh" button. the things you need appears in the right text field.
You can set you applet as "Default Selected" when installing it.
In this way, you can make you applet selected by default without having to know its AID.
For convenience, it should be better to know the applet-AID.
Only one applet can be the default selected.
The answer from Andy is good but i feel that its missing an important part of the question:
Javacard get applet AID of installed applets through Java code
If the question refers to finding installedf Applets from the code of one java card applet itself than this answer might apply:
First, it is possible to get the AID of the applet itself by JCSystem.getAID().
Second, it is not possible to "detect" other applets from within an installed applet.
Although if you know the other applet's AID you can get a hack of useful information about it using JCSystem and GPSystem.
So apart from inside JavaCard code, the Card Manager is able to list of installed applets with all their privileges and so on. You can use a tool of your choice. If you are working with JCOP, I recommend JCOP Shell. If you work with freeware I recommend Global Platform Pro from Martin Paljak.
Beside selecting AIDs and default selection there is no direct way to select an applet. There is an indirect way by using the SharedObjectInterface mechanism from JavaCard which lets you change control flow to a different applet.
Related
I'm using IntelliJ IDEA, I have coded a frame which I want to put into an HTML file so I can run it in my browser, how do I do this now that I cannot use JApplet? I have found this documentation: http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html and this http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html but I am new to programming and find this difficult to follow. I don't know for instance how I would go about putting my class files and the image that I used in a separate directory nor do I know how I go about signing my application so that it will run in a browser.
I want to put into an HTML file so I can run it in my browser,
You can use the Desktop class. This class allows you to access default applications from your desktop.
Read the section from the Swing tutorial o How to Integrate With the Desktop class for more information and working examples.
See Java Plugin support deprecated and Moving to a Plugin-Free Web.
Note that is one of my 'copy/paste comments' that does not explicitly mention JFrame based apps., however the links are still relevant in that Oracle & browser makers would not be phasing out support for applets if they wanted programmers to keep trying to shove rich client apps (e.g. Swing GUIs) into thin client web pages.
OTOH you can offer a JFrame (or a JApplet) to be launched from a link in a web page to end up free floating on the desktop of the user by using Java Web Start.
Even then, it is not a simple matter for the programmer or the end user. The programmer needs to ensure the app is digitally signed using a code signing certificate issued by a CA (usually they are expensive). The end user used to just be able to click the link, 'OK' the prompts produced by the Java virtual machine, and see the app appear on-screen. But now most browsers will download the launch file to the local file system rather than directly hand it to the JVM to be launched. So the user faces an extra step in explicitly finding the downloaded launch file and double clicking it.
This is all due to security concerns related to bugs in the plug-ins that run things in web pages. So if you were to find a way around all these hoops, please let us know. It is a security bug that requires urgent fixing.
I'm trying to capture images by using webcam in an applet. The applet makes use of JMF. But I managed to run applet without actually installing JMF. I kept a button in HTML webpage so that when the button gets clicked, the applet should capture the image.
But for me it is giving a java.lang.RuntimeException: No permission to capture from applets. How can this exception be resolved so an applet can capture image using webcam in HTML page?
In order to capture images in an applet, it is necessary:
For you to digitally sign the code.
For the user to click "OK" when prompted to run the signed code.
If the functionality is being called from a button using JavaScript, wrap the Java code in one of the AccessController.doPrivileged(PrivilegedAction) variants.
AFAIR the installer for JMF does not have the 'allow capture from applets' checked by default. That needs to be reconfigured in the JMF options. I forget how.
Update
I dont want to give client package to extra overhead of the installation of JMF.
That is just silly.
The components of the JMF must be available on the run-time class-path of the applet, for it to function. If they are downloaded by the JRE using the applet element (or whatever), then the user has incurred that 'overhead'.
But perhaps you mean you don't want to make the end user run the installer that advises to 'reboot' at the end. In that case, you are missing my point while avoiding answering my question. That question, again, is "How did you get the DLL?".
Applets run with very limited permissions and that might be causing the issue.. Here is an old post which has information about signing an applet to get the necessary permissions..hope this helps
I think flash is a much better option. There are really easy solutions for that even using Javascript + Flash.
Take a look at this: http://www.xarg.org/project/jquery-webcam-plugin/
This question asked Too many times in this forum..
Anyways..Here is the solution: Java swing Program to capture webcam images
you have to modify it for applet which takes only 30 minutes
I'm going to develope some Applets, And I was wondering What an Applet can and cannot do.
I know that an Applet can't write in the Registry or Windows folders.
Do you know other things ?
Thanks
Official docs http://download.oracle.com/javase/tutorial/deployment/applet/security.html
Much of it depends on whether you signed it or not.
There is one omission i know of in that....
Java AWT Robots are tricky since they give keyboard/mouse access to the applet. You can do it, but trust from the user alone doesnt cut it.
In this case you need to set your own custom security manager to grant permission to create a Robot
Edited for correctness based on comments, thanks guys
Actually a signed applet can access the Windows registry through JNI calls.
For more info on the applet capabilities get a look at http://en.wikipedia.org/wiki/Java_applet
I want to automate an external application, but I have several problems:
How can I recognize a button or other field of an external application in Java?
I use the Robot class in Java for making notepad automation where I open notepad, select file menu, and save or exit, etc.
The problem is, it needs X,Y coordinates for the mouse pointer to go to the proper location.
I want to make it more dynamic, i.e. it should recognize the file menu of a running notepad anywhere on the desktop.
How can this be done in Java? Is there any class in Java I can use to do this?
Thanks everyone to give me response, I want to be more specific i want to know how can i make ui automation by using any tool if it is not possible in java or using any api of java.automation tool must be freeware.....i am searching net for that i found AutoIt is like that.But if any one do this type of things please share his/her experiance means is it possible to do that in AutoIt or not possible if not then which tool do that kind of things.
It is easy to integrate Sikuli into a Java-application since it is written in Java. Sikuli uses image recognition to find elements visible on the screen like buttons and such. It is very easy to use and provides an alternative for tasks that are difficult to handle with static positioning, like finding moving windows and such.
Take a look at this: http://sikuli.org/docx/faq/030-java-dev.html
Hope this helps!
You should have a look at Sikuli. It takes as inputs images of the ui elements to select an area in the targeted app. It's a UI Automation Application
That's a bit difficult to install (at least on Debian/Ubuntu, where I tested it), as you'll need a recent version of OpenCV, a particular version of JXGrabKey but the quality of the program worth the trip. Good Luck
Java doesn't have an API to examine the UI of another application; that would be a very big security risk.
Which is why the Robot class can only record events (key presses, mouse movements and clicks) but not which UI element was involved in most cases.
It would be possible to do more if the external application was written in Java because then, you could analyze the objects in memory but for obvious reasons, this isn't possible for C++ or .NET applications.
We need a tool to test a set of fairly complex Java applications. The applications are mostly independent client programs or applets communicating with a servlet or apache server at a remote site. Specs:
Runnable on Windows XP, Vista and 7
Parameterizable (Can specify in a script the sequence of buttons to click, text to type in JTextFields and browser address bar etc.)
Can quit or bail out or display a nasty message if the expected window or dialog box doesn't appear
Record the output on the Java Console of browser in a .txt file (IE is sufficient for now) when the application opens a browser window.
While running, I should be able to see it running with folded hands while it would run
for a few minutes
We were thinking of writing an AWTRobot based tool that reads a command file and does this - (don't know how to do #3 or #4 yet - will ask you folks some day how to detect a window on the desktop). Would you suggest an open source tool available to do this? We don't need anything fancy to capture video or screenshots. Thank you, - M.S.
For browser based automated testing you can use Selenuim or you can use WebDriver.
The selenium project is hosted here
If you don't need to test the way the pages are actually rendered by the browser, but instead need to work at the HTTP/HTTPS/etc request level then have a look at JMeter. It has parametrization, dataproviders, graphs, and a proxy component for recording http user sessions.
If you do need browser testing, then, as has already been mentioned, Selenium is probably the best freely available tool. For production I would recommend using Selenium Remote Control server which can be driven by scripts written in Java/Python/C#/Perl/PHP.
To see what tools people use in real production environments, and to do your own research on what is available I recommend www.sqaforums.com.
Have a look at Sikuli
The reason I suggest this is it sounds like you need to test both a Java applet and the content of a native browser (launched from Java, but not itself Java) -- so it's not "Java all the way".
I'm not sure what you mean by criteria 4, though. It is worth noting that as Sukuli works by image analysis, it won't be able to copy text to a text file.
This question is an invitation for sales pitch, don't you think. How about Mercury Quicktest professional ( I believe its HP Quick test now). I do not believe this will be cheap either ( and well its HP, it will probably only work in IE ;)).
Since you want an open source solution, I believe, the most popular option is selenium and yes its a pain to configure sometimes ( like for Flex for example). So you should try Watir.
There is a lot of good buzz around it and when I evaluated it, I loved what I see.Also it does not work for desktop applications, I suggest you try some other solution for that.
(The problem is open source GUI testing tools are not usually all inclusive. If you need one solution to handle all your gui testing needs, then you should check out the more commercial ones like QTP.
I have used IBM Rational Functional Tester. It has everything you need and it's quite easy to learn. The scripting language is either Java or VB.Net so you won't have to worry about learning a language for your tests.
I had some pretty good results with Squish from FrogLogic and didn't break the bank: http://www.froglogic.com/products/
Did you try Squsih - http://www.froglogic.com/products/index.php