{"action":"created","issue":{"url":"https://api.github.com/repos/google/tink/issues/124","repository_url":"https://api.github.com/repos/google/tink","labels_url":"https://api.github.com/repos/google/tink/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/google/tink/issues/124/comments","events_url":"https://api.github.com/repos/google/tink/issues/124/events","html_url":"https://github.com/google/tink/issues/124","id":358051166,"node_id":"MDU6SXNzdWUzNTgwNTExNjY=","number":124,"title":"How to export public key?","user":{"login":"evalsinca","id":23558135,"node_id":"MDQ6VXNlcjIzNTU4MTM1","avatar_url":"https://avatars2.githubusercontent.com/u/23558135?v=4","gravatar_id":"","url":"https://api.github.com/users/evalsinca","html_url":"https://github.com/evalsinca","followers_url":"https://api.github.com/users/evalsinca/followers","following_url":"https://api.github.com/users/evalsinca/following{/other_user}","gists_url":"https://api.github.com/users/evalsinca/gists{/gist_id}","starred_url":"https://api.github.com/users/evalsinca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evalsinca/subscriptions","organizations_url":"https://api.github.com/users/evalsinca/orgs","repos_url":"https://api.github.com/users/evalsinca/repos","events_url":"https://api.github.com/users/evalsinca/events{/privacy}","received_events_url":"https://api.github.com/users/evalsinca/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-07T12:40:39Z","updated_at":"2018-09-07T17:36:09Z","closed_at":null,"author_association":"NONE","body":"I have read the documentation and code as best as I can but am still struggling with some basics that seem rather easy with other crypto libraries (Bouncy Castle, default Java, etc.).   For example, imagine that an iOS/Android app generates a key pair using Tink.  \r\n\r\n```\r\nKeysetHandle ksh = KeysetHandle.generateNew(\r\n\t\t\t        HybridKeyTemplates.ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM);\r\n```\r\n\r\nHow then to send the public key generated to the server where it may be used to encrypt data intended for the user?   There seems no obvious way looking at the code.  The only kludgy work-around I have come up with is as follows:\r\n\r\n`String str = writeKeyToString(ksh.getPublicKeysetHandle());`\r\n\r\nwhere the writeKeyString() method uses CleartextKeysetHandle's write method to write the public key as a Json set of bytes using the JsonKeysetWriter which we then send to server after Base64 encoding the bytes.\r\n\r\nI am sure I am missing something - that an easier and cleaner method lurks.   Hoping someone can clear this up...\r\n\r\nThanks!\r\n"},"comment":{"url":"https://api.github.com/repos/google/tink/issues/comments/419512639","html_url":"https://github.com/google/tink/issues/124#issuecomment-419512639","issue_url":"https://api.github.com/repos/google/tink/issues/124","id":419512639,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTUxMjYzOQ==","user":{"login":"thaidn","id":7532,"node_id":"MDQ6VXNlcjc1MzI=","avatar_url":"https://avatars1.githubusercontent.com/u/7532?v=4","gravatar_id":"","url":"https://api.github.com/users/thaidn","html_url":"https://github.com/thaidn","followers_url":"https://api.github.com/users/thaidn/followers","following_url":"https://api.github.com/users/thaidn/following{/other_user}","gists_url":"https://api.github.com/users/thaidn/gists{/gist_id}","starred_url":"https://api.github.com/users/thaidn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaidn/subscriptions","organizations_url":"https://api.github.com/users/thaidn/orgs","repos_url":"https://api.github.com/users/thaidn/repos","events_url":"https://api.github.com/users/thaidn/events{/privacy}","received_events_url":"https://api.github.com/users/thaidn/received_events","type":"User","site_admin":false},"created_at":"2018-09-07T17:36:09Z","updated_at":"2018-09-07T17:36:09Z","author_association":"COLLABORATOR","body":"No, you didn't come across as complaining :).\r\n\r\nWhat you're doing is correct. Since Tinkey [1] is the key management tool, I recommend reviewing its source code if you're not sure if you're using the key management APIs correctly. Of course you can always file a bug or drop us a line at tink-users@googlegroups.com.\r\n\r\nWe're glad that you found the library useful!\r\n\r\n[1] https://github.com/google/tink/tree/master/tools/tinkey/src/main/java/com/google/crypto/tink/tinkey"}}
{"actor":{"display_login":"thaidn"}}