{"action":"opened","issue":{"url":"https://api.github.com/repos/bcgit/bc-csharp/issues/94","repository_url":"https://api.github.com/repos/bcgit/bc-csharp","labels_url":"https://api.github.com/repos/bcgit/bc-csharp/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/bcgit/bc-csharp/issues/94/comments","events_url":"https://api.github.com/repos/bcgit/bc-csharp/issues/94/events","html_url":"https://github.com/bcgit/bc-csharp/issues/94","id":258447042,"number":94,"title":"Pkcs12Store with unmarked keys","user":{"login":"perlope","id":32061834,"avatar_url":"https://avatars0.githubusercontent.com/u/32061834?v=4","gravatar_id":"","url":"https://api.github.com/users/perlope","html_url":"https://github.com/perlope","followers_url":"https://api.github.com/users/perlope/followers","following_url":"https://api.github.com/users/perlope/following{/other_user}","gists_url":"https://api.github.com/users/perlope/gists{/gist_id}","starred_url":"https://api.github.com/users/perlope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perlope/subscriptions","organizations_url":"https://api.github.com/users/perlope/orgs","repos_url":"https://api.github.com/users/perlope/repos","events_url":"https://api.github.com/users/perlope/events{/privacy}","received_events_url":"https://api.github.com/users/perlope/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-18T11:27:05Z","updated_at":"2017-09-18T11:27:05Z","closed_at":null,"author_association":"NONE","body":"I am using BouncyCastle to import private Keys pkcs12 and decrypt data. I am using a code like this:\r\n```javascript\r\n            Pkcs12Store pkcs12Store = new Pkcs12Store(new MemoryStream(privateKey, false), password.ToCharArray());\r\n\r\n            var cipher = CipherUtilities.GetCipher(\"RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING\");\r\n            var input = HexToByteArray(encriptedData);\r\n\r\n            ICipherParameters cipherParameters = pkcs12Store.GetKey(\"unmarked\").Key;//**\r\n\r\n            cipher.Init(false, cipherParameters);\r\n            var output = cipher.DoFinal(input, 0, input.Length);\r\n            var outputText = Encoding.ASCII.GetString(output);\r\n            return outputText\r\n```\r\n\r\nI've checked that the alias is \"unmarked\" using Version 1.7X when I import my private keys. But in version 1.8.1, with the same data input, there is not alias because Pkcs12Store.keys is empty (at line **).\r\nI temporarily fix it, with this code at the end of method Load in class Pkcs12Store:\r\n\r\n```javascript\r\n     if (keys.Keys.Count == 0 && unmarkedKeyEntry != null)\r\n     {\r\n                keys[\"unmarked\"] = unmarkedKeyEntry;\r\n     }\r\n```\r\n\r\nPlease, could you check this case?\r\n"}}
{"actor":{"display_login":"perlope"}}