{"action":"created","issue":{"url":"https://api.github.com/repos/digitalbazaar/forge/issues/256","labels_url":"https://api.github.com/repos/digitalbazaar/forge/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/digitalbazaar/forge/issues/256/comments","events_url":"https://api.github.com/repos/digitalbazaar/forge/issues/256/events","html_url":"https://github.com/digitalbazaar/forge/issues/256","id":76694633,"number":256,"title":"How import forge public key to web crypto?","user":{"login":"BaurzhanSakhariev","id":7446940,"avatar_url":"https://avatars.githubusercontent.com/u/7446940?v=3","gravatar_id":"","url":"https://api.github.com/users/BaurzhanSakhariev","html_url":"https://github.com/BaurzhanSakhariev","followers_url":"https://api.github.com/users/BaurzhanSakhariev/followers","following_url":"https://api.github.com/users/BaurzhanSakhariev/following{/other_user}","gists_url":"https://api.github.com/users/BaurzhanSakhariev/gists{/gist_id}","starred_url":"https://api.github.com/users/BaurzhanSakhariev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaurzhanSakhariev/subscriptions","organizations_url":"https://api.github.com/users/BaurzhanSakhariev/orgs","repos_url":"https://api.github.com/users/BaurzhanSakhariev/repos","events_url":"https://api.github.com/users/BaurzhanSakhariev/events{/privacy}","received_events_url":"https://api.github.com/users/BaurzhanSakhariev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-15T11:12:14Z","updated_at":"2015-05-18T20:28:47Z","closed_at":"2015-05-18T20:28:47Z","body":"I'm sorry for asking almost similar question to the previous one but I couldn't resolve it by myself. \r\n\r\nHow import forge public key to web crypto? pkcs#8 relevant only for private key, for public keys I may specify \"raw\" or \"spki\". I tried stripped and not stripped PEM with importKey(\"raw\"...), no success.  I also tried \"raw\" and ArrayBuffer(pubKeytoAsn->toDer.getBytes), \"spki\" and and ArrayBuffer(pubKeytoAsn->toDer.getBytes) and again failed. \r\n\r\nIt seems I have to manually construct  JSON parameter in the example below.\r\n\r\n    window.crypto.subtle.importKey(\r\n    \"jwk\", //can be \"jwk\" (public or private), \"spki\" (public only), or \"pkcs8\" (private only)\r\n    {   //this is an example jwk key, other key types are Uint8Array objects\r\n        kty: \"RSA\",\r\n        e: \"AQAB\",\r\n        n: \"vGO3eU16ag9zRkJ4AK8ZUZrjbtp5xWK0LyFMNT8933evJoHeczexMUzSiXaLrEFSyQZortk81zJH3y41MBO_UFDO_X0crAquNrkjZDrf9Scc5-MdxlWU2Jl7Gc4Z18AC9aNibWVmXhgvHYkEoFdLCFG-2Sq-qIyW4KFkjan05IE\",\r\n        alg: \"RS256\",\r\n        ext: true,\r\n    },\r\n\r\nA saw `n` and `e` attributes in forge public key but I didn't understand is JSON 'n' value is base64 of forge key's n-array which has 74 elements?"},"comment":{"url":"https://api.github.com/repos/digitalbazaar/forge/issues/comments/103199966","html_url":"https://github.com/digitalbazaar/forge/issues/256#issuecomment-103199966","issue_url":"https://api.github.com/repos/digitalbazaar/forge/issues/256","id":103199966,"user":{"login":"BaurzhanSakhariev","id":7446940,"avatar_url":"https://avatars.githubusercontent.com/u/7446940?v=3","gravatar_id":"","url":"https://api.github.com/users/BaurzhanSakhariev","html_url":"https://github.com/BaurzhanSakhariev","followers_url":"https://api.github.com/users/BaurzhanSakhariev/followers","following_url":"https://api.github.com/users/BaurzhanSakhariev/following{/other_user}","gists_url":"https://api.github.com/users/BaurzhanSakhariev/gists{/gist_id}","starred_url":"https://api.github.com/users/BaurzhanSakhariev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaurzhanSakhariev/subscriptions","organizations_url":"https://api.github.com/users/BaurzhanSakhariev/orgs","repos_url":"https://api.github.com/users/BaurzhanSakhariev/repos","events_url":"https://api.github.com/users/BaurzhanSakhariev/events{/privacy}","received_events_url":"https://api.github.com/users/BaurzhanSakhariev/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T20:28:47Z","updated_at":"2015-05-18T20:28:47Z","body":"Thank you! \r\n\r\nLooks like I was close to solution\r\n\r\n> \"spki\" and and ArrayBuffer(pubKeytoAsn->toDer.getBytes) and again failed\r\n\r\nBut probably I muddled up some variables during my expiriments) \r\n\r\nKnow signing and verifying works as expected. Thanks for collaboration!\r\n"}}