What is maskgen tool in JavaCard - javacard

In JavaCard, can somebody please tell me what is the purpose of the maskgen tool?
What I have heard from my senior colleagues that it is the tool which converts the Java codes into C code for that particular JavaCard platform. But is answer seems to broad and lacking the exact particularity. If the above mentioned purpose is correct then my few questions are
1. How does it convert the java source code into C code ?
2. How can I see the source code of this maskgen tool ?
3. How can I convert my Java card source code using maskgen tool?

Quoted from Java Card 3 Platform Development Kit User Guide:
What id Maskgen tool?
The maskgen tool produces a mask file from a set of Java Card Assembly
files produced by the Converter. The format of the output mask file is
targeted to a specific platform. The plug-ins that produce each
different maskgen output format are called generators. The supported
generators are cref, which supports the Java Card RE, and size, which
reports size statistics for the mask. Other generators that are not
supported in this release include jref, which supports the Java
programming language Java Card RE, and a51, which supports the Keil
A51 assembly language interpreter. Java Card Assembly Syntax Example
provides additional information about the contents of a Java Card
Assembly file.
Where I can find Maskgen tool source?
The maskgen tool is not available or of use outside of a source
release bundle, so [...] if you do not have a source release of the
development kit you would have maskgen tool. If you have a source
release, you can localize locale-specific data associated with the
maskgen tool, see Localizing With The Development Kit.
How to convert Java Card sources using Maskgen tool?
Check Running Maskgen oracle page:
maskgen Example
This example uses a text file (args.txt) to pass command line
arguments to maskgen:
maskgen -o mask.c cref #args.txt
where the contents of the file args.txt is:
first.jca second.jca third.jca
This is equivalent to the command line:
maskgen -o mask.c cref first.jca second.jca third.jca
This command produces an output file mask.c that is compiled with a C
compiler to produce mask.o, which is linked with the Java Card RE
interpreter. Refer to Using the Reference Implementation for more
information about this target platform.
Above ".JCA" (Java Card Assembly) files are generated using Converter tool. Here is its manual.
Some related quoted info from here:
maskgen actually generates a mask.c file which contains VM bytecodes
that are interpreted by the JCVM and the applet is executed. The
mask.c file should be loaded onto the card. This method is used only
for static use of JavaCard.
And
Maskgen takes the CAP file (which is generated by the converter ), and
generates a mask.c file which will be a part of the cref in static
cards. The parameters for memory configuration of your MCU/processor
can be set in maskgen.cfg file.
Anyway, you need a binary release of JCDK to have this tool and its source.

Related

Searching for Python MSDOS parser library

Does anyone knows a good Python library to parse MSDOS files and obtain metadata and start()'s bytecodes? Like an alternative version of pefile library but for MSDOS? I can't seems to find any via Google.
If there isn't, is there a good source to refer to on MSDOS's file format? This way, I can create my own parser instead. I know there are tools like IDA Pro and Reko decompiler but I need a MSDOS file parser to automate some stuff. Thank you in advanced!
Reko decompiler maintainer here. For what it's worth, you can use Reko's MS-DOS source code and translate it to Python. It's not a lot of code and MS-DOS executables aren't that complex to parse -- it's quite a simple format. The relevant files are:
https://github.com/uxmal/reko/blob/master/src/ImageLoaders/MzExe/ExeImageLoader.cs
https://github.com/uxmal/reko/blob/master/src/ImageLoaders/MzExe/MsdosImageLoader.cs
You could also try executing the Reko code directly from Python. The Reko binaries are available as a nuget package: https://www.nuget.org/packages/Reko.Decompiler.Runtime
Use the class Reko.ImageLoaders.MzExe.ExeImageLoader in the Reko.ImageLoaders.MzExe class. Integration could be done with http://pythonnet.github.io/

Delphi Linux64: how to retrieve the version information set by Project Options Version?

