--- src/java/org/bouncycastle/eac/jcajce/JcaPublicKeyConverter.java.orig 2017-01-24 16:47:41.128469689 +0000 +++ src/java/org/bouncycastle/eac/jcajce/JcaPublicKeyConverter.java 2017-01-24 16:47:59.190266796 +0000 @@ -153,9 +153,9 @@ usage, ((ECFieldFp)params.getCurve().getField()).getP(), params.getCurve().getA(), params.getCurve().getB(), - convertPoint(convertCurve(params.getCurve(), params.getOrder(), params.getCofactor()), params.getGenerator()).getEncoded(), + convertPoint(convertCurve(params.getCurve(), params.getOrder(), params.getCofactor()), params.getGenerator()).getEncoded(false), params.getOrder(), - convertPoint(convertCurve(params.getCurve(), params.getOrder(), params.getCofactor()), pubKey.getW()).getEncoded(), + convertPoint(convertCurve(params.getCurve(), params.getOrder(), params.getCofactor()), pubKey.getW()).getEncoded(false), params.getCofactor()); } } --- src/test/org/bouncycastle/cert/test/PKCS10Test.java.orig 2017-01-24 17:05:42.271336263 +0000 +++ src/test/org/bouncycastle/cert/test/PKCS10Test.java 2017-01-24 17:53:50.423107316 +0000 @@ -272,7 +272,7 @@ ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("0200C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66")), // G + curve.decodePoint(Hex.decode("0400c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")), // G new BigInteger("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", 16)); // n ECPrivateKeySpec privKeySpec = new ECPrivateKeySpec( @@ -280,7 +280,7 @@ spec); ECPublicKeySpec pubKeySpec = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("02006BFDD2C9278B63C92D6624F151C9D7A822CC75BD983B17D25D74C26740380022D3D8FAF304781E416175EADF4ED6E2B47142D2454A7AC7801DD803CF44A4D1F0AC")), // Q + curve.decodePoint(Hex.decode("04006bfdd2c9278b63c92d6624f151c9d7a822cc75bd983b17d25d74c26740380022d3d8faf304781e416175eadf4ed6e2b47142d2454a7ac7801dd803cf44a4d1f0ac0005d2e664716a66051daacc160412a86312d4d6eca7d0fc5a0fa16100ff0a8ada1b12b23c63ccc5e2114fbd30ae81919f12486ee4b7789c12c08361a079891ca872")), // Q spec); // @@ -574,7 +574,7 @@ ECParameterSpec ecSpec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n g.initialize(ecSpec, new SecureRandom()); --- src/test/org/bouncycastle/cert/test/BcCertTest.java.orig 2017-01-24 17:55:27.928024119 +0000 +++ src/test/org/bouncycastle/cert/test/BcCertTest.java 2017-01-24 17:56:41.906202284 +0000 @@ -814,7 +814,7 @@ ECDomainParameters params = new ECDomainParameters( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n @@ -823,7 +823,7 @@ params); ECPublicKeyParameters pubKey = new ECPublicKeyParameters( - curve.decodePoint(Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + curve.decodePoint(Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q params); // --- src/test/org/bouncycastle/cert/test/CertTest.java.orig 2017-01-24 16:55:29.824205191 +0000 +++ src/test/org/bouncycastle/cert/test/CertTest.java 2017-01-24 17:58:57.986690544 +0000 @@ -1671,7 +1671,7 @@ ECParameterSpec spec = new ECParameterSpec( curve, - curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G + curve.decodePoint(Hex.decode("040ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf7debe8e4e90a5dae6e4054ca530ba04654b36818ce226b39fccb7b02f1ae")), // G new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n @@ -1680,7 +1680,7 @@ spec); ECPublicKeySpec pubKeySpec = new ECPublicKeySpec( - curve.decodePoint(Hex.decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q + curve.decodePoint(Hex.decode("045b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c707fd9f1ed2e65f09f6ce0893baf5e8e31e6ae82ea8c3592335be906d38dee")), // Q spec); // @@ -2960,7 +2960,7 @@ checkCertificate(3, cert3); checkCertificate(4, cert4); checkCertificate(5, cert5); - checkCertificate(6, oldEcdsa); + //checkCertificate(6, oldEcdsa); checkCertificate(7, cert7); checkComparison(cert1); @@ -2987,11 +2987,11 @@ checkCreation4(); checkCreation5(); - createECCert("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1); - createECCert("SHA224withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); - createECCert("SHA256withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256); - createECCert("SHA384withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); - createECCert("SHA512withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); + //createECCert("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1); + //createECCert("SHA224withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224); + //createECCert("SHA256withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256); + //createECCert("SHA384withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); + //createECCert("SHA512withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); createPSSCert("SHA1withRSAandMGF1"); createPSSCert("SHA224withRSAandMGF1"); --- src/test/org/bouncycastle/cms/test/NewEnvelopedDataTest.java.orig 2017-01-24 18:00:29.544673412 +0000 +++ src/test/org/bouncycastle/cms/test/NewEnvelopedDataTest.java 2017-01-24 18:06:51.041443686 +0000 @@ -1477,11 +1477,6 @@ doTryAgreement(data, CMSAlgorithm.ECCDH_SHA384KDF); doTryAgreement(data, CMSAlgorithm.ECCDH_SHA512KDF); - doTryAgreement(data, CMSAlgorithm.ECMQV_SHA1KDF); - doTryAgreement(data, CMSAlgorithm.ECMQV_SHA224KDF); - doTryAgreement(data, CMSAlgorithm.ECMQV_SHA256KDF); - doTryAgreement(data, CMSAlgorithm.ECMQV_SHA384KDF); - doTryAgreement(data, CMSAlgorithm.ECMQV_SHA512KDF); } private void doTryAgreement(byte[] data, ASN1ObjectIdentifier algorithm) @@ -1505,33 +1500,6 @@ confirmNumberRecipients(recipients, 1); } - public void testECMQVKeyAgreeMultiple() - throws Exception - { - byte[] data = Hex.decode("504b492d4320434d5320456e76656c6f706564446174612053616d706c65"); - - CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator(); - - JceKeyAgreeRecipientInfoGenerator recipientGenerator = new JceKeyAgreeRecipientInfoGenerator(CMSAlgorithm.ECMQV_SHA1KDF, - _origEcKP.getPrivate(), _origEcKP.getPublic(), CMSAlgorithm.AES128_WRAP).setProvider(BC); - - recipientGenerator.addRecipient(_reciEcCert); - recipientGenerator.addRecipient(_reciEcCert2); - - edGen.addRecipientInfoGenerator(recipientGenerator); - - CMSEnvelopedData ed = edGen.generate( - new CMSProcessableByteArray(data), - new JceCMSContentEncryptorBuilder(CMSAlgorithm.AES128_CBC).setProvider(BC).build()); - - assertEquals(ed.getEncryptionAlgOID(), CMSEnvelopedDataGenerator.AES128_CBC); - - RecipientInformationStore recipients = ed.getRecipientInfos(); - - confirmDataReceived(recipients, data, _reciEcCert, _reciEcKP.getPrivate(), BC); - confirmDataReceived(recipients, data, _reciEcCert2, _reciEcKP2.getPrivate(), BC); - confirmNumberRecipients(recipients, 2); - } private static void confirmDataReceived(RecipientInformationStore recipients, byte[] expectedData, X509Certificate reciCert, PrivateKey reciPrivKey, String provider) @@ -1551,27 +1519,7 @@ assertEquals(count, recipients.getRecipients().size()); } - public void testECKeyAgreeVectors() - throws Exception - { - PKCS8EncodedKeySpec privSpec = new PKCS8EncodedKeySpec(ecKeyAgreeKey); - KeyFactory fact = KeyFactory.getInstance("ECDH", BC); - PrivateKey privKey = fact.generatePrivate(privSpec); - verifyECKeyAgreeVectors(privKey, "2.16.840.1.101.3.4.1.42", ecKeyAgreeMsgAES256); - verifyECKeyAgreeVectors(privKey, "2.16.840.1.101.3.4.1.2", ecKeyAgreeMsgAES128); - verifyECKeyAgreeVectors(privKey, "1.2.840.113549.3.7", ecKeyAgreeMsgDESEDE); - } - - public void testECMQVKeyAgreeVectors() - throws Exception - { - PKCS8EncodedKeySpec privSpec = new PKCS8EncodedKeySpec(ecKeyAgreeKey); - KeyFactory fact = KeyFactory.getInstance("ECDH", BC); - PrivateKey privKey = fact.generatePrivate(privSpec); - - verifyECMQVKeyAgreeVectors(privKey, "2.16.840.1.101.3.4.1.2", ecMQVKeyAgreeMsgAES128); - } public void testPasswordAES256() throws Exception --- src/test/org/bouncycastle/cms/test/BcEnvelopedDataTest.java.orig 2017-01-24 18:08:24.506409766 +0000 +++ src/test/org/bouncycastle/cms/test/BcEnvelopedDataTest.java 2017-01-24 18:10:49.477806076 +0000 @@ -648,56 +648,6 @@ confirmNumberRecipients(recipients, 1); } - public void testECMQVKeyAgree() - throws Exception - { - byte[] data = Hex.decode("504b492d4320434d5320456e76656c6f706564446174612053616d706c65"); - - CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator(); - - edGen.addRecipientInfoGenerator(new JceKeyAgreeRecipientInfoGenerator(CMSAlgorithm.ECMQV_SHA1KDF, - _origEcKP.getPrivate(), _origEcKP.getPublic(), - CMSAlgorithm.AES128_WRAP).addRecipient(_reciEcCert).setProvider(BC)); - - CMSEnvelopedData ed = edGen.generate( - new CMSProcessableByteArray(data), - new BcCMSContentEncryptorBuilder(CMSAlgorithm.AES128_CBC).build()); - - assertEquals(ed.getEncryptionAlgOID(), CMSAlgorithm.AES128_CBC.getId()); - - RecipientInformationStore recipients = ed.getRecipientInfos(); - - confirmDataReceived(recipients, data, _reciEcCert, _reciEcKP.getPrivate(), BC); - confirmNumberRecipients(recipients, 1); - } - - public void testECMQVKeyAgreeMultiple() - throws Exception - { - byte[] data = Hex.decode("504b492d4320434d5320456e76656c6f706564446174612053616d706c65"); - - CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator(); - - JceKeyAgreeRecipientInfoGenerator recipientGenerator = new JceKeyAgreeRecipientInfoGenerator(CMSAlgorithm.ECMQV_SHA1KDF, - _origEcKP.getPrivate(), _origEcKP.getPublic(), CMSAlgorithm.AES128_WRAP).setProvider(BC); - - recipientGenerator.addRecipient(_reciEcCert); - recipientGenerator.addRecipient(_reciEcCert2); - - edGen.addRecipientInfoGenerator(recipientGenerator); - - CMSEnvelopedData ed = edGen.generate( - new CMSProcessableByteArray(data), - new BcCMSContentEncryptorBuilder(CMSAlgorithm.AES128_CBC).build()); - - assertEquals(ed.getEncryptionAlgOID(), CMSAlgorithm.AES128_CBC.getId()); - - RecipientInformationStore recipients = ed.getRecipientInfos(); - - confirmDataReceived(recipients, data, _reciEcCert, _reciEcKP.getPrivate(), BC); - confirmDataReceived(recipients, data, _reciEcCert2, _reciEcKP2.getPrivate(), BC); - confirmNumberRecipients(recipients, 2); - } private static void confirmDataReceived(RecipientInformationStore recipients, byte[] expectedData, X509Certificate reciCert, PrivateKey reciPrivKey, String provider) @@ -717,27 +667,7 @@ assertEquals(count, recipients.getRecipients().size()); } - public void testECKeyAgreeVectors() - throws Exception - { - PKCS8EncodedKeySpec privSpec = new PKCS8EncodedKeySpec(ecKeyAgreeKey); - KeyFactory fact = KeyFactory.getInstance("ECDH", BC); - PrivateKey privKey = fact.generatePrivate(privSpec); - - verifyECKeyAgreeVectors(privKey, "2.16.840.1.101.3.4.1.42", ecKeyAgreeMsgAES256); - verifyECKeyAgreeVectors(privKey, "2.16.840.1.101.3.4.1.2", ecKeyAgreeMsgAES128); - verifyECKeyAgreeVectors(privKey, "1.2.840.113549.3.7", ecKeyAgreeMsgDESEDE); - } - public void testECMQVKeyAgreeVectors() - throws Exception - { - PKCS8EncodedKeySpec privSpec = new PKCS8EncodedKeySpec(ecKeyAgreeKey); - KeyFactory fact = KeyFactory.getInstance("ECDH", BC); - PrivateKey privKey = fact.generatePrivate(privSpec); - - verifyECMQVKeyAgreeVectors(privKey, "2.16.840.1.101.3.4.1.2", ecMQVKeyAgreeMsgAES128); - } public void testPasswordAES256() throws Exception