{"action":"created","comment":{"url":"https://api.github.com/repos/openssl/openssl/pulls/comments/187849530","pull_request_review_id":119709704,"id":187849530,"diff_hunk":"@@ -0,0 +1,182 @@\n+=pod\n+\n+=encoding utf8\n+\n+=head1 NAME\n+\n+password encoding\n+- How diverse parts of OpenSSL treat pass phrases character encoding\n+\n+=head1 DESCRIPTION\n+\n+In a modern world with all sorts of character encodings, the treatment of pass\n+phrases has become increasingly complex.\n+This manual page attempts to give an overview over how this problem is\n+currently addressed in different parts of the OpenSSL library.\n+\n+=head2 The general case\n+\n+The OpenSSL library doesn't treat pass phrases in any special way as a general\n+rule, and trusts the application or user to choose a suitable character set\n+and stick to that throughout the lifetime of affected objects.\n+This means that for an object that was encrypted using a pass phrase encoded in\n+ISO-8859-1, that object needs to be decrypted using a pass phrase encoded in\n+ISO-8859-1.\n+Using the wrong encoding is expected to cause a decryption failure.\n+\n+=head2 PKCS#12\n+\n+PKCS#12 is a bit different regarding pass phrase encoding.\n+The standard stipulates that the pass phrase shall be encoded as an ASN.1\n+BMPString, which consists of the code points of the basic multilingual plane,\n+encoded in big endian (UCS-2 BE).\n+\n+OpenSSL tries to adapt to this requirements in one of the following manners:\n+\n+=over 4\n+\n+=item 1.\n+\n+Treats the received pass phrase as UTF-8 encoded and tries to re-encode it to\n+UTF-16 (which is the same as UCS-2 for characters U+0000 to U+D7FF and U+E000\n+to U+FFFF, but becomes an expansion for any other character), or failing that,\n+proceeds with step 2.\n+\n+=item 2.\n+\n+Assumes that the pass phrase is encoded in ASCII or ISO-8859-1 and\n+opportunistically prepends each byte with a zero byte to obtain the UCS-2\n+encoding of the characters, which it stores as a BMPString.\n+\n+Note that since there is no check of your locale, this may produce UCS-2 /\n+UTF-16 characters that do not correspond to the original pass phrase characters\n+for other character sets, such as any ISO-8859-X encoding other than\n+ISO-8859-1.\n+\n+=back\n+\n+OpenSSL versions older than 1.1.0 do variant 2 only, and that is the reason why\n+OpenSSL still does this, to be able to read files produced with older versions.\n+\n+It should be noted that this approach isn't entirely fault free.\n+\n+A passphrase encoded in ISO-8859-2 could very well have a sequence such as\n+0xC3 0xAF (which is the two characters \"LATIN CAPITAL LETTER A WITH BREVE\"\n+and \"LATIN CAPITAL LETTER Z WITH DOT ABOVE\" in ISO-8859-2 encoding), but would\n+be misinterpreted as the perfectly valid UTF-8 encoded code point U+00EF (LATIN\n+SMALL LETTER I WITH DIARESIS) I<if the passphrase doesn't contain anything that\n+would be invalid UTF-8>.\n+A pass phrase that contains this kind of byte sequence will give a different\n+outcome in OpenSSL 1.1.0 and newer than in OpenSSL older than 1.1.0.\n+\n+ 0x00 0xC3 0x00 0xAF                    # OpenSSL older than 1.1.0\n+ 0x00 0xEF                              # OpenSSL 1.1.0 and newer\n+\n+On the same accord, anything encoded in UTF-8 that was given to OpenSSL older\n+than 1.1.0 was misinterpreted as ISO-8859-1 sequences.\n+\n+=head2 OSSL_STORE\n+\n+L<ossl_store(7)> acts as a general interface to access all kinds of objects,\n+potentially protected with a pass phrase, a PIN or something else.\n+This API currently doesn't stipulate any specific encoding of pass phrases, but\n+uses the underlying routines with their behaviours.\n+This means that when using the built-in C<file:> scheme loader, the pass phrase\n+to unlock a PKCS#12 file will be treated as described for PKCS#12 above, and\n+the pass phrase for a PEM files will be treated as the general case described\n+above, since that loader uses the same underlying routines.\n+I<Note that other loaders will have their own behaviours>.\n+\n+=head1 RECOMMENDATIONS\n+\n+This section assumes that you know what pass phrase you should type in is, but\n+that it may have been used in a different character encoding than your current\n+environment gives you by default.","path":"doc/man7/passphrase-encoding.pod","position":95,"original_position":94,"commit_id":"b4c73d4027ace17c90765c519a4383b6596c778e","original_commit_id":"f0b59fc583d5f783d2e14d81e04d74da5fac9923","user":{"login":"mspncp","id":11467854,"avatar_url":"https://avatars2.githubusercontent.com/u/11467854?v=4","gravatar_id":"","url":"https://api.github.com/users/mspncp","html_url":"https://github.com/mspncp","followers_url":"https://api.github.com/users/mspncp/followers","following_url":"https://api.github.com/users/mspncp/following{/other_user}","gists_url":"https://api.github.com/users/mspncp/gists{/gist_id}","starred_url":"https://api.github.com/users/mspncp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mspncp/subscriptions","organizations_url":"https://api.github.com/users/mspncp/orgs","repos_url":"https://api.github.com/users/mspncp/repos","events_url":"https://api.github.com/users/mspncp/events{/privacy}","received_events_url":"https://api.github.com/users/mspncp/received_events","type":"User","site_admin":false},"body":"Let’s say it that way: I don’t have a better alternative. ","created_at":"2018-05-14T06:49:43Z","updated_at":"2018-05-14T06:49:43Z","html_url":"https://github.com/openssl/openssl/pull/6179#discussion_r187849530","pull_request_url":"https://api.github.com/repos/openssl/openssl/pulls/6179","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/openssl/openssl/pulls/comments/187849530"},"html":{"href":"https://github.com/openssl/openssl/pull/6179#discussion_r187849530"},"pull_request":{"href":"https://api.github.com/repos/openssl/openssl/pulls/6179"}},"in_reply_to_id":187800712},"pull_request":{"url":"https://api.github.com/repos/openssl/openssl/pulls/6179","id":186114950,"html_url":"https://github.com/openssl/openssl/pull/6179","diff_url":"https://github.com/openssl/openssl/pull/6179.diff","patch_url":"https://github.com/openssl/openssl/pull/6179.patch","issue_url":"https://api.github.com/repos/openssl/openssl/issues/6179","number":6179,"state":"open","locked":false,"title":"WIP: Docs: add general document on how pass phrases are handled","user":{"login":"levitte","id":698918,"avatar_url":"https://avatars1.githubusercontent.com/u/698918?v=4","gravatar_id":"","url":"https://api.github.com/users/levitte","html_url":"https://github.com/levitte","followers_url":"https://api.github.com/users/levitte/followers","following_url":"https://api.github.com/users/levitte/following{/other_user}","gists_url":"https://api.github.com/users/levitte/gists{/gist_id}","starred_url":"https://api.github.com/users/levitte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levitte/subscriptions","organizations_url":"https://api.github.com/users/levitte/orgs","repos_url":"https://api.github.com/users/levitte/repos","events_url":"https://api.github.com/users/levitte/events{/privacy}","received_events_url":"https://api.github.com/users/levitte/received_events","type":"User","site_admin":false},"body":"Related to #3531","created_at":"2018-05-04T22:09:27Z","updated_at":"2018-05-14T06:49:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6e21c60a718579e11a29c9182e0d105a0c809e9","assignee":null,"assignees":[],"requested_reviewers":[{"login":"richsalz","id":7332500,"avatar_url":"https://avatars0.githubusercontent.com/u/7332500?v=4","gravatar_id":"","url":"https://api.github.com/users/richsalz","html_url":"https://github.com/richsalz","followers_url":"https://api.github.com/users/richsalz/followers","following_url":"https://api.github.com/users/richsalz/following{/other_user}","gists_url":"https://api.github.com/users/richsalz/gists{/gist_id}","starred_url":"https://api.github.com/users/richsalz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richsalz/subscriptions","organizations_url":"https://api.github.com/users/richsalz/orgs","repos_url":"https://api.github.com/users/richsalz/repos","events_url":"https://api.github.com/users/richsalz/events{/privacy}","received_events_url":"https://api.github.com/users/richsalz/received_events","type":"User","site_admin":false},{"login":"t-j-h","id":7409473,"avatar_url":"https://avatars2.githubusercontent.com/u/7409473?v=4","gravatar_id":"","url":"https://api.github.com/users/t-j-h","html_url":"https://github.com/t-j-h","followers_url":"https://api.github.com/users/t-j-h/followers","following_url":"https://api.github.com/users/t-j-h/following{/other_user}","gists_url":"https://api.github.com/users/t-j-h/gists{/gist_id}","starred_url":"https://api.github.com/users/t-j-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t-j-h/subscriptions","organizations_url":"https://api.github.com/users/t-j-h/orgs","repos_url":"https://api.github.com/users/t-j-h/repos","events_url":"https://api.github.com/users/t-j-h/events{/privacy}","received_events_url":"https://api.github.com/users/t-j-h/received_events","type":"User","site_admin":false},{"login":"mattcaswell","id":7422273,"avatar_url":"https://avatars0.githubusercontent.com/u/7422273?v=4","gravatar_id":"","url":"https://api.github.com/users/mattcaswell","html_url":"https://github.com/mattcaswell","followers_url":"https://api.github.com/users/mattcaswell/followers","following_url":"https://api.github.com/users/mattcaswell/following{/other_user}","gists_url":"https://api.github.com/users/mattcaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/mattcaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattcaswell/subscriptions","organizations_url":"https://api.github.com/users/mattcaswell/orgs","repos_url":"https://api.github.com/users/mattcaswell/repos","events_url":"https://api.github.com/users/mattcaswell/events{/privacy}","received_events_url":"https://api.github.com/users/mattcaswell/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":872237503,"url":"https://api.github.com/repos/openssl/openssl/labels/1.1.1","name":"1.1.1","color":"bfdadc","default":false},{"id":441165144,"url":"https://api.github.com/repos/openssl/openssl/labels/master","name":"master","color":"bfdadc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openssl/openssl/pulls/6179/commits","review_comments_url":"https://api.github.com/repos/openssl/openssl/pulls/6179/comments","review_comment_url":"https://api.github.com/repos/openssl/openssl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openssl/openssl/issues/6179/comments","statuses_url":"https://api.github.com/repos/openssl/openssl/statuses/b4c73d4027ace17c90765c519a4383b6596c778e","head":{"label":"levitte:document-password-handling","ref":"document-password-handling","sha":"b4c73d4027ace17c90765c519a4383b6596c778e","user":{"login":"levitte","id":698918,"avatar_url":"https://avatars1.githubusercontent.com/u/698918?v=4","gravatar_id":"","url":"https://api.github.com/users/levitte","html_url":"https://github.com/levitte","followers_url":"https://api.github.com/users/levitte/followers","following_url":"https://api.github.com/users/levitte/following{/other_user}","gists_url":"https://api.github.com/users/levitte/gists{/gist_id}","starred_url":"https://api.github.com/users/levitte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levitte/subscriptions","organizations_url":"https://api.github.com/users/levitte/orgs","repos_url":"https://api.github.com/users/levitte/repos","events_url":"https://api.github.com/users/levitte/events{/privacy}","received_events_url":"https://api.github.com/users/levitte/received_events","type":"User","site_admin":false},"repo":{"id":22960861,"name":"openssl","full_name":"levitte/openssl","owner":{"login":"levitte","id":698918,"avatar_url":"https://avatars1.githubusercontent.com/u/698918?v=4","gravatar_id":"","url":"https://api.github.com/users/levitte","html_url":"https://github.com/levitte","followers_url":"https://api.github.com/users/levitte/followers","following_url":"https://api.github.com/users/levitte/following{/other_user}","gists_url":"https://api.github.com/users/levitte/gists{/gist_id}","starred_url":"https://api.github.com/users/levitte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levitte/subscriptions","organizations_url":"https://api.github.com/users/levitte/orgs","repos_url":"https://api.github.com/users/levitte/repos","events_url":"https://api.github.com/users/levitte/events{/privacy}","received_events_url":"https://api.github.com/users/levitte/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/levitte/openssl","description":null,"fork":true,"url":"https://api.github.com/repos/levitte/openssl","forks_url":"https://api.github.com/repos/levitte/openssl/forks","keys_url":"https://api.github.com/repos/levitte/openssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/levitte/openssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/levitte/openssl/teams","hooks_url":"https://api.github.com/repos/levitte/openssl/hooks","issue_events_url":"https://api.github.com/repos/levitte/openssl/issues/events{/number}","events_url":"https://api.github.com/repos/levitte/openssl/events","assignees_url":"https://api.github.com/repos/levitte/openssl/assignees{/user}","branches_url":"https://api.github.com/repos/levitte/openssl/branches{/branch}","tags_url":"https://api.github.com/repos/levitte/openssl/tags","blobs_url":"https://api.github.com/repos/levitte/openssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/levitte/openssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/levitte/openssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/levitte/openssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/levitte/openssl/statuses/{sha}","languages_url":"https://api.github.com/repos/levitte/openssl/languages","stargazers_url":"https://api.github.com/repos/levitte/openssl/stargazers","contributors_url":"https://api.github.com/repos/levitte/openssl/contributors","subscribers_url":"https://api.github.com/repos/levitte/openssl/subscribers","subscription_url":"https://api.github.com/repos/levitte/openssl/subscription","commits_url":"https://api.github.com/repos/levitte/openssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/levitte/openssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/levitte/openssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/levitte/openssl/issues/comments{/number}","contents_url":"https://api.github.com/repos/levitte/openssl/contents/{+path}","compare_url":"https://api.github.com/repos/levitte/openssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/levitte/openssl/merges","archive_url":"https://api.github.com/repos/levitte/openssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/levitte/openssl/downloads","issues_url":"https://api.github.com/repos/levitte/openssl/issues{/number}","pulls_url":"https://api.github.com/repos/levitte/openssl/pulls{/number}","milestones_url":"https://api.github.com/repos/levitte/openssl/milestones{/number}","notifications_url":"https://api.github.com/repos/levitte/openssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/levitte/openssl/labels{/name}","releases_url":"https://api.github.com/repos/levitte/openssl/releases{/id}","deployments_url":"https://api.github.com/repos/levitte/openssl/deployments","created_at":"2014-08-14T16:32:56Z","updated_at":"2017-07-15T16:59:17Z","pushed_at":"2018-05-14T03:39:59Z","git_url":"git://github.com/levitte/openssl.git","ssh_url":"git@github.com:levitte/openssl.git","clone_url":"https://github.com/levitte/openssl.git","svn_url":"https://github.com/levitte/openssl","homepage":"","size":149168,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openssl:master","ref":"master","sha":"1c534560dc905b6d399dbde242422f0cf5543286","user":{"login":"openssl","id":3279138,"avatar_url":"https://avatars2.githubusercontent.com/u/3279138?v=4","gravatar_id":"","url":"https://api.github.com/users/openssl","html_url":"https://github.com/openssl","followers_url":"https://api.github.com/users/openssl/followers","following_url":"https://api.github.com/users/openssl/following{/other_user}","gists_url":"https://api.github.com/users/openssl/gists{/gist_id}","starred_url":"https://api.github.com/users/openssl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openssl/subscriptions","organizations_url":"https://api.github.com/users/openssl/orgs","repos_url":"https://api.github.com/users/openssl/repos","events_url":"https://api.github.com/users/openssl/events{/privacy}","received_events_url":"https://api.github.com/users/openssl/received_events","type":"Organization","site_admin":false},"repo":{"id":7634677,"name":"openssl","full_name":"openssl/openssl","owner":{"login":"openssl","id":3279138,"avatar_url":"https://avatars2.githubusercontent.com/u/3279138?v=4","gravatar_id":"","url":"https://api.github.com/users/openssl","html_url":"https://github.com/openssl","followers_url":"https://api.github.com/users/openssl/followers","following_url":"https://api.github.com/users/openssl/following{/other_user}","gists_url":"https://api.github.com/users/openssl/gists{/gist_id}","starred_url":"https://api.github.com/users/openssl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openssl/subscriptions","organizations_url":"https://api.github.com/users/openssl/orgs","repos_url":"https://api.github.com/users/openssl/repos","events_url":"https://api.github.com/users/openssl/events{/privacy}","received_events_url":"https://api.github.com/users/openssl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openssl/openssl","description":"TLS/SSL and crypto library","fork":false,"url":"https://api.github.com/repos/openssl/openssl","forks_url":"https://api.github.com/repos/openssl/openssl/forks","keys_url":"https://api.github.com/repos/openssl/openssl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openssl/openssl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openssl/openssl/teams","hooks_url":"https://api.github.com/repos/openssl/openssl/hooks","issue_events_url":"https://api.github.com/repos/openssl/openssl/issues/events{/number}","events_url":"https://api.github.com/repos/openssl/openssl/events","assignees_url":"https://api.github.com/repos/openssl/openssl/assignees{/user}","branches_url":"https://api.github.com/repos/openssl/openssl/branches{/branch}","tags_url":"https://api.github.com/repos/openssl/openssl/tags","blobs_url":"https://api.github.com/repos/openssl/openssl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openssl/openssl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openssl/openssl/git/refs{/sha}","trees_url":"https://api.github.com/repos/openssl/openssl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openssl/openssl/statuses/{sha}","languages_url":"https://api.github.com/repos/openssl/openssl/languages","stargazers_url":"https://api.github.com/repos/openssl/openssl/stargazers","contributors_url":"https://api.github.com/repos/openssl/openssl/contributors","subscribers_url":"https://api.github.com/repos/openssl/openssl/subscribers","subscription_url":"https://api.github.com/repos/openssl/openssl/subscription","commits_url":"https://api.github.com/repos/openssl/openssl/commits{/sha}","git_commits_url":"https://api.github.com/repos/openssl/openssl/git/commits{/sha}","comments_url":"https://api.github.com/repos/openssl/openssl/comments{/number}","issue_comment_url":"https://api.github.com/repos/openssl/openssl/issues/comments{/number}","contents_url":"https://api.github.com/repos/openssl/openssl/contents/{+path}","compare_url":"https://api.github.com/repos/openssl/openssl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openssl/openssl/merges","archive_url":"https://api.github.com/repos/openssl/openssl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openssl/openssl/downloads","issues_url":"https://api.github.com/repos/openssl/openssl/issues{/number}","pulls_url":"https://api.github.com/repos/openssl/openssl/pulls{/number}","milestones_url":"https://api.github.com/repos/openssl/openssl/milestones{/number}","notifications_url":"https://api.github.com/repos/openssl/openssl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openssl/openssl/labels{/name}","releases_url":"https://api.github.com/repos/openssl/openssl/releases{/id}","deployments_url":"https://api.github.com/repos/openssl/openssl/deployments","created_at":"2013-01-15T22:34:48Z","updated_at":"2018-05-14T06:45:51Z","pushed_at":"2018-05-14T03:41:20Z","git_url":"git://github.com/openssl/openssl.git","ssh_url":"git@github.com:openssl/openssl.git","clone_url":"https://github.com/openssl/openssl.git","svn_url":"https://github.com/openssl/openssl","homepage":"https://www.openssl.org","size":147380,"stargazers_count":7069,"watchers_count":7069,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3434,"mirror_url":null,"archived":false,"open_issues_count":364,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":3434,"open_issues":364,"watchers":7069,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openssl/openssl/pulls/6179"},"html":{"href":"https://github.com/openssl/openssl/pull/6179"},"issue":{"href":"https://api.github.com/repos/openssl/openssl/issues/6179"},"comments":{"href":"https://api.github.com/repos/openssl/openssl/issues/6179/comments"},"review_comments":{"href":"https://api.github.com/repos/openssl/openssl/pulls/6179/comments"},"review_comment":{"href":"https://api.github.com/repos/openssl/openssl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openssl/openssl/pulls/6179/commits"},"statuses":{"href":"https://api.github.com/repos/openssl/openssl/statuses/b4c73d4027ace17c90765c519a4383b6596c778e"}},"author_association":"OWNER"}}
{"actor":{"display_login":"mspncp"}}