jdk/src/share/classes/sun/security/pkcs11/P11Key.java
changeset 4809 c00eed67999d
parent 2180 9994f4f08a59
child 5291 d6df082f6524
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Key.java	Tue Jan 19 11:43:45 2010 +0800
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Key.java	Thu Jan 21 23:59:41 2010 +0000
@@ -45,6 +45,8 @@
 import sun.security.pkcs11.wrapper.*;
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
+import sun.security.util.DerValue;
+
 /**
  * Key implementation classes.
  *
@@ -1000,8 +1002,16 @@
             try {
                 params = P11ECKeyFactory.decodeParameters
                             (attributes[1].getByteArray());
+                DerValue wECPoint = new DerValue(attributes[0].getByteArray());
+                if (wECPoint.getTag() != DerValue.tag_OctetString)
+                    throw new IOException("Unexpected tag: " +
+                        wECPoint.getTag());
+                params = P11ECKeyFactory.decodeParameters
+                            (attributes[1].getByteArray());
                 w = P11ECKeyFactory.decodePoint
-                            (attributes[0].getByteArray(), params.getCurve());
+                    (wECPoint.getDataBytes(), params.getCurve());
+
+
             } catch (Exception e) {
                 throw new RuntimeException("Could not parse key values", e);
             }