%1 is not a valid Win32 application

Hello,
I'm trying to compile and run a tutorial using PKCS11 for tokens. Here's the code I'm using
import iaik.pkcs.pkcs11.Module;
import iaik.pkcs.pkcs11.Slot;
import iaik.pkcs.pkcs11.Token;
import iaik.pkcs.pkcs11.TokenException;
import iaik.pkcs.pkcs11.TokenInfo;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
## Special License Rights - Contract #
## WARNING: Do not use, modify or deliver without written permission
## from Harris Corporation
* FILE: SmartCardTutorial.java
* Copyright (C) 2011 Harris Corporation. All rights reserved.
* CLASSIFICATION: Unclassified
* @author <a href="mailto:[email protected]">kjones34</a>
public class SmartCardTutorial
   private Module pkcs11Module;
   public static String DLL = "C:\\Windows\\system32\\acpkcs211.dll";
   public SmartCardTutorial(String librarayPath)
      try
         pkcs11Module = Module.getInstance(librarayPath);
         pkcs11Module.initialize(null);
      catch (IOException ex)
         Logger.getLogger(SmartCardTutorial.class.getName()).log(Level.SEVERE,
                                                                 null,
                                                                 ex);
      catch (TokenException ex)
         Logger.getLogger(SmartCardTutorial.class.getName()).log(Level.SEVERE,
                                                                 null,
                                                                 ex);
   public Slot[] getTokenSlots()
      throws TokenException
      return pkcs11Module.getSlotList(Module.SlotRequirement.TOKEN_PRESENT);
   public void printTokenInfos()
      throws TokenException
      Slot[] slots = getTokenSlots();
      if (slots.length == 0)
      { // No tokens connected
         System.out.println("Sorry, Couldn't find any token");
      else
         // Let's get the first slot
         Slot selectedSlot = slots[0];
         // Let's get the connected token
         Token token = selectedSlot.getToken();
         // Get the token infos
         TokenInfo tokenInfo = token.getTokenInfo();
         System.out.println("Token : " + tokenInfo.getLabel());
         System.out.println("Vendor : " + tokenInfo.getManufacturerID());
         System.out.println("Serial Number : " + tokenInfo.getSerialNumber());
    * @param args
   public static void main(String[] args)
      SmartCardTutorial sct = new SmartCardTutorial(DLL);
      try
         sct.printTokenInfos();
      catch (TokenException e)
         // TODO Auto-generated catch block
         e.printStackTrace();
}and here's the error I get:
Jun 22, 2011 3:35:21 PM SmartCardTutorial <init>
SEVERE: null
java.io.IOException: %1 is not a valid Win32 application.
C:\Windows\system32\acpkcs211.dll
     at iaik.pkcs.pkcs11.wrapper.PKCS11Implementation.connect(Native Method)
     at iaik.pkcs.pkcs11.wrapper.PKCS11Implementation.<init>(PKCS11Implementation.java:166)
     at iaik.pkcs.pkcs11.wrapper.PKCS11Connector.connectToPKCS11Module(PKCS11Connector.java:75)
     at iaik.pkcs.pkcs11.Module.getInstance(Module.java:202)
     at SmartCardTutorial.<init>(SmartCardTutorial.java:39)
     at SmartCardTutorial.main(SmartCardTutorial.java:89)
Exception in thread "main" java.lang.NullPointerException
     at SmartCardTutorial.getTokenSlots(SmartCardTutorial.java:59)
     at SmartCardTutorial.printTokenInfos(SmartCardTutorial.java:65)
     at SmartCardTutorial.main(SmartCardTutorial.java:92)I'm not familiar with this error and I'm not sure where to start looking to fix the problem.
Has anyone encountered this before?

