{"action":"opened","issue":{"url":"https://api.github.com/repos/weidai11/cryptopp/issues/744","repository_url":"https://api.github.com/repos/weidai11/cryptopp","labels_url":"https://api.github.com/repos/weidai11/cryptopp/issues/744/labels{/name}","comments_url":"https://api.github.com/repos/weidai11/cryptopp/issues/744/comments","events_url":"https://api.github.com/repos/weidai11/cryptopp/issues/744/events","html_url":"https://github.com/weidai11/cryptopp/issues/744","id":383085758,"node_id":"MDU6SXNzdWUzODMwODU3NTg=","number":744,"title":"Importing openssl-made secp256k1 private key fails","user":{"login":"Ralayax","id":3892807,"node_id":"MDQ6VXNlcjM4OTI4MDc=","avatar_url":"https://avatars3.githubusercontent.com/u/3892807?v=4","gravatar_id":"","url":"https://api.github.com/users/Ralayax","html_url":"https://github.com/Ralayax","followers_url":"https://api.github.com/users/Ralayax/followers","following_url":"https://api.github.com/users/Ralayax/following{/other_user}","gists_url":"https://api.github.com/users/Ralayax/gists{/gist_id}","starred_url":"https://api.github.com/users/Ralayax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ralayax/subscriptions","organizations_url":"https://api.github.com/users/Ralayax/orgs","repos_url":"https://api.github.com/users/Ralayax/repos","events_url":"https://api.github.com/users/Ralayax/events{/privacy}","received_events_url":"https://api.github.com/users/Ralayax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-21T11:58:46Z","updated_at":"2018-11-21T11:58:46Z","closed_at":null,"author_association":"NONE","body":"Hello everyone,\r\n\r\nI'm trying to import a DER formated secp256k1 private key into my program.\r\nThe key was generated according to the [wiki](https://www.cryptopp.com/wiki/Keys_and_formats).\r\n\r\n`openssl ecparam -name secp256k1 -genkey -param_enc explicit -outform DER -out key.txt`\r\n\r\nWhich generated [this file](https://github.com/weidai11/cryptopp/files/2604096/key.txt).\r\n\r\nHowever the following program fails to load the key.\r\n\r\n```c++\r\n#include <cryptopp/osrng.h>\r\n#include <cryptopp/eccrypto.h>\r\n#include <cryptopp/asn.h>\r\n#include <cryptopp/oids.h>\r\n#include <cryptopp/files.h>\r\n\r\nint main() {\r\n  CryptoPP::ECIES<CryptoPP::ECP>::PrivateKey key;\r\n  CryptoPP::FileSource source(\"key.txt\", true);\r\n  key.Load(source);\r\n}\r\n```\r\n\r\n> terminate called after throwing an instance of 'CryptoPP::BERDecodeErr'\r\n>   what():  BER decode error\r\n> Abandon (core dumped)\r\n\r\nMaybe I'm doing something wrong either in openssl or in my c++ code, but it might also be an issue in the Crypto++ library or in the wiki.\r\n\r\nECIES seems to be working perfectly, and importing keys generated by Crypto++ is working without any issues.\r\n\r\n**My configuration :**\r\n\r\nI use Ubuntu 18.10, with Crypto++ 7.0 compiled and installed from source with the given Makefile.\r\ng++ is version 8.2.0\r\n\r\nWhen cryptest.exe is run it reports :\r\n\r\n> All tests passed!"}}
{"actor":{"display_login":"Ralayax"}}