I gather there is no universal standard for putting version numbers into executables on Linux, in contrast to Windows which requires a certain structure for those details.
FreePascal has made its own standard and Delphi lets you define Version information for a Linux executable.
If we can put Version information in, we must be able to get it back out? How? Specifically on Linux64?
I have searched *.pas and *.inc in Studio\19.0\source\rtl\posix and I have not found anything on 'version' nor 'fileinfo' that could help.
Back with Kylix, I used to use argp_program_version from libc.
On a clean new DUnitX project, after adding {$ *.res} to the DPR so that the version information will stick, I can look at Project Options for Linux64 and I can see that they have a CFBundleVersion number defaulting to 1.0.0 for the project. How can I get the CFBundleVersion at runtime in my Linux64 executable?
Or, if that is not possible, could/should Delphi match the FreePascal standard and put the fileinfo into something which both Lazarus and Delphi could view at runtime??
This excerpt (metioned at both Windows and MacOS/iOS sections) from https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Version_Info may help:
Go to Tools > Options > IDE > Environment Variables and add a new User variable called SAVEVRC with Value=TRUE. This variable enables the generation of a .vrc file with an auto generated build number and other information.
another excerpt from there (not sure if related to the aforementioned SAVEVRC or not) is:
Note: If you define the VersionInfo resource and add it to the project via a $R directive in the project file, the compiler will ignore settings of Version Info at Project Options dialog box and use the custom resource data instead, given an application can have only one VersionInfo resource on Windows.

Afrikaans collator data missing from ICU 57.1?

I am working on a C++ project which depends on ICU 57.1 for its collator service. As part of this project, I would like to create a .dat ICU archive file that includes all collator data. The ICU data library customizer tool (http://apps.icu-project.org/datacustom/) clearly shows that there is a collation tailoring for Afrikaans in the coll/af.res file. The ICU locale explorer also shows that the Afrikaans locale has a tailoring of the Unicode Collation Algorithm given by the following rule:
&N <<< ʼn
However, when I inspect the source/data/in/icudt57l.dat from a download of the 57.1 source code, it doesn't seem to include coll/af.res:
$ eval $(./source/install/bin/icu-config --invoke=icupkg) -l source/data/in/icudt57l.dat | grep af.res
af.res
curr/af.res
lang/af.res
rbnf/af.res
region/af.res
unit/af.res
zone/af.res
coll/af.res similarly seems to be missing if I build ICU from source using --with-data-packaging=files.
Am I doing something wrong or is there an actual problem with the ICU data?

How to make docset on Linux?

I use Zeal to lookup API documentation on Linux. It requires files to be in the Apple docset format.
I have C++ code for which I can generate documentation using Doxygen. Doxygen can build a docset, but it requires the docsetutil program, which is not available on Linux.
Is there any other method to create a docset of a C++ codebase on Linux?
"No need for docsetutil if you're generating a Dash-only docset," suggests the developer of Dash. Likewise according to the Dash documentation, you need the following entries in the Doxygen config file to generate the docset (the last 3 are optional):
GENERATE_DOCSET = YES
DISABLE_INDEX = YES
SEARCHENGINE = NO
GENERATE_TREEVIEW = NO

Changing "Publisher" information for a ".exe" file

HOW I CAME ACROSS THIS
I wrote code for a simple stopwatch which can also double up as a Rubik's cube timer. The source code and the executable are here:
Cube timer
Anyway my doubt is not regarding this code(It works fine).
I downloaded the executable that I had uploaded to check if it worked fine and at that time I was greeted with this screen:
Open file - security warning
And under this dialogue box there was a field that said:
Publisher : Unknown Publisher
SCREEN SHOT:
DOUBT
Is there some way programatically or otherwise by which I can change the publisher field?
SPECS
I have compiled the code with Microsoft Visual C++ 2010 Express.
You can easily change the publisher, either when linking/compiling by setting the appropriate resources for your project (e.g. CompanyName), or modifying the resources with a resource editor.
Your problem is really that there is no signature, so even if a publisher field is present it cannot be trusted.
You can find an example resource rc file near the end of http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx.
To add resources to your VC project check:
How do I embed version information into a windows binary?
VC++ 2012: How to include version info from version.inc (maintained separately) into the .rc file
The .rc file(s) will be compiled to binary (.res) and linked into your final executable.
To add or modify an existing executable, you should be able to use this tool (login required, this will cause the signature to be invalid in an already signed binary of course).
The Microsoft Authenticode documentation includes tutorials.
CAcert.org will sign a certificate you can use, and have instructions for getting started with Authenticode.
Sorry I can't be more helpful with VC, I don't use it, I usually using mingw and make, from some time ago targetting win32:
given a VERSIONINFO in a text version.rc file use mingw32-windres to compile it to a .o file (I actually had a bunch of .rc files, they were each #include-d in a single resources.rc so I only needed to run windres on that single file, and link a single extra object file)
include that version.o (or combined resources.o) in the final CC command, assuming compile and link to executable in one step
I also included -lversion when linking, AFAIR this was just because I used GetFileVersionInfo() for the code to check and display its own version in the 'About' dialog.
Make your program in a batch file, then using Advanced BAT to EXE Converter, convert it to EXE & fill out all of the fields. This sure helped me! :)

Resources