Unable to calculate correct C-MAC for doing EXTERNAL AUTHENTICATE

I’m facing a problem successfully executing the EXTERNAL_AUTHENTICATE command for establishing a secure session. I get a 69 82 response meaning “Security status not satisfied”. I have concluded that the C-MAC I’m computing must somehow be wrong, because when I walked through the a tutorial file given to us, I’m not able to arrive at the same C-MAC value illustrated in the document .
Command : 84 82 01 00 10
Input Data : F6 17 A4 CB 36 80 F3 37 (Host cryptogram)
For the above data the C-MAC computed is shown as “3F 67 D7 B5 0C 0D 9C 60” using the S-MAC key AD79403568BE1B46250E389475D2BD7E but I’m arriving at a S-MAC key value of “98 18 0c 25 38 ad 54 8c” using the same key and a padding of 8000000000000000000000
I’m pasting below a sample program that shows how I’m arriving at this value. Can you please help me understand what they are doing differently to arrive at the values that only work with the card?
Thanks
Kannan
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class Cryptogram
public static byte[] hexToBuffer(String hexString) throws NumberFormatException
          int length = hexString.length();
          byte[] buffer = new byte[(length+1)/2];
          boolean evenByte = true;
          byte nextByte = 0;
          int bufferOffset = 0;
          if ((length%2)==1)
               evenByte = false;
          for (int i=0; i<length; i++) {
               char c = hexString.charAt(i);
               int nibble;
               if ((c>='0')&&(c<='9'))
                    nibble = c - '0';
               else if ((c>='A')&&(c<='F'))
                    nibble = c - 'A' + 0x0A;
               else if ((c>='a')&&(c<='f'))
                    nibble = c - 'a' + 0x0A;
               else throw new NumberFormatException("Invalid hex digit '"+c+"'.");
               if (evenByte) {
                    nextByte = (byte)(nibble<<4);
               } else {
                    nextByte += (byte)nibble;
                    buffer[bufferOffset++] = nextByte;
               evenByte = !evenByte;
          return buffer;
private static SecretKeySpec getKeySpec(byte[] key) {
if (key.length == 16) {
byte[] key24 = new byte[24];
System.arraycopy(key,0,key24,0,16);
System.arraycopy(key,0,key24,16,8);
return new SecretKeySpec(key24,"DESede");
} else {
return new SecretKeySpec(key,"DESede");
public static byte[] cbcMac(byte[] data,byte[] sessKey) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
byte[] temp;
Cipher cbcDES = Cipher.getInstance("DESede/CBC/NoPadding");
byte[] DEFAULT_ICV = new byte[8];
IvParameterSpec params = new IvParameterSpec(DEFAULT_ICV);                         
cbcDES.init(Cipher.ENCRYPT_MODE, getKeySpec(sessKey), params);
temp = cbcDES.doFinal(data);
byte[] signature = new byte[8];
System.arraycopy(temp, temp.length - 8, signature, 0, signature.length);
return signature;
public static void main(String args[]) throws Exception
byte[] toSign = HexString.hexToBuffer("8482010010f617a4cb3680f3378000000000000000000000");
          byte[] sessKey = HexString.hexToBuffer("AD79403568BE1B46250E389475D2BD7E");
          byte[] cryptogram = cbcMac(toSign,sessKey);
          System.out.println("Cryptogram=" + HexString.bufferToHex(cryptogram));
}

user4928701 wrote:
I don't know the format you are mentioning, I'm using oberthur v7 card.
I realized that the mistake was in the padding of "8482010010f617a4cb3680f3378000000000000000000000";
I'm supposed to pad only with 800000 as that gives a number of bytes in multiple of 8, but I had added yet another 0 sequence of 8 bytes.
The format for external authenticate is 5 byte command + host cryptogram + C-MAC value for the padded sequence computed using S-MAC key.Then you are using the wrong code. The code you posted is for generating the host cryptogram. The code for the MAC for each command (including EXT AUTH) is different.
Cheers,
Shane

Similar Messages

  • Is there software for mac for doing up documents

    Hi I am new to mac and i would like to know if there is sofware that i can get for doing Documents. Regards Dave

    Doing what, exactly? There are lots of applications for word processing such as Microsoft Word (part of Office 2011,) Apple's Pages (part of their iWork suite,) and several open source freeware suits: Open Office, Neo Office, and Libre Office. Look for these and more at MacUpdate or CNET Downloads. You can also find applications at the App Store using the App Store application in your Applications folder or on the Dock.

  • Unable to get correct sort order for subquery

    Hi,
    I have this complex subquery and I am sort of stuck on how to get the correct sort order. Here is the query
    select *
    from
    (select r.ResultsId, r.TestName, p.ProjectName, h.PhaseName,
    t.TypeText, s.StationName,
    to_char(max(r.ExecutionStartDate) over
    (partition by r.TestName, b.ConfigValue, .ConfigValue,
    d.ConfigValue),
    'DD MON YYYY HH24:MI:SS'), r.Owner, t.Status,
    b.ConfigValue Language, c.ConfigValue Telemetry,
    d.ConfigValue Flex
    from Results r, Projects p, Phase h, Type t, Station s, Status t,
    ConfigResults b, ConfigResults c, ConfigResults d
    where
    r.resultsId = b.resultsId and
    r.resultsId = c.resultsId and
    r.resultsId = d.resultsId and
    b.configurationid = 1 and
    c.configurationid = 2 and
    d.configurationid = 3 and
    r.projectid = p.projectid and
    r.statusid = t.statusid and
    h.PhaseId = r.PhaseId and
    t.TypeId = r.TestTypeId and
    s.StationId = r.StationId and %s
    Order By
    r.TestName, b.ConfigValue, c.ConfigValue, d.ConfigValue)
    order by resultsid
    My results are sorted by TestName, ConfigValue but I am trying to the
    results sorted by resultsid
    Any assistance would be greatly appreciated.
    Thanks,
    Jeff

    What happens if you add an order by r.resultsid to your order by statement directly in your subquery rather than doing an order by later?
    It will not work because I need to specify the exact fields that I use in
    the partition by statement.
    Jeff

  • HELP! unable to find correct drivers to for P755 s5390

    After a hard drive failure, I had to install a new hard drive and do a clean install of Windows 7. A recovery disk is not available. I've reviewed the driver files for my computer at the Toshiba drivers/downloads page. I followed the instructions to select my operating system (Win7, 64 bit) and then click on the type of driver I'm looking for (e.g. LAN). Problem is that there are multiple DIFFERENT files. For example, under LAN for my system there are wireless LAN drivers for Realtek and Intel. There seem to be multiple choices (not just different version numbers) available on most categories I click on.
    To compound my frustration, after guess loading a variety of different drivers, the Satellite keyboard stopped working (no error message, mouse is still working fine). I can find no way to reenable it and I'm thinking that I may have to do another reinstall of Windows.
    Very frustrated. It should not be this difficult. Can anyone help:?

    Satellite P755-S5390
    Best to restore the hard disk to its original out-of-the-box contents using Toshiba recovery media. All the drivers and utilities are properly preinstalled. Windows is preactivated.
    If you failed to burn recovery discs, you can obtain them from Toshiba. Scroll down to Get Recovery Media here.
    For instructions, see the section Restoring from recovery DVDs/media, which begins on p. 76 of the User's Guide.
       Satellite/Satellite Pro P700 Series User’s Guide
    -Jerry

  • Unable to Copy from my Mac to my external drive? Can you help!

    Hi,
    I am a Ex-Windows user who has just invested in a Mac and as you can imagine my knowledge is very limited so im looking for a little help please!
    When i connect my Maxtor 350gb external hard drive to my Macbook via its USB lead it appears on the desktop as you would expect but if i try to drag and drop and sort of file onto it i get the following message...
    the item "file name" could not be moved because "External HD" cannot be modified
    Can someone advise me as to how i can resolve this issue please.
    Regards, T.
    Macbook Black   Mac OS X (10.4.8)  

    Hi Tom,
    first of all: WELCOME TO THE DISCUSSIONS!
    How did you format that external drive? Open disk utility and select the external drive in the sidebar. Now read what is written in the bottom part of the window. It will say something like "partition-scheme" and when you select the volume it should say something about the "Format".
    There are Windows formats and partition schemes that can be read by MacOS X but are read-only. In this case you will have to reformat the drive.
    If this answered your question please consider granting some stars: Why reward points?

  • Unable to locate folders on mac moved from external drive

    Hello Experts,
    I purchased a Macbook Pro 15 days back(MD102). On 18th Aug, I connected my External HD(Buffalo) accessible only on Windows to my Windows 7  and created a LAN connection between MAC and Win7 so that I can access the files of HD and Move them from HD connected on my WIN to MAC.
    Now, all the files and folders were moved and the HD was empty, but I saw them grayed out in the folder on MAC where I copied the,. I cannot open the files and folders.
    I read somewhere on forums to make alias, which didn't worked. Then I read somewhere that moved those folder to a new folder, I did that and still not able to access them and I did and UNDO, now the folders are not there in the previous folder and not in the new folders and they disappeared.
    These are very important folders for me. PLEASE HELP!!!
    Thanks,
    bg_16

    No, the files are not on windows or on HD. I moved the files i.e. cut and paste from the HD connected on Win and directly copied them to MAC as the HD was not readable on MAC.
    I notice that the files and folders were there but they were grayed out, but when I copied them to new folder on MAC and did UNDO they disappeared.
    I assume they are somewhere on the MAC drive as I haven't moved anything to Trash and not yet emptied the trash once since I got this MAC.

  • Unable to install a software driver for Canon film scanner on mac OSX 10.6

    I am unable to install a software driver for a Canon film scanner FS4000US. I have downloaded it from Canon then open the package click the install and it asks for a location namely the Applications folder. Then it says it has been installed re -start etc, but still no driver.
    I am using Mac OS 10.6. Any suggestions greatly received. I have repaired/disk and permissions and it still does not work.

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Console in the page that opens.
    Select "/var/log/install.log" from the file list. Post the messages from the last installation attempt, starting from the time when you launched the Installer or Software Update.
    Post the log text, please, not a screenshot. If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • I have a Nikon D600 and D800 and I shoot everything in Raw. I use Photoshop Elements 9 for processing but I have been unable to convert any RAW files to open in PSE. Says unable to parse the file. What does this mean and how do I fix it?

    I have a Nikon D600 and D800 and I shoot everything in Raw. I use Photoshop Elements 9 for processing but I have been unable to convert any RAW files to open in PSE. Says unable to parse the file. What does this mean and how do I fix it?

    Since pse 9 can only use up to camera raw 6.5 and the d600 needs at least 7.3 and the d800 needs at least 6.7, you can use the
    8.6 adobe dng converter to convert those files to dng copies, which then pse 9 should open.
    8.6 dng converter
    windows
    Adobe - Adobe Camera Raw and DNG Converter : For Windows : Adobe DNG Converter 8.6
    mac
    Adobe - Adobe Camera Raw and DNG Converter : For Macintosh : Adobe DNG Converter 8.6
    Note:
    If you have windows xp or vista or mac os x 10.6, then you'll need to use the 8.3 dng converter instead
    windows
    Adobe - Adobe Camera Raw and DNG Converter : For Windows : Adobe DNG Converter 8.3
    mac
    Adobe - Adobe Camera Raw and DNG Converter : For Macintosh : Adobe DNG Converter 8.3
    how to use the dng converter
    Camera Raw: How to use Adobe DNG Converter - YouTube
    more info on supported cameras and camera raw plugins required
    Camera Raw plug-in | Supported cameras
    Camera Raw-compatible Adobe applications

  • Ps CC 2014 is not working correctly after mac update to Yosemite 10.10.1.  Select does not protect unselected areas.  Magic eraser erases unselected ares.

    Ps CC 2014 is not working correctly after mac update to Yosemite 10.10.1.  Select does not protect unselected areas.  Magic eraser erases unselected ares.

    Yes my particular issue is not like yours. However, there have been many other laptop users experiencing similar problem to yours after 3.10 kernel. Mostly it seems to be bumblebee users that experience your problem with the blank screen. We do know that nvidia have yet to make their official drivers work with kernel 3.10 and up. The drivers in the Arch repository have been patched to work with 3.10. From what I have seen, this also only seem to be affecting laptops with newer nvidia gpu's. I fear there is not much to do with this problem until nvidia give official 3.10 kernel support.
    My suggestion would be to stick with 3.9.9 kernel and the drivers that work with it, and don't upgrade those packages until nvidia has addressed these issues. If you have a look at the nvidia forums you will see quite a number of topics mentioning black screen when starting x on 3.10 kernel, and also a thread for the system dying. Reading some of the threads there may help you keep up to date on whether or not the issue seem to be solved.
    https://devtalk.nvidia.com/default/board/98/

  • I AM STRUGGLINT TO ACCESS MY IPHOTO'S AND HAVE TO GO THROUGH APPLICATIONS TO ACCESS MY PHOTOS. HOW CAN I CORRECT THIS PLEASE. DOES THE MAC HAVE A DEFRAG?  TX

    I am having problems viewing my iPhoto from the dock and have to go through my applications to view. What do I have to do to correct this please? Also does the Mac have a defrag function? I have also been advised by the sales person that the Mac does not need an antivirus programme, is this true?

    I'm sorry but your post make no sense
    first off All Caps is not necessary and makes things hard to read and is consider shouting - it is rude
    Second you do not have "an iPhoto" - iPhoto is an application that manages photos - the photos are stored (by default) in the iPhoto library in a SQL lite database and you use the iPhoto program to manage them
    I am having problems viewing my iPhoto from the dock and have to go through my applications to view.
    can you please explain this in some detail. When you launch iPhoto by clicking on the iPhoto icon in the Dock what happens?
    As to your other OS questions this is certainly not hte best place to address them - we are iPhoto users just like yourself here  ---  basically as I understand it (and I have had had Macs for 30+ years) there is no "defrag and you do not need one - and antivirus is your choice - most people feel it is a waste of money on a Mac but some like to have it
    LN

  • Is there an application like "snag it" for mac?  Does it come with the Mountain Lion OS, or do I have to buy it separately?

    Is there an application like "snag it", which is part of the Microsoft Office suite for mac?  Does it come with the Mountain Lion OS, or do I have to buy it separately?  If it is a separate purchse, what would you recommend?

    Built-in to OS X is the ability to capture an entire screen or selected portions. Snaps are saved to the Desktop by default:
    COMMAND-SPACE-3 snaps the entire screen.
    COMMAND-SPACE-4 lets you select a portion of the screen to snap.
    In your Utilities folder is a utility called Grab that provides similar functionality and more.
    Then there are dozens of third-party solutions such as SnapNDrag and SnapzProX. You will find them and others at MacUpdate or CNET Downloads. Most have trial versions or trial times so you can test them out.

  • When i go to 'New Folder' the name box only opens for a second so I dont have time to name it correctly. Rename Folder does the same thing - any thoughts??

    when i go to 'New Folder' in outlook the name box only opens for a second so I don't have time to name it correctly. Rename Folder does the same thing. Any thoughts? Many thanks.

    Hi Clint,
    Did you get a reply from anyone for this problem?  I'm having the same problem and wondering what the resolution might be.
    Thanks

  • Please, the battery of my mac air does not last more than two hours, it's been over 30 days I sent for technical assistance and nothing! I am very disappointed with the mac air, I had a very different expectation of apples products!!

    Please, the battery of my mac air does not last more than two hours, it's been over 30 days I sent for technical assistance and nothing! I am very disappointed with the mac air, I had a very different expectation of apples products!!!

    Maybe the problem is not your MB Air......
    Try these:
    Make sure bluetooth is turned off if you're not using it.
    Set your screen brightness to 4 bars.
    See what's loading in your login items.  Delete the ones you don't need.
    Open Activity Monitor - under All Processes see what's using most of your CPU's resources.
    Highlight the ones with the highest %CPU and hit quit process.
    Remember that when Apple says that your battery should last 7 hours, they tested it just browsing the web and not have anything open in the background and screen is set at 50% brightness.

  • I had just upgraded my OS to the OS X Mavericks.  After doing so, I noticed that my MS Outlook for Mac 2011 does not sync with the calendar/contacts/notes, thus, also not sync these info with my iPhone4s anymore.  Please help, thank you.

    Dear Sirs,
    I had just upgraded my OS to the OS X Mavericks.  After doing so, I noticed the following changes:
    1) My MS Outlook for Mac 2011 does not sync with my Mac book's calendar/contacts/notes.
    2) My iPhone4s does not sync with my Mac book's calendar/contacts/notes anymore.
    Please help, thank you.
    aawwii

    Correct, USB local sync was taken away from iphones and ipads with 10.9.1 and 2. We are not allowed to speculate on rumours it might come back in 10.9.3 plus new iTunes. Either wait and see or explore Syncmate 5 beta free trial.
    icloud still works.
    Cant help with the Outlook problem.

  • Adobe Acrobat 10.1.3 Mac OS does not inherit the Duplex setting from PPD for HP printers

    Adobe Acrobat for the Mac OS does not inherit the setting from the PPD for the printer. Our current settings for the PPD has Duplex enabled as the default for the HP LJ 9050 and it works in all the application with the exception of Acrobat 10.1.3, Acrobat does not inherit this setting from the driver.  Our previous installation with Acrobat 10.1.0 duplex worked well with our PPD configuration where Acrobat inherits the setting from the PPD and duplex is default for all our black and white printers.
    We found reference to the reserve issue with 10.1.2 in the forum but that solution is global for all printers and it only works with version 10.1.2 
    Does anyone know how to set the default printing settings in Acrobat version 10.1.3 to allow us to have duplex printing by default on the Mac.

    >It looks like a typical case of finger pointing, Adobe blames Epson, Epson blames Apple. Apple blames the user...
    No, you still don't get it...Lightroom is a Cocoa app...it uses Cocoa printing APIs...therefore, print drivers will have to be rev'ed to support those Cocoa APIs...the 3800 (6.10) DOES...the earlier 3.5x drivers won't under Leopard.
    What's the driver version of your R800? Something like 3.09? The odds are REAL GOOD (since Epson hasn't released an updated driver for that printer yet) that it's not been updated.
    So, you are just gonna have to wait for Epson to rev the drivers, use Tiger instead of Leopard or print out of Photoshop CS3 (which is a Carbon app and uses the Carbon APIs) or not print.
    You may not _LIKE IT_ but those are your options...

