{"action":"created","issue":{"url":"https://api.github.com/repos/unixcharles/acme-client/issues/24","labels_url":"https://api.github.com/repos/unixcharles/acme-client/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/unixcharles/acme-client/issues/24/comments","events_url":"https://api.github.com/repos/unixcharles/acme-client/issues/24/events","html_url":"https://github.com/unixcharles/acme-client/issues/24","id":120451672,"number":24,"title":"CSR generator","user":{"login":"jhass","id":141294,"avatar_url":"https://avatars.githubusercontent.com/u/141294?v=3","gravatar_id":"","url":"https://api.github.com/users/jhass","html_url":"https://github.com/jhass","followers_url":"https://api.github.com/users/jhass/followers","following_url":"https://api.github.com/users/jhass/following{/other_user}","gists_url":"https://api.github.com/users/jhass/gists{/gist_id}","starred_url":"https://api.github.com/users/jhass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhass/subscriptions","organizations_url":"https://api.github.com/users/jhass/orgs","repos_url":"https://api.github.com/users/jhass/repos","events_url":"https://api.github.com/users/jhass/events{/privacy}","received_events_url":"https://api.github.com/users/jhass/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/unixcharles/acme-client/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-04T17:47:47Z","updated_at":"2015-12-04T18:20:50Z","closed_at":null,"body":"A very common task when using this library will be generating a CSR. Ruby's OpenSSL API is rather inconvenient, especially when it comes down to including a `subjectAltName` extension.\r\n\r\nShould we provide a convenience class to ease CSR generation? What would the interface look like? First thoughts would be to keep it as simple as `client.new_certificate(%w(example.org www.example.org), private_key)`, `client.new_certificate(Acme.generate_csr(%w(example.org www.example.org), private_key)` or `client.new_certificate(Acme::Csr.new(%w(example.org www.example.org), private_key))`. The first hostname would be picked for the `CN`."},"comment":{"url":"https://api.github.com/repos/unixcharles/acme-client/issues/comments/162040381","html_url":"https://github.com/unixcharles/acme-client/issues/24#issuecomment-162040381","issue_url":"https://api.github.com/repos/unixcharles/acme-client/issues/24","id":162040381,"user":{"login":"unixcharles","id":78458,"avatar_url":"https://avatars.githubusercontent.com/u/78458?v=3","gravatar_id":"","url":"https://api.github.com/users/unixcharles","html_url":"https://github.com/unixcharles","followers_url":"https://api.github.com/users/unixcharles/followers","following_url":"https://api.github.com/users/unixcharles/following{/other_user}","gists_url":"https://api.github.com/users/unixcharles/gists{/gist_id}","starred_url":"https://api.github.com/users/unixcharles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unixcharles/subscriptions","organizations_url":"https://api.github.com/users/unixcharles/orgs","repos_url":"https://api.github.com/users/unixcharles/repos","events_url":"https://api.github.com/users/unixcharles/events{/privacy}","received_events_url":"https://api.github.com/users/unixcharles/received_events","type":"User","site_admin":false},"created_at":"2015-12-04T18:20:50Z","updated_at":"2015-12-04T18:20:50Z","body":"I agree.\r\n\r\nIf we can save anyone from having figuring out what's an \"OpenSSL::X509::ExtensionFactory\" or a \"OpenSSL::ASN1::UTF8STRING\", that would be for the best.\r\n\r\nI would also like to provide the most commonly used optional fields to cover most use cases.\r\n\r\nMaybe something in the line of:\r\n\r\n```ruby\r\nAcme::CertificateSigningRequest.new(\r\n  common_name: 'example.org',\r\n  key_pair: key_pair,\r\n  subject_alt_names: ['www.example.org'],\r\n  subject: { organization_name: 'example', email: 'hostmaster@example.com', country_name: 'CA', state_or_province_name: 'Quebec', locality_name: 'Montreal'}\r\n)\r\n```\r\n\r\nAlso, ensure the client work with PEM formatted string or any object that respond to `to_pem`. This way users are free do use `OpenSSL::X509::Request` directly or whatever else that fit their needs."}}