Reading and writing to EMV card - java

This is something new and I've never done any coding related to online transaction or debit/credit cards. I was told to study about EMV(EuroPay Master Visa) card to implement it in Android App.
So far, I have collected info about
APDU
file structure
"APDU Command" is sent to get useful info from card.
APDU fields (CLA, INS, P1, P2, Lc, Data, Le)
"APDU response" is sent back from card to card reader.
All these processes happen between the card and the card reader.
In my case, the card reader is attached to an android device. I may need to display card details to user in android app (Ex: Displaying last 4 digit of card number).
My questions are
what are the possible values in APDU command fields if i want to authenticate card.?
How to communicate between card reader and device using Java.
PS: I don't need any codes. I just need a simple explanation, I will continue R&D once i understand the concept.

What you are asking for is an EMV course, that's a lot for a SO question.
As outlined by #kushal, you'll have to go through the EMV Specifications, they contain a lot of command samples, and will describe the sequence of commands required to complete a transaction.
But by doing so, what you're trying to achieve is to write an EMV Kernel, which is costly and time consuming, as outlined in this SO question. Count a couple of years of development for this, not taking into account the bank integration part... If what you want to achieve is just to process transactions, what you want to do is to buy an EMV kernel (ex : from level2kernel, verifone, Ingenico, etc.).
You can take a look to an example of a an Interac Flash transaction (contactless EMV) here, that will give you an overview of the complexity of the protocol.

