title: error using PKCS#12 certificate to sign some data with Java
body: <p>I'm trying to use a PKCS#12 certificate to sign some data.
  I signed the data successfully in the development machine, but after I deployed the application into production machine I run into some problem.</p>
  
  <p>In the development machine I have Oracle jdk 1.6.0 and centos 6.2 and in the production machine there is IBM jdk 1.6.0 with IBM AIX.</p>
  
  <p>The problem is that I can't get the private key with it's alias out of the KeyStore instance which is loaded with the certification file , 
  it seems that there is no entry in the KeyStore, while I have printetd the entries which exist in the certification file with
  keytool command(so there is no problem with the file), also this code runs in the development machine without any problem.</p>
  
  <p>any help is appreciated</p>
  
  <p>Here is the code:</p>
  
  <pre><code>KeyStore ks = KeyStore.getInstance("PKCS12");
  String certFileAbsPath =  this.getClass().getClassLoader().getResource("").getPath() + File.separator + "file.p12";
  File file = new File(certFileAbsPath);
  FileInputStream fis = new FileInputStream(file);
  ks.load(fis, null);
  Enumeration aliasEnum = ks.aliases();
  String aliasName = null;
  while(aliasEnum.hasMoreElements()){
      aliasName = (String)aliasEnum.nextElement();
      logger.debug("alias: " + aliasName);//nothing is logged!
  }
  </code></pre>