Logo Search packages:      
Sourcecode: kmess version File versions  Download package

void MsnNotificationConnection::loginSucceeded (  )  [private, slot]

The passport login succeeded.

When this method gets called, CurrentAccount will contain all the needed passport security tokens.

Definition at line 1691 of file msnnotificationconnection.cpp.

References createTripleDes(), MsnConnection::deleteSoapClient(), CurrentAccount::getToken(), and MsnConnection::sendCommand().

Referenced by createPassportLoginService().

{
  // Delete the login handler
  // Delay deletion so it can complete the method.
  deleteSoapClient( passportLoginService_ );
  passportLoginService_ = 0;

  // Initialize the QCA and create the IV key for triple des encryption
  QCA::Initializer init;
  QCA::InitializationVector iv(8);

  // Create the keys and hashes needed
  QByteArray key1, key2, key3;
  QByteArray hash, des3hash;

  // Use the nonce received from last USR commands and the proof key for authentication
  QByteArray nonce = nonceBase64_.toLatin1();

  // Compute the value to send with USR SSO command
  QString magic1( "WS-SecureConversationSESSION KEY HASH" );
  QString magic2( "WS-SecureConversationSESSION KEY ENCRYPTION" );

  key1 = QByteArray::fromBase64( currentAccount_->getToken( "MessengerClearProof" ).toLatin1() );
  key2 = KMessShared::deriveKey( key1, magic1.toLatin1() );
  key3 = KMessShared::deriveKey( key1, magic2.toLatin1() );
  hash = KMessShared::createHMACSha1( key2, nonce );

  // The windows api always pads using \x08 so we pad 8 bytes.
  nonce += QByteArray ( 8, '\x08' );

  // Compute the 3des encryption
  des3hash = createTripleDes ( key3, nonce, iv );
  if( des3hash.isEmpty() )
  {
    return;
  }

  // Create the required 128 byte padded struct
  MSNPMSNG blob;
  blob.headerSize   = qToLittleEndian( 28 );
  blob.cryptMode    = qToLittleEndian( 1 ); // CRYPT_MODE_CBC
  blob.cipherType   = qToLittleEndian( 0x6603 ); // Triple DES
  blob.hashType     = qToLittleEndian( 0x8004 ); // SHA-1
  blob.ivLength     = qToLittleEndian( 8 );
  blob.hashLength   = qToLittleEndian( 20 ); // Length of the HMAC hash
  blob.cipherLength = qToLittleEndian( 72 );

  // Copy the IV Bytes, the hash and chiper value in blob struct
  memcpy( (char*) blob.ivBytes, iv.constData() , des3hash.size() );
  memcpy( (char*) blob.hashBytes, hash.constData(), hash.size() );
  memcpy( (char*) blob.cipherBytes, des3hash.constData(), des3hash.size() );

  // Create the byte arrays and send for login
  QByteArray blobs( (char*) &blob, 128 );

  sendCommand( "USR", "SSO S " + currentAccount_->getToken( "MessengerClear" ) + " " + blobs.toBase64() );
}


Generated by  Doxygen 1.6.0   Back to index