title: Encryption puzzle / How to create a PassStub for a Remote Assistance ticket
body: <p>I am trying to create a ticket for Remote Assistance. Part of that requires creating a PassStub parameter. As of the documentation: </p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/cc240115(PROT.10).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc240115(PROT.10).aspx</a></p>
  
  <p>PassStub: The encrypted novice computer's password string. When the Remote 
  Assistance Connection String is sent as a file over e-mail, to provide additional security, a 
  password is used.&lt;16> </p>
  
  <p>In part 16 they detail how to create as PassStub.
  In Windows XP and Windows Server 2003, when a password is used, it is encrypted using 
  PROV_RSA_FULL predefined Cryptographic provider with MD5 hashing and CALG_RC4, the RC4 
  stream encryption algorithm. </p>
  
  <p>As PassStub looks like this in the file:
  PassStub="LK#6Lh*gCmNDpj"</p>
  
  <p>If you want to generate one yourself run msra.exe in Vista or run the Remote Assistance tool in WinXP.</p>
  
  <p>The documentation says this stub is the result of the function CryptEncrypt with the key derived from the password and encrypted with the session id (Those are also in the ticket file). </p>
  
  <p>The problem is that CryptEncrypt produces a binary output way larger than the 15 byte PassStub. Also the PassStub isn't encoding in any way I've seen before.</p>
  
  <p>Some interesting things about the PassStub encoding. After doing statistical analysis the 3rd char is always a one of: !#$&amp;()+-=@^. Only symbols seen everywhere are: *_ . Otherwise the valid characters are 0-9 a-z A-Z. There are a total of 75 valid characters and they are always 15 bytes.</p>
  
  <p>Running msra.exe with the same password always generates a different PassStub, indicating that it is not a direct hash but includes the rasessionid as they say.  </p>
  
  <p>Another idea I've had is that it is not the direct result of CryptEncrypt, but a result of the rasessionid in the MD5 hash. In MS-RA (<a href="http://msdn.microsoft.com/en-us/library/cc240013(PROT.10).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc240013(PROT.10).aspx</a>). The "PassStub Novice" is simply hex encoded, and looks to be the right length. The problem is I have no idea how to go from any hash to way the PassStub looks like. </p>