Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8059337

No response in calling sun.security.pkcs11.wrapper.PKCS11.C_DestroyObject(Native

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6u45
    • security-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_45"
      Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
      Java HotSpot(TM) Server VM (build 20.45-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      SunOS zone1 5.11 11.1 sun4v sparc sun4v

      A DESCRIPTION OF THE PROBLEM :
      There's no response in calling javax.crypto.Cipher.init(int i, java.security.Key key) in Solaris 11 sometimes.

      Here's the thread stack:

      "RMI TCP Connection(12352)-10.230.7.132" daemon prio=3 tid=0x02feb800 nid=0x4b77 runnable [0xab76d000]
         java.lang.Thread.State: RUNNABLE
      at sun.security.pkcs11.wrapper.PKCS11.C_DestroyObject(Native Method)
      at sun.security.pkcs11.SessionKeyRef.dispose(P11Key.java:1081)
      at sun.security.pkcs11.SessionKeyRef.drainRefQueueBounded(P11Key.java:1057)
      at sun.security.pkcs11.SessionKeyRef.<init>(P11Key.java:1072)
      at sun.security.pkcs11.P11Key.<init>(P11Key.java:98)
      at sun.security.pkcs11.P11Key$P11SecretKey.<init>(P11Key.java:379)
      at sun.security.pkcs11.P11Key.secretKey(P11Key.java:271)
      at sun.security.pkcs11.P11SecretKeyFactory.createKey(P11SecretKeyFactory.java:220)
      at sun.security.pkcs11.P11SecretKeyFactory.convertKey(P11SecretKeyFactory.java:129)
      at sun.security.pkcs11.P11Cipher.engineGetKeySize(P11Cipher.java:842)
      at javax.crypto.Cipher.b(DashoA13*..)
      at javax.crypto.Cipher.a(DashoA13*..)
      at javax.crypto.Cipher.a(DashoA13*..)
      at javax.crypto.Cipher.a(DashoA13*..)
      - locked <0xf584db38> (a java.lang.Object)
      at javax.crypto.Cipher.init(DashoA13*..)
      at javax.crypto.Cipher.init(DashoA13*..)
      at com.utstar.nms.util.EncryptUtil.decrypt(EncryptUtil.java:107)
      at com.utstar.nms.securitydb.LoginMgrImpl.login(LoginMgrImpl.java:106)
      at com.utstar.nms.securitydb.LoginMgrFEImpl.login(LoginMgrFEImpl.java:23)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:303)
      at sun.rmi.transport.Transport$1.run(Transport.java:159)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      at java.lang.Thread.run(Thread.java:662)

      Source code:

          public static String decrypt(String encryptText) {
              try {
                  Cipher c1 = Cipher.getInstance("DES");
                  byte[] keyByte = hex2byte(key);
                  ByteArrayInputStream intemp = new ByteArrayInputStream(keyByte);
                  ObjectInputStream in = new ObjectInputStream(intemp);
                  SecretKey desKey = (SecretKey) in.readObject();
                  intemp.close();
                  in.close();
                  String str = new String(decode(encryptText.getBytes()));
                  byte[] decoded = hex2byte(str);
                  c1.init(Cipher.DECRYPT_MODE, desKey);
                  byte[] clearByte = c1.doFinal(decoded);
                  String finalStr = new String(clearByte);
                  return finalStr;
              }
              catch (NoSuchPaddingException e) {
                  e.printStackTrace();
              }
              catch (NoSuchAlgorithmException nsae) {
                  nsae.printStackTrace();
              }
              catch (IOException ioe) {
                  ioe.printStackTrace();
              }
              catch (ClassNotFoundException nce) {
                  nce.printStackTrace();
              }
              catch (InvalidKeyException ike) {
                  ike.printStackTrace();
              }
              catch (BadPaddingException bpe) {
                  bpe.printStackTrace();
              }
              catch (IllegalBlockSizeException ibe) {
                  ibe.printStackTrace();
              }
              return null;
          }


      REPRODUCIBILITY :
      This bug can be reproduced occasionally.

      SUPPORT :
      YES

            coffeys Sean Coffey
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: