{"action":"created","issue":{"url":"https://api.github.com/repos/kjur/jsrsasign/issues/92","labels_url":"https://api.github.com/repos/kjur/jsrsasign/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/kjur/jsrsasign/issues/92/comments","events_url":"https://api.github.com/repos/kjur/jsrsasign/issues/92/events","html_url":"https://github.com/kjur/jsrsasign/issues/92","id":77522949,"number":92,"title":"Question/request for example: PKCS1 to PKCS12","user":{"login":"anuchandy","id":1471612,"avatar_url":"https://avatars.githubusercontent.com/u/1471612?v=3","gravatar_id":"","url":"https://api.github.com/users/anuchandy","html_url":"https://github.com/anuchandy","followers_url":"https://api.github.com/users/anuchandy/followers","following_url":"https://api.github.com/users/anuchandy/following{/other_user}","gists_url":"https://api.github.com/users/anuchandy/gists{/gist_id}","starred_url":"https://api.github.com/users/anuchandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anuchandy/subscriptions","organizations_url":"https://api.github.com/users/anuchandy/orgs","repos_url":"https://api.github.com/users/anuchandy/repos","events_url":"https://api.github.com/users/anuchandy/events{/privacy}","received_events_url":"https://api.github.com/users/anuchandy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-18T06:27:20Z","updated_at":"2015-05-19T15:15:53Z","closed_at":"2015-05-19T15:15:53Z","body":"I have SSHPublicKey in the format \"ssh-rsa {body} {info}\" (I don't have access to private key) from which I want to generate PKCS#12\r\n\r\nAs a first step tried generating the PKCS#1 from the SSHPublicKey. I have asked the question here https://github.com/kjur/jsrsasign/issues/91, based on your guideline I understood that to generate PKCS#1 we need exponent and modulus. After some investigation found this project https://github.com/dominictarr/ssh-key-to-pem and used it to generate PEM (PKCS#1) from the SSHPublicKey.\r\n\r\n```bash\r\nvar fs = require('fs');\r\nvar sshKeyToPEM = require('ssh-key-to-pem');\r\n// the file 'id_rsa.pub' contains ssh public key in the format \"ssh-rsa {body} {info}\" \r\nvar sshPublicKey = fs.readFileSync('./id_rsa.pub', 'ascii')\r\nvar pkcs1 = sshKeyToPEM(sshPublicKey);\r\n// I got pkcs1 in the format\r\n// -----BEGIN PUBLIC KEY-----\r\n// key\r\n//-----END PUBLIC KEY-----\r\n```\r\n\r\nNow we want to generate PKCS12 from the pkcs1.\r\n\r\nAfter going through jsrsasign examples/doc I feel like this is possible using 'TBSCertificate', but I don't have access to the private key, we cannot create a signature for the TBS. However, a valid certificate requires a bit string for the signature value.\r\n\r\nCan you please provide some inputs ?"},"comment":{"url":"https://api.github.com/repos/kjur/jsrsasign/issues/comments/103544165","html_url":"https://github.com/kjur/jsrsasign/issues/92#issuecomment-103544165","issue_url":"https://api.github.com/repos/kjur/jsrsasign/issues/92","id":103544165,"user":{"login":"kjur","id":1206524,"avatar_url":"https://avatars.githubusercontent.com/u/1206524?v=3","gravatar_id":"","url":"https://api.github.com/users/kjur","html_url":"https://github.com/kjur","followers_url":"https://api.github.com/users/kjur/followers","following_url":"https://api.github.com/users/kjur/following{/other_user}","gists_url":"https://api.github.com/users/kjur/gists{/gist_id}","starred_url":"https://api.github.com/users/kjur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjur/subscriptions","organizations_url":"https://api.github.com/users/kjur/orgs","repos_url":"https://api.github.com/users/kjur/repos","events_url":"https://api.github.com/users/kjur/events{/privacy}","received_events_url":"https://api.github.com/users/kjur/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T15:15:53Z","updated_at":"2015-05-19T15:15:53Z","body":"prvKey = KEYUTIL.getKey(PKCS1PRVKEY, 'password');\r\n\r\nTo issue certificate, following sample may helps:\r\nhttps://github.com/kjur/jsrsasign/blob/master/tool_ca.html\r\n\r\nThere is no functionality for generate and reading PKCS#12 at this stage.\r\n\r\nTo generate PKCS#12 CMS structure following codes may helps:\r\nhttps://github.com/kjur/jsrsasign/blob/master/asn1cms-1.0.js\r\n\r\nRegards,\r\n"}}