fixed checksum handling of NIST curves
@@ -77,11 +77,6 @@ public PGPSecretKey parseSecretKey(InputStream inputStream, PBEProtectionRemover
String curveID = SXprUtils.readString(inputStream, inputStream.read());
String curveName = SXprUtils.readString(inputStream, inputStream.read());
- if (curveName.startsWith("NIST "))
- {
- curveName = curveName.substring("NIST ".length());
- }
-
SXprUtils.skipCloseParenthesis(inputStream);
byte[] qVal;
@@ -102,6 +97,11 @@ public PGPSecretKey parseSecretKey(InputStream inputStream, PBEProtectionRemover
BigInteger d = processECSecretKey(inputStream, curveID, curveName, qVal, keyProtectionRemoverFactory);
+ if (curveName.startsWith("NIST "))
+ {
+ curveName = curveName.substring("NIST ".length());
+ }
+
ECPublicBCPGKey basePubKey = new ECDSAPublicBCPGKey(ECNamedCurveTable.getOID(curveName), new BigInteger(1, qVal));
ECPublicBCPGKey assocPubKey = (ECPublicBCPGKey)pubKey.getPublicKeyPacket().getKey();
if (!basePubKey.getCurveOID().equals(assocPubKey.getCurveOID())
