How to change java card default key with my own keys? - javacard

I am trying to change a java card default keys (40 41... 4F) to my own key set. I tried to use JCManager but the process of Modify Key returns 6A 88 meaning that reference data not found.
Next I tried GPShell put_sc_key to change but same error returned.
What are proper P1 and P2 bytes for changing default keys?
How can I fix this?
APPENDIX 1:
This is the result of GET DATA command executed in GPShell as below:
mode_211
enable_trace
establish_context
card_connect
select -AID A000000151000000
Command --> 00A4040008A000000151000000
Wrapped command --> 00A4040008A000000151000000
Response <-- 6F108408A000000151000000A5049F6501FF9000
get_data -identifier E0
Command --> 80CA00E000
Wrapped command --> 80CA00E000
Response <-- E012C00401208080C00402208080C004032080809000
E012C00401208080C00402208080C00403208080
card_disconnect
release_context
APPNDIX 2:
This is the script by which I have tried to change key using GP pro with ACR83 reader:
gp -lock 010B0371D78377B801F2D62AFC671D95
Warning: no keys given, using default test key 404142434445464748494A4B4C4D4E4F
Failed to communicate with card in JnaCardTerminal{scardHandle=SCardContext{cd00000100000001}, name=ACS ACR83U 0}: SCardTransmit got response 0x57 (null: null)

I found pyResMan useful in my case. It is a python application which helps you easily list your key sets on your cards and add/modify keys.

Related

Tachograph smart card .ddd file signature

I have made android app that reads truck driver card (from tachograph) via otg smart card reader.
I can read all files on card from tree structure on image bellow.
But when I compare data that I read, and from some other public application, I have noticed that some files are fallowed by something that might be a key or signature
I do not know what underlined part represents nor how to read or generate it.
Without those "signatures" all data that I have is useless, but if I hard code those underlined parts (from other apps) in my ddd file, everything works fine
The most I have found is that
05 04 - Current usage Data
01 - means there is still a signature (gen 1)
00 80 - 0x0080 = 128 dec
Also I have read card certificate and ca certificate from card but didn't find is there any correlation with underlined part of problem.
Thanks to #nvf I found explication and solution in document
Part of responses .ddd that start with "01 00 80" represent digital signature of hash value on previously selected file.
To get digital signature you should select file, execute command to perform hash of file, and then execute command to get 128 bytes digital signature.

cantools.database.errors.Error: Standard frame id is more than 11 bits

I used cantools python package to decode canbus message. I used a dbc file created by me for testing. I copied a sample file. When I use can id like 419358976, I get error. But for smaller can ids like 350, it works. Does cantools fail for extended frame ids? how do I get this working?
my code which is failing for extended id's is as follows:
db = cantools.database.load_file('.\\src\\test\\resources\\j1939.dbc')
print(db.decode_message(419358976,b'\xff\xff\xff\xc0\x0c\xff\xff\xff'))
error: cantools.database.errors.Error: Standard frame id 0x18fee900 is more than 11 bits in message EEC1.
I found the answer for my question. The can id like 419358976 is an extended id. So to map that id to the id in the dbc file, I need to add another 32 bit hex number 8000 0000 to the hex can id. Then convert that result hex number to decimal and use it as the id field in the dbc file. It works perfectly after. The above error message is gone after

How to personalize PF key assignments in Control-M?

Control-M's ISPF client in zOS (mainframe) comes with a set of predefined values assigned to PF keys (function keys), such as:
PF2 = SPLIT
PF9 = SWAP
However, similar to other ISPF applications, I'd like to change the values of those PF keys (and a few others, such as PF2 = RETURN) like so:
PF2 = SPLIT NEW
PF9 = SWAP NEXT
And trying to use standard ISPF's primary command "PFKEYS" "KEYS" (typo, pointed out in first answer), via which you can adapt the values of your PF keys, doesn't seem to work for Control-M either (you only get error message "UNRECOGNIZED COMMAND", no matter on which screen you try this command).
Any suggestions about how to change those values for PF2 and PF9 anyhow?
PFKEYS is not a valid ISPF command. The proper commands to access the ISPF PF Key Definitions and Labels dialog are KEYS for context sensitive key assignments or ZKEYS for global key assignments.
Navigate into Control-M, then use the KEYS command to launch the dialog and assign the desired function key commands. You may need to explicitly enter the SAVE command to commit your key assignment changes to your profile (although PF3 should invoke an END, which includes a SAVE).
Subsequently, PFSHOW (or the short version, FKA) will add an "infobar" of sorts to your panel that shows the PF keys, and either the defined label or the first 8 chars of the command that is currently assigned to each function key. Enter PFSHOW OFF (or FKA OFF) to remove this display.
The KEYLIST ON/OFF command can be used to switch between default and custom key assignments for some product panels. Enter the KEYLIST command with no arguments to see if options are available. FWIW... I don't have access to Control-M, but our installation of other BMC products does not include custom keylists.
Some PFkey errors can be attributed to installation procedures that do not include the appropriate members in logon procs. For Control-M, these members appear to be CMTCMDS and/or CMTUCMDS. The sysadmins responsible for installing the product would likely need to address this type of issue. However, the issue described here provides no indication of an installation problem.

Xboxdrv "windows/super" key EV_KEY name

I want to map windows/super keyboard key in my xboxdrv config but KEY_SUPER or KEY_WINDOWS doesn't work. what is the EV_KEY name of the "super" key? (I mean key with windows logo on many keyboards)
Either KEY_LEFTMETA or KEY_RIGHTMETA.
You can find it out using evtest, for example:
$ evtest /dev/input/event1
Once you press the button you are looking for, you should see something like this:
Event: time 1477389229.423141, type 1 (EV_KEY), code 126 (KEY_RIGHTMETA), value 1

Security Access Condition for smart card file structure

We are working with SCOSTA smart card with ISO7816-4 APDU Commands.
I had create file structure but didn't understand how to set security Access Condition in Compact and Extended Format
For Example.
I am using TLV structure for Creating File MF,DF,EF,SE etc
Deticated File will have following FCP:
Tag 8C
Len 08
Security Attribute AM 7F
VALUE FF Delete File(Self):Never
VALUE FF Terminate DF:Never
VALUE 22 Activate File:(SE#2)
VALUE 22 Deactivate File:(SE#2)
VALUE 22 Create File EF:(SE#2)
VALUE 22 Create File DF:(SE#2)
VALUE FF Delete File(child):Never
So My Question is :
Where from VALUE 22 Set and what is the meaning of SE#2 ?
How to calculate AM Byte?
I refer ISO/IEC 7816-4:2005(E) Document Page No:24-25
Tag 8C indicates an access rule in compact format. There an Access Mode Byte (7F) is followed by as many Security Condition Bytes as bits are set in the access mode byte. The example looks reasonable, even if in my opinion, it would be more intuitive, to leave out the bits (and corresponding SCBs) for which only a NEVER security condition byte follows. (An operation not explicitly allowed, should be rejected anyway).
The coding of the Access mode byte for a DF is found in table 16 and the encoding of the security condition byte is in table 20 of ISO 7816-4.
SE#2 means, that the key IDs necessary for User Authentication, External Authentication and Secure Messaging are determined by Security Environment 2, the value 22 means, that in your case only an external authentication is necessary.

Resources