-
Bug
-
Resolution: Fixed
-
P3
-
9
-
None
-
b133
-
windows
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8183726 | 8u161 | Ivan Gerasimov | P3 | Resolved | Fixed | b01 |
JDK-8164063 | 8u152 | Ivan Gerasimov | P3 | Resolved | Fixed | b01 |
JDK-8192462 | emb-8u161 | Ivan Gerasimov | P3 | Resolved | Fixed | b01 |
JDK-8164420 | 7u131 | Ivan Gerasimov | P3 | Resolved | Fixed | b01 |
JDK-8164421 | 6u141 | Ivan Gerasimov | P3 | Resolved | Fixed | b02 |
Here's the reproducer:
-------------------
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
public class Main {
public static void main(String[] args) throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "SunMSCAPI");
KeyPair pair = generator.generateKeyPair();
Key publicKey = pair.getPublic();
pair = null;
for (int i = 0; i < 1024; ++i) {
System.gc();
}
publicKey.getEncoded(); // <<< throws KeyException: The parameter is incorrect
}
}
-------------------
This is because when a KeyPair is created both keys share the same native handles.
Thus, when one of them is destroyed (i.e. finalized), the handles become invalid.
-------------------
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
public class Main {
public static void main(String[] args) throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "SunMSCAPI");
KeyPair pair = generator.generateKeyPair();
Key publicKey = pair.getPublic();
pair = null;
for (int i = 0; i < 1024; ++i) {
System.gc();
}
publicKey.getEncoded(); // <<< throws KeyException: The parameter is incorrect
}
}
-------------------
This is because when a KeyPair is created both keys share the same native handles.
Thus, when one of them is destroyed (i.e. finalized), the handles become invalid.
- backported by
-
JDK-8164063 Finalizing one key of a KeyPair invalidates the other key
-
- Resolved
-
-
JDK-8164420 Finalizing one key of a KeyPair invalidates the other key
-
- Resolved
-
-
JDK-8164421 Finalizing one key of a KeyPair invalidates the other key
-
- Resolved
-
-
JDK-8183726 Finalizing one key of a KeyPair invalidates the other key
-
- Resolved
-
-
JDK-8192462 Finalizing one key of a KeyPair invalidates the other key
-
- Resolved
-
- relates to
-
JDK-8223003 SunMSCAPI keys are not cleaned up
-
- Closed
-
(1 relates to)