Maybe you are looking for

  • Database View is not appearing in the ABAP Coding

    Dear Friends, I am very much new in the ABAP. Actually I worked last 8 years in the Oracle PL/SQL. Recently, my company implements SAP. The database is Oracle 10g. I would like to use my oracle experience in the project. But in everywhere I faced som

  • How to call Fortran .dll file that using other library files?

    Hi, I am trying to do some arkward tasks using LabView, and I am desperately need help....  A little bit background: 1. My co-worker has some code written in Fortran, where he called other libraries (many from CERNLAB or PAW). Those stuffs are pretty

  • How do I get Creative Cloud.app to stop asking me for my old email address ?

    How do I get Creative Cloud.app to stop asking me for my old email address that I do not have access to? I have reinstalled it several times and it stills asks for it! I spent several hours on Chat and my help specialist logged off before I had an an

  • White space issues between content and footer.

    I am having white space/page length issue between the end of my content and the footer. I have read the forums and tried changing the page length minium height to 800 and then I unchecked the sticky footer in page properties on both the master page a

  • Load XML and edit

    Hi I am new to Flex and AS3 but I have some experience with XML, XSLT, XPATH, VB etc.. I am having trouble just loading the XML. How do I load an external XML file so I can edit it? This is what I have so far: <mx:Script> <![CDATA[ var myxml = 'xml/r