提交 f9bab57c 编写于 作者: V vinnie

7016078: javax.net.ssl.SSLException: Received fatal alert: internal_error starting JDK 7 b126

Reviewed-by: valeriep
上级 fe86fffa
...@@ -999,18 +999,34 @@ abstract class P11Key implements Key { ...@@ -999,18 +999,34 @@ abstract class P11Key implements Key {
new CK_ATTRIBUTE(CKA_EC_PARAMS), new CK_ATTRIBUTE(CKA_EC_PARAMS),
}; };
fetchAttributes(attributes); fetchAttributes(attributes);
try { try {
params = P11ECKeyFactory.decodeParameters params = P11ECKeyFactory.decodeParameters
(attributes[1].getByteArray()); (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
(wECPoint.getDataBytes(), params.getCurve());
/*
* An uncompressed EC point may be in either of two formats.
* First try the OCTET STRING encoding:
* 04 <length> 04 <X-coordinate> <Y-coordinate>
*
* Otherwise try the raw encoding:
* 04 <X-coordinate> <Y-coordinate>
*/
byte[] ecKey = attributes[0].getByteArray();
try {
DerValue wECPoint = new DerValue(ecKey);
if (wECPoint.getTag() != DerValue.tag_OctetString)
throw new IOException("Unexpected tag: " +
wECPoint.getTag());
w = P11ECKeyFactory.decodePoint
(wECPoint.getDataBytes(), params.getCurve());
} catch (IOException e) {
// Failover
w = P11ECKeyFactory.decodePoint(ecKey, params.getCurve());
}
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Could not parse key values", e); throw new RuntimeException("Could not parse key values", e);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册