EMV Card SpecificationFirstly you have understand the EMV 4.2
Then You have to communicate with the reader to android device by the help of UsbManager Class. then send the specific APDU`s to the Card then the card give the Following information.

Related

Android emulate NFC with Smartphone as reader

I'm looking for a way to use my phone instead of a nfc card. To do that I would create an Android App.
I live in Switzerland and the national rail company uses a nfc card called "Swisspass" to load annual tickets, ... on it for conductors to read it and look if the ticket is valid. A year ago they issued a new function called "Swisspass Mobile" where in your app you can display a QR code for the conductors to scan. You can also add your pass to Google Pay as a loyalty program card. If you do so it shows you a url which looks like that:
HTTP://1SP.CH?S=SXXXXXXXXXXX
Where the SXXXXXXXXXXX is your member id. The problem with the QR code is that it takes way longer for the conductor to check and it is in general difficult to do so, as the train is constantly moving. If you take this url and generate a QR code form it in any other app it works as well.
So my thought was to use my phone to send this URL to the smartphone the conductor uses to make their and my life easier. I had a look at this
https://developer.android.com/guide/topics/connectivity/nfc/hce
but I can't really figure out what AID I would have to use or if I even need to use HCE in that case as it's not a NFC tag reader but a smartphone. Do you know any more information? Could I use peer to peer or just send the url by nfc to the conductors smartphone? How would I do that?
Thanks a lot in advance

Possible to modify mini controller/micro controller code on store product?

My girlfriend recently bought a product for her skin, its basically a mask with lights on the inside that runs a power cord similar to an auxiliary cord into an auxiliary port on a mini controller. It is only good for 30 uses, every time you turn it on, an lcd screen counts down til it hits 0, then you have to buy a new controller.
I find it extremely wasteful to buy a new plastic controller after 30 uses. My question is it possible to somehow connect this device to my laptop through the aux port or aux port extension and modify the code written on it.
I work as a web developer by trade, so I am no stranger to code. I just need to know how to connect it, read the code and compile the code, etc, to modify the counter or remove it.
It is ЯU 94v-0 mini controller (Yes, the R is backwards)
Interestingly enough if I plug the mask into my iPhone or Mac, it will power one set of lights (there are two types/sets), but not the other.
Thanks in advance for the hackery advice.
I Have Better IDEA! Just buy new device (This device has an memory ATMLH436, which is basically same as AT24C02 eeprom chip), disconnect the WP pin and connect it only with the VCC pin, it then can't write the counter down (since it will be write protected), every time you pull the batteries out and in again, it will be as fresh as new. Should work like a charm :D
Here is the historical answer, maybe usefull to someone in the future:
How to hack instruction.
This device has an memory ATMLH436, which is basically same as AT24C02 eeprom chip, which is an EPROM with I2C interface, it is 2 KBytes memory. And the counter is most likely stored on this element.
You need to buy a new device, connect the not used eeprom to a i2c programator (you need to buy one, or ask a friend, I remeber this as a simple device connected to a rs232 port, but you can find one for usb), read the memory content and store it in a file and then you can use this file to reprogram the eprom to the original "new" state every time you want.
How to connect the i2c eeprom to mac:
hmmm, you need to have an i2c programator, that's first step.
Check the one you're about to buy if it has a Macintosh compatible software for reading/ writing.
If not, maybe use other computer.
remeber that in order to be able to program the device you need to connect the pin 7 (Write protect pin) to the ground. Here's the chip spec: http://www.atmel.com/Images/doc0180.pdf
Basically in oreder to communicate with the device you need:
know the address of the device - it is set by the A0,A1,and A2 pins connected either to ground or VCC - the programator soft will require that address.
connect the SDA, SCL and GND pins to the programator.
the chip need power supply of 5V connected beetween GND (-) and VCC (+) to operate.
In order to program the WP pin needs to be connected to GND.
There are big chances that: A0,A1,A2 and WP are grounded, but I can't be sure.
In case of this scenario the address of the device is 1010000 and there's nothing left that needs to be done in oreder to program it. I assume if the WP pin is not grounded you can disconnect it from whatever it is connected to and hardwire it to ground - should not affect normal operation of the device. probably you don't need to unsolder the chip in order to be able to read/write it, you need to connect GND, SDA, SCL and VCC. I would make a connector for these 4 pins to have it accessible from ouside of the device.
In order to make my life easier for many reprogram cycles, I would solder some connector to not have to disssassemble the device each time I need to reprogram it.
There are small chances that the counter is in the fat black round dot on the PCB, in which case there's nothing you can do to reset it since it is some custom chip without spec - if you have a great lab with X-RAY machine (like https://www.hawkerrichardson.com.au/electronic-production-systems/inspection-test-a-repair/unicomp-ax-8200) and other such stuff + lot of experience you could :) but rather not many people have such toys since they are very expensive :)
There are some pins to connect to the rounded chip, but I don't have any idea how to use them, what's the protocol or anything...
but if they could produce eprom inside of it, they wouldn't probably use any additional external eeprom because of the costs. But since eeprom production is not so easy as the regular chip, they use rather external memory from other supplier rather that producing one by themself - it's one logical argument that the counter is there in the AT24C02.
The correct way to hack this thing would be to listen to the I2C communication line with a scope. Note the exact binary sequence.
Then remove the external eeprom entirely and replace it with another MCU, which only has one task and that is to reply as the main MCU expects it to do. Though of course it never saves the down-counter.
Essentially you'd get this sequence each time you power up:
Main MCU: "Hello my eeprom, can I get the counter?"
Hack MCU: "Err yes I am totally an eeprom, the counter is 5."
Main MCU: "Store the counter value 6".
Hack MCU: "Roger that" (does nothing).
You'll get the same sequence over and over.
To succeed you need to know: microcontroller programming, I2C, basic electronics, soldering.

Having problems getting Weight Data with Android from a BLE Scale

I'm currently developing an android app for a weight scale I received that transmits data through bluetooth low energy.
I was looking at documentation and if I got the information correctly, there are specific UUIDs for data. I received a BLE scale with a Chinese protocol document found here: http://www.anj.fyi/protocol.pdf
I found and was able to get a functioning scanner working that lists the device name and the UUIDs it broadcasts.
Lets say I want just the weight data to show up in the UI, nothing else and nothing more.
I don't know what UUID they used for the weight data, and there are a lot of UUIDs. Probably 20+. I checked a UUID compilation and the usual weight data UUID does not show up.
How do I get the data from those UUIDs?
I'm thinking it might be the ones that are notifications, indications or read properties.
Looking at the UUID for example, f000ffc2.
How would I get data from that characteristic? Would anyone have an example code to grab the data from those UUIDs, or tutorials because I'm terribly lost right now.
I really appreciate it.
There are no weight information on the document you list http://www.anj.fyi/protocol.pdf, it is only shows the BLE module hardware interface spec, i.e. it does not specify the detailed service and characteristic.(I an a native Chinese speaker).
Regarding to the UUID you want to know which is the one to represent the weight, yes you are right it should be the read/notification feature without write permission. Can you use the apps e.g. lightblue on iOS to receive the notification(meanwhile change the value on your device) to test it? this will help you to understand which characteristic is the one you want.

working with IC card reader and SLE5528 smart card

Am having an IC contact card reader and SLE5528 smart cards.Am wondering how to get started working with these items really.
The reader is being read and i see no effect when i insert the smart card .
i also installed the smart card shell of opensmart from http://www.openscdp.org/
but i can't get to read any card reader with it.Am wondering whether it has compatibility issues.
Please i know i may have asked the question inappropriately, but am kindly asking anyone there to help me out on this.
Any relevant links or helpful information to get me started and done will be of great help
Thanks in-advance.
As stated earlier a 5528 is a memory card, no smart card. The smart card shell mentioned is only able to address real smart cards. Make sure, that your (unmentioned) reader is able to read memory cards at all and how. Neither PCSC nor the java framework as best knwon interfaces to cards will help you here (the latter one being targeted towards JavaCards). That nothing worth noting happens, when you insert a card in the reader is not so unusual - the maximum reaction to be expected is a LED flashing shortly (if the reader has one), comparable to putting a USB stick into the port. Since no standard software knows how to handle a card, there will be no further reaction.
Suggestion: search for "5528", "4428" articles here or "memory card" in wikipedia, and prepare to invest some time and work.

Audio programming, Sound Processing and DSP

I was playing with a karaoke application on iPhone and came up with following questions:
The application allowed its users to control the volume of the artist; even mute it. How is this possible?
Does adjusting artist sound/setting equalizer etc. mean performing some transformation of required frequencies? What sort of mathematics is required here(frequency domain transformations)?
The application recorded users voice input via a mic. Assuming that the sound is recorded in some format, the application was able to mix the recording with the karaoke track(with artists voice muted). How can this be done?
Did they play both the track and voice recording simultaneously? Or maybe they inserted additional frequency(channel?) in the original track, maybe replaced it?
What sort of DSP is involved here? Is this possible in Java, Objective C?
I am curious and if you have links to documents or books that can help me understand the mechanism here, please share.
Thanks.
I don't know that particular application, probably it has a voice track recorder separately.
For generic 2-channels stereo sound the easiest voice suppression can be performed assuming that artist's voice is somehow equally balanced between two channels (acoustically it appears in center). So the simplest 'DSP' would be subtract one channel from another. It does not work that well however with modern records since all instruments and voice are recorded separately and then mixed together (meaning that voice will not be necessarily in phase between two channels).
I have written two detailed blogposts on how to get a custom EQ in iOS. But i have no details about how to do the DSP yourself. If you simply want to choose between a wide range of effects and stuff, try this.
First post explains how you build libsox:
http://uberblo.gs/2011/04/iosiphoneos-equalizer-with-libsox-making-it-a-framework
The second explains how to use it:
http://uberblo.gs/2011/04/iosiphoneos-equalizer-with-libsox-doing-effects
please up the answer if it helped you! thanks!

Categories