8026976: ECParameters, Point does not match field size

Reviewed-by: xuelei
This commit is contained in:
Anthony Scarpino 2020-12-03 18:05:53 +00:00
parent d3f3c32282
commit 55f5542ca2
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -294,7 +294,13 @@ final class P11ECKeyFactory extends P11KeyFactory {
try { try {
token.p11.C_GetAttributeValue(session[0].id(), keyID, attributes); token.p11.C_GetAttributeValue(session[0].id(), keyID, attributes);
ECParameterSpec params = decodeParameters(attributes[1].getByteArray()); ECParameterSpec params = decodeParameters(attributes[1].getByteArray());
ECPoint point = decodePoint(attributes[0].getByteArray(), params.getCurve()); ECPoint point;
if (!token.config.getUseEcX963Encoding()) {
point = decodePoint(new DerValue(attributes[0].getByteArray()).getOctetString(), params.getCurve());
} else {
point = decodePoint(attributes[0].getByteArray(), params.getCurve());
}
return keySpec.cast(new ECPublicKeySpec(point, params)); return keySpec.cast(new ECPublicKeySpec(point, params));
} catch (IOException e) { } catch (IOException e) {
throw new InvalidKeySpecException("Could not parse key", e); throw new InvalidKeySpecException("Could not parse key", e);

View File

@ -661,7 +661,6 @@ com/sun/nio/sctp/SctpChannel/SocketOptionTests.java 8141694 linux-al
# jdk_security # jdk_security
sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-all
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all
sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all