title: Telegram bot on OpenSSL
body: <p>I have problem with <a href="https://core.telegram.org/bots" rel="nofollow">https://core.telegram.org/bots</a>.</p>
  
  <ol>
  <li>Get token from BotFather.</li>
  <li><p>Create self-signed ssl sertificate (<a href="https://core.telegram.org/bots/self-signed" rel="nofollow">https://core.telegram.org/bots/self-signed</a>):</p>
  
  <p>openssl req -newkey rsa:2048 -sha256 -nodes -keyout YOURPRIVATE.key -x509 -days 365 -out YOURPUBLIC.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=YOURDOMAIN.EXAMPLE" </p></li>
  <li><p>Run server:</p>
  
  <p>openssl s_server -accept 88 -key YOURPRIVATE.key -cert YOURPUBLIC.pem</p></li>
  <li><p>Send hook:</p>
  
  <p>curl -F "url=<a href="https://URL:88/bot" rel="nofollow">https://URL:88/bot</a>" -F "certificate=@YOURPUBLIC.pem" <a href="https://api.telegram.org/botTOKEN/setWebhook" rel="nofollow">https://api.telegram.org/botTOKEN/setWebhook</a></p></li>
  </ol>
  
  <p>Answer:</p>
  
  <pre><code>{"ok":true,"result":true,"description":"Webhook was set"}
  </code></pre>
  
  <ol start="5">
  <li><p>Telegram connect to my server. Error:</p>
  
  <p>139690177754952:error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown:s3_pkt.c:1257:SSL alert number 46</p></li>
  <li><p>Test:</p>
  
  <p>openssl s_client -connect URL:88</p></li>
  </ol>
  
  <p>OK. No problem.</p>
  
  <p>How to:</p>
  
  <ol>
  <li>Run openssl s_client ... as Telegram. Use -cert YOURPUBLIC.pem not work.</li>
  <li>Fix this problems and recive data.</li>
  </ol>