Hi,
You should check the DLL you have. As far as I can tell, this error is coming from the Win32 LoadLibrary call in the iaik native code that is loading the P11 library. I have tried the following code on my system and it works fine.
import iaik.pkcs.pkcs11.Module;
* @author sfarmer
public class SCardToken {
    private final static String DLL_PATH = "./acpkcs211.dll";
    private Module p11;
     * @throws Exception
    public SCardToken() throws Exception {
        p11 = Module.getInstance(DLL_PATH);
        p11.initialize(null);
        System.out.println(p11.getInfo());
    public static void main(String[] args) throws Exception {
        new SCardToken();
}Output:
Cryptoki Version: 2.11
ManufacturerID: ActivIdentity                  
Library Description: ActivIdentity Cryptoki Lib SDKThis is where you are getting your IOException from:
   * Load the PKCS #11 DLL
  hModule = LoadLibrary(libraryNameStr);
  if (hModule == NULL) {
    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL,
        GetLastError(),
        0, /* Default language */
        (LPTSTR) &lpMsgBuf,
        0,
        NULL
    exceptionMessage = (char *) malloc(sizeof(char) * (strlen((LPTSTR) lpMsgBuf) + strlen(libraryNameStr) + 1));
    strcpy(exceptionMessage, (LPTSTR) lpMsgBuf);
    strcat(exceptionMessage, libraryNameStr);
    throwIOException(env, (LPTSTR) exceptionMessage);
    /* Free the buffer. */
    free(exceptionMessage);
    LocalFree(lpMsgBuf);
    return;
  }Cheers,
Shane

Similar Messages

  • I am trying to download icloud control panel via icloudsetup.exe to windows Toshiba laptop and get a message" \icloudsetup.exe is not a valid Win32 application. Can anyone help? I am new to Apple stuff.

    Need help for icloud photo stream, have activated ps on iphone 4 and set up icloud back up for email, contacts, iwork, and find my ihone. Need to find photos that we thought were being saved/shared as well but evidently not. Found on another search that I may need the icloud control panel so tried to download it but when try to install i get, C:\Users\Downloads\icloudsetup.exe is not a valid Win32 application. I am using a Toshiba laptop with windows 7, which the system requirements are met. I am new to Apple stuff, so any and all help would be greatly appreciated.

    It suggests the installer is getting damaged during the download.
    I'd first try downloading an installer from the Apple website using a different web browser:
    http://www.apple.com/quicktime/download/
    If you use Firefox instead of IE for the download (or vice versa), do you get a working installer?

  • Error message, not a valid win32 application

    Please help if you can, because I am new to computers. I have downloaded itunes (setup), which is only 11 meg, but it should of been 56 meg. When I click on it now, it say's run, then itunes setup exe is not a valid win 32 application.
    I have tried this about 4 or 5 times, even deleting the whole file and re-installing several times. Please help, many thanks

    Have you had a look at this troubleshooting page? It may be of some help: iTunes: Windows reports that iTunesSetup.exe is not a "valid Win32 application"

  • ITunes set up gives an error message saying not a "valid win32 application"

    I am using Windows 7 and trying to download iTunes, but when I try to open the iTunes set up it gives an error message saying that it is not a "valid win32 application". It does the same for downloading quicktime. I have no idea what this means or what to do about it.

    That suggests that the installer is getting damaged during the download.
    I'd first try downloading an installer from the Apple website using a different web browser:
    http://www.apple.com/itunes/download/
    If you use Firefox instead of IE for the download (or vice versa), do you get a working installer?

  • When i try to install Firefox 4 on my 64 bit Windows 7 Ultimate, error that it is not a valid win32 application

    When I downloaded the Firefox 4 installer and tried to install the software, an error message appeared that the application was not a valid win32 application. have deleted the file, re-downloaded it but with same effect. Therefore I cannot install Firefox 4
    I have Windows 7 Ultimate 64 bit, 4 GB internal memory,
    Intel i7 processor. language English

    It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files by Firefox.
    Try to disable the real-time (live) scanning of files in your anti-virus software temporarily to see if that makes downloading work.
    See "Disable virus scanning in Firefox preferences - Windows"
    * http://kb.mozillazine.org/Unable_to_save_or_download_files

  • I have switched offices and computer. may I still access my old tunes? next, I get an error when trying to download Itunes to my new compuet: c:\DocumentsandSettings\aabugattas\desktop\itunessetup.exe is not a valid Win32 application  How can i download i

    I have switched offices and computer. may I still access my old tunes? next, I get an error when trying to download Itunes to my new compuet: c:\DocumentsandSettings\aabugattas\desktop\itunessetup.exe is not a valid Win32 application  How can i download it?

    In the course of your troubleshooting to date have you worked through the following document?
    iTunes: Windows reports that "iTunesSetup.exe is not a valid Win32 application"

  • Scanstate.exe from USMT 5.0 from Windows 8.1 ADK fails on Windows XP with "%1 is not a valid Win32 application"

    We started to test our Windows XP SP3 (32-bit) to Windows 7 migration zero-touch task sequence in ConfigMgr 2012 R2 and we can't get past the following error from the "Capture User State" step running on XP...
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The task sequence execution engine failed executing the action (Capture User State) in the group (Capture Files and Settings) with the error code 2147942593
    Action output: ...  params successful
    Building USMT command successful
    Successfully connected to "\\JHQCM01.jhq.net\SMPSTOREE_FB121F31$\A1ADF87C012E6998B5753B112299BEE4F8868207FAE3D75671798DF6A7DD1A33"
    Executing command line: "C:\_SMSTaskSequence\Packages\JHQ0004E\x86\scanstate.exe" "\\JHQCM01.jhq.net\SMPSTOREE_FB121F31$\A1ADF87C012E6998B5753B112299BEE4F8868207FAE3D75671798DF6A7DD1A33"
    /o /localonly /encrypt /keyfile:*** /efs:copyraw /v:5 /vsc /l:"C:\WINDOWS\CCM\Logs\SMSTSLog\scanstate.log" /progress:"C:\WINDOWS\CCMLogs\SMSTSLog\scanstateprogress.log" /i:"C:\_SMSTaskSequence\Packages\JHQ0004E\x86\MigApp.xml"
    /i:"C:\_SMSTaskSequence\Packages\JHQ0004E\x86\MigDocs.xml" /i:"C:\_SMSTaskSequence\Packages\JHQ0004E\x86\MigExclusions.xml"  /uel:90 /ue:VM0142511382\* /configC:\_SMSTaskSequence\Packages\JHQ0004E\config.xml
    Invoking ReleaseSource on USMTPackagePath C:\_SMSTaskSequence\Packages\JHQ0004E
    OSDMigrateUserState finished: 0x800700c1
    CreateProcess failed. Code(0x800700C1)
    Command line execution failed (800700C1). The operating system reported error 2147942593: %1 is not a valid Win32 application.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    To troubleshoot, we tried running the x86 version of scanstate.exe (from USMT from the Windows 8.1 ADK) manually by just double clicking on it on a few Windows XP SP3 systems and we get a similar error as seen below...
    So, we thought maybe USMT from our Windows 8.1 ADK install maybe somehow corrupt, but downloading and installing it again results in the same error, so it does not seem to be a file corruption issue.   The x64 version of scanstate.exe works
    fine on 64-bit OS's, its just Windows XP SP3 (32-bit) we are seeing this error.
    Has anyone successfully using scanstate.exe from USMT 5.0 from the Windows 8.1 ADK successfully to capture user state from a Windows XP SP3 (32-bit) system?
    Regards,
    JJ

    Windows 8.1 ADK comes with a newer version of USMT (NOT 5.0) and crashes. I learned this today the hard way. I hope Windows 8.0 ADK's loadstate.exe works for restoring to a 8.1 machine.
    Yesterday i used Windows Easy Transfer to move from XP to 7, and then re-did the backup in 7 so it would be compatible with 8.1, and it only restores files, not settings.
    So i will test USMT 5.0 in this same scenario, because i have 30 machines to change to newer machines with 8.1

  • Error when installing VMM - %1 is not a valid Win32 application

    Hi all
    I'm attemping an install of SCVMM and despite installing all prerequisites I'm faced with the following when I launch the installer/disc and click 'Install':
    "Error starting the Virtual Machine Manager Setup Wizard. %1 is not a valid Win32 application"
    this error is the proceeded with another:
    "Microsoft Visual C++ 2010 Redistributable was not successfully installed. The selected Virtual Machine Manager feature cannot be installed without this prerequisite. Retry setup or manually install Visual C++ 2010 Redistributable
    from Microsoft Download Center."
    The latter package is already installed and I have re-downloaded and re-installed as well to no avail. All .Net packages are installed too.
    I'm running a Windows Server 2012 R2 x64 virtual machine in a HyperV host (HyperV Server 2012) and have navigated the disc and launched the "SetupVMM.exe" located in the amd64 directory as I realise the above Win32 error points to a x86 application
    - still no joy, the same errors!
    I have tried the installer in a VMWare 2012 server with the same error and on a physical Windows 7 machine again same error so this makes me think I'm either missing something basic or have overlooked something seems the environment doesn't seem to make
    a difference (although obviously not attempted a x86 environment but SCVMM is listed as x86 or x64).
    This is for a lab test and personal experience before production so I realise running SCVMM within a virtual machine that is hosted on the same hypervisor isn't good practice - but it's a start :)
    Thanks in advance for any help you can give me.
    Sam

