{"action":"closed","issue":{"url":"https://api.github.com/repos/indutny/elliptic/issues/97","repository_url":"https://api.github.com/repos/indutny/elliptic","labels_url":"https://api.github.com/repos/indutny/elliptic/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/indutny/elliptic/issues/97/comments","events_url":"https://api.github.com/repos/indutny/elliptic/issues/97/events","html_url":"https://github.com/indutny/elliptic/issues/97","id":161094474,"number":97,"title":"p192 (elliptic, node.js) versus prime192v1 (BouncyCastle, Java)","user":{"login":"dwimberger","id":164108,"avatar_url":"https://avatars.githubusercontent.com/u/164108?v=3","gravatar_id":"","url":"https://api.github.com/users/dwimberger","html_url":"https://github.com/dwimberger","followers_url":"https://api.github.com/users/dwimberger/followers","following_url":"https://api.github.com/users/dwimberger/following{/other_user}","gists_url":"https://api.github.com/users/dwimberger/gists{/gist_id}","starred_url":"https://api.github.com/users/dwimberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwimberger/subscriptions","organizations_url":"https://api.github.com/users/dwimberger/orgs","repos_url":"https://api.github.com/users/dwimberger/repos","events_url":"https://api.github.com/users/dwimberger/events{/privacy}","received_events_url":"https://api.github.com/users/dwimberger/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-19T22:00:07Z","updated_at":"2016-06-19T22:04:48Z","closed_at":"2016-06-19T22:04:48Z","body":"Is there a difference between p192 and prime192v1? Respectively, is there a way to match the node.js version to the prime192v1 changing parameters?\r\n\r\nNote: to match the hashing , I have changed the Hash Algorithm to sha1 in curves.js\r\n\r\n    hash: hash.sha1,\r\n\r\nDoing the verification in node.js:\r\n\r\n    Buffer.prototype.toByteArray = function () { \r\n      return Array.prototype.slice.call(this, 0); \r\n    }\r\n    var data = new Buffer('464756473244334D5836304A4754504D53304D51', 'hex').toByteArray();\r\n\r\n    var hexCardPublic = '0499A84E4ADC581DB12CDD2D04EC8944BF88DFA24C4709ABBE1A3E1668C4F6BDA3CE6DFD0050F3085A2332D21FF53DDB21';\r\n    var publicKey = new Buffer(hexCardPublic, 'hex').toByteArray();\r\n\r\n    var signature = '3036021900C031D6ED904442C600430B1500EB9D8C55110FE10763A84002190089668A4EEC9640D1A897D0BDAA2B3976CDA6769AA74B8ABA';\r\n    var signedData = new Buffer(signature, 'hex').toByteArray();\r\n   \r\n    var ec = new EC('p192');\r\n    var pubKey = ec.keyFromPublic(publicKey);\r\n    console.log(pubKey.verify(data, signedData));\r\n\r\nWill result in \r\n\r\n     false\r\n\r\n\r\nWhile doing the same with BouncyCastle (Java counterpart)\r\n\r\n    byte[] publicKey = Hex.decode(\r\n                    \"0499A84E4ADC581DB12CDD2D04EC8944BF88DFA24C4709ABBE1A3E1668C4F6BDA3CE6DFD0050F3085A2332D21FF53DDB21\"\r\n            );\r\n    byte[] signedData = Hex.decode(\r\n                    \"3036021900C031D6ED904442C600430B1500EB9D8C55110FE10763A84002190089668A4EEC9640D1A897D0BDAA2B3976CDA6769AA74B8ABA\"\r\n            );\r\n    byte[] data = Hex.decode(\r\n                    \"464756473244334D5836304A4754504D53304D51\"\r\n            );\r\n\r\n            ECParameterSpec params = ECNamedCurveTable.getParameterSpec(\"prime192v1\");\r\n\r\n            KeyFactory keyFactory = KeyFactory.getInstance(\"EC\", \"BC\");\r\n            ECPublicKeySpec pubKeySpec = new ECPublicKeySpec(\r\n                    params.getCurve().decodePoint(publicKey),\r\n                    params\r\n            );\r\n            PublicKey pubKey = keyFactory.generatePublic(pubKeySpec);\r\n            Signature signature = Signature.getInstance(\"ECDSA\", \"BC\");\r\n            signature.initVerify(pubKey);\r\n            signature.update(data);\r\n            System.out.println(signature.verify(signedData));\r\n\r\nWill return \r\n\r\n    true\r\n\r\n"}}
{"actor":{"display_login":"indutny"}}