title: openconnect password and cookie input
body: <p>After 2-3 day search and work now i hope you can help ...<br>
  I want to use from openconnect in my program and for auth have 2 solution<br>
  1 - use from user and pass (but pass dont have any option for command line and only with standard input can input pass)<br>
  2 - used from cookie (but openconnect not work with cookie for me !)<br></p>
  
  <p>For Cookie i do this<br></p>
  
  <p>-send user with post method to server <br>
  -server ask for password <br>
  -send password with post method to server <br>
  -if all is ok and auth id = success  <br>
  -read header and get cookie <br></p>
  
  <p>open command line and send ip and cookie to openconenct  <br></p>
  
  <p>and Error ! </p>
  
  <blockquote>
    <p>Creating SSL connection failed</p>
  </blockquote>
  
  <p>command line code </p>
  
  <pre><code>openconnect.exe vpn.server.ip --no-cert-check -C "webvpn=BPlUDg9oaTN2uQQ0DQvH7QopD3x5NahiCHQgTqKQ7KPJg38dSuvqLmYIo9Jskig; Secure,webvpnc=; expires=Thu, 01 Jan 1970 22:00:00 GMT; path=/; Secure,webvpnc=bu:/&amp;p:t&amp;iu:1/&amp;sh:7350D46A8EE85D06&amp;lu:/+CSCOT+/translation-table?textdomain%3DAnyConnect%26type%3Dmanifest&amp;fu:profiles%2F/etc/ocserv/profile.xml&amp;fh:6B5181182D2B5483FBB8D2AA1BCBACC9A70E2BA3; path=/; Secure"
  </code></pre>
  
  <p>for send user and pass with post method i use from C# </p>
  
  <p>2 - for user and pass i do this work<br>
  use from command line for auto fill input with this code</p>
  
  <pre><code>type password | openconnect.exe vpn.server.ip -u username --no-cert-check
  </code></pre>
  
  <p>and</p>
  
  <pre><code>password | openconnect.exe vpn.server.ip -u username --no-cert-check
  </code></pre>
  
  <p>and</p>
  
  <pre><code>openconnect.exe vpn.server.ip -u username --no-cert-check &lt; pas.txt
  </code></pre>
  
  <p>and again error !!!</p>
  
  <blockquote>
    <p>Password: ReadConsole() failed: The handle is invalid.</p>
  </blockquote>
  
  <p>now i want to know whats wrong in my code ??</p>
  
  <p>or have any better solution for accept cookie or auto fill input ? </p>
  
  <p>if you have any idea please tell me.</p>
  
  <p>thanks and kind regards.</p>
  
  <p><a href="http://www.infradead.org/openconnect/manual.html" rel="nofollow">openconnect command line info</a></p>