    Are you installing directly from the ISO? If so, you can try with a new ISO in case this is broken. Also make sure your machine is joined to the domain and that you are executing the setup in the context of a local administrator.
    Eventually, try to copy the ISO to local disk and run setup from there.
    -kn
    Kristian (Virtualization and some coffee: http://kristiannese.blogspot.com )

  • Error 'RecoveryMgr.exe is not a valid Win32 application' when trying to restore in Win7

    I really hope someone can help as this is driving me mad!
    System details - G62 Notebook running Windows 7
    The notebook crashed after a Windows update and wouldn't boot up.  I made it into the recovery manager and back my files before restoring to factory settings. 
    Since getting back in I am unable to get my files back.  I have tried through the recovery manager but it does not allow me to see the files on the dvd.  I have also tried through backup and restore but no joy there either.  When I click on RecoverMgr.exe on the dvd I get error 'RecoveryMgr.exe is not a valid Win32 application' and it won't open.
    I hope someone has managed to solve this before as I would love my files back.  All suggestions greatly appreciated and thanks in advance.

    Thanks Mumbodog.  Unfortunately I have tried and the files won't copy.  Starting to think they are corrupt!  Have tried on a few different PC's but no luck.  Really annoyed   Any other suggestions?

  • When I try to open Firefox 4.0 I get an error message saying that it is not a valid Win32 Application. What do I do? I am using Windows XP Sp3

    I downloaded Firefox 4.o exe. When I tried to open it I got an error message stating that it was not a valid Win32 application. I am using windows XP SP3. How do I get it to open?

    [[Firefox is already running but is not responding]] has steps that you can try. It sounds like you may have something that is hanging your browser on exit (probably an extension or a locked profile) and the steps on that page should help clear it up.

  • ITunesSetup.exe not a valid WIN32 Application????

    I've been deployed to Afghanistan for the past 13 months and have another 4 to go. I'm trying to download Itunes 7.0.2 and when I go to install it I get an error that reads ITunesSetup.exe is not a valid WIN32 application. What the **** does this mean. I only have a couple of days to get this fixed and my Ipod crashed with that RavMon virus lastnight. Anyone please help

    I had the very same problem with installing, and have no idea what it means. I've searched all over support, and asked the very same question about 4 months back.
    One odd thing about it, though. It didn't seem to make a difference when installing. The installer would get partially finished, and the error would appear. The installer would then start "rolling back actions" and when you would think it would close, it would start back up again. I have no idea why, but the installation completed normally, and my itunes works fine.
    If it doesn't work the first time, try it a couple more times. That's what happened with me.

  • Itunessetup.exe is not a valid win32 application?

    I am trying to install the newest version of iTunes, but no matter what I try, the same error message comes up and won't let me install -- itunessetup.exe is not a valid win32 application.
    What do I do?
    Thanks.

    Espero que alguien hable español ya que yo tengo el mismo problema. Y hasta el dia de hoy no he podido utilizar mi ipod. Gracias anticipadas...hmc

  • Itunessetup.exe is not a valid win32 application?!? help!

    has anyone else been getting an error message when trying to upgrade to itunes 7 that says something to the effect of "itunessetup.exe is not a valid win32 application" ???
    does anyone know what this means or how i can fix it??

    grgatzby,
    Empty the cache files of your browser and temp directory as described here: http://docs.info.apple.com/article.html?artnum=93976
    Then save the file again to another location on the computer.
    If you cannot clear the cache, try to download the iTunes and quicktime setup installer from the quicktime site: http://www.apple.com/quicktime/download/win.html
    Jason

  • ITunesSetup.exe is not a valid Win32 application message

    I downloaded iTunes7 for 2000/XP, but when I try to install the .exe, I receive 'iTunesSetup.exe is not a valid Win32 application'. Any ideas on what might cause this error?

    In the course of your troubleshooting to date have you worked through the following document?
    iTunes: Windows reports that "iTunesSetup.exe is not a valid Win32 application"

  • Unable to open pfds as I am told it is not a valid win32 application.

    I am able to open a pdf if I right click and choose a program to open the pdf but if I just double click the error .pfd is not a valid win32 application apprears.
    How can I fix this
    Cheers

    Open a command prompt and enter
    assoc .pdf
    what is the reply?

  • "not a valid Win32 application" message when trying to install iTunes 7.0

    I have downloaded the new iTunes 7.0 setup file. When I click on the icon on my desktop, I get the message, " C:____\iTunesSetup.exe is not a valid Win32 application".
    This problem doesn't seem to be specifically addressed in the troubleshooting suggestions on this website. Does any one have any suggestions on what I can do to resolve this problem? I've tried uninstalling older versions of iTunes and Quicktime, and re-downloaded new software package, but problem continues.

    After using the Windows Installer clean up tool and removing the iTunes 7.0.7.16 install file I was able to update to 7.0.2

Maybe